Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp

Issue 2839063003: Implement tail processing for AudioNodes (Closed)
Patch Set: Make declaration order consistent Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 size_t buffer_length = Buffer()->length(); 223 size_t buffer_length = Buffer()->length();
224 double buffer_sample_rate = Buffer()->sampleRate(); 224 double buffer_sample_rate = Buffer()->sampleRate();
225 225
226 // Avoid converting from time to sample-frames twice by computing 226 // Avoid converting from time to sample-frames twice by computing
227 // the grain end time first before computing the sample frame. 227 // the grain end time first before computing the sample frame.
228 unsigned end_frame = 228 unsigned end_frame =
229 is_grain_ ? AudioUtilities::TimeToSampleFrame( 229 is_grain_ ? AudioUtilities::TimeToSampleFrame(
230 grain_offset_ + grain_duration_, buffer_sample_rate) 230 grain_offset_ + grain_duration_, buffer_sample_rate)
231 : buffer_length; 231 : buffer_length;
232 232
233 // This is a HACK to allow for HRTF tail-time - avoids glitch at end.
234 // FIXME: implement tailTime for each AudioNode for a more general solution to
235 // this problem, https://bugs.webkit.org/show_bug.cgi?id=77224
236 if (is_grain_)
237 end_frame += 512;
238
239 // Do some sanity checking. 233 // Do some sanity checking.
240 if (end_frame > buffer_length) 234 if (end_frame > buffer_length)
241 end_frame = buffer_length; 235 end_frame = buffer_length;
242 236
243 // If the .loop attribute is true, then values of 237 // If the .loop attribute is true, then values of
244 // m_loopStart == 0 && m_loopEnd == 0 implies that we should use the entire 238 // m_loopStart == 0 && m_loopEnd == 0 implies that we should use the entire
245 // buffer as the loop, otherwise use the loop values in m_loopStart and 239 // buffer as the loop, otherwise use the loop values in m_loopStart and
246 // m_loopEnd. 240 // m_loopEnd.
247 double virtual_end_frame = end_frame; 241 double virtual_end_frame = end_frame;
248 double virtual_delta_frames = end_frame; 242 double virtual_delta_frames = end_frame;
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 757
764 void AudioBufferSourceNode::start(double when, 758 void AudioBufferSourceNode::start(double when,
765 double grain_offset, 759 double grain_offset,
766 double grain_duration, 760 double grain_duration,
767 ExceptionState& exception_state) { 761 ExceptionState& exception_state) {
768 GetAudioBufferSourceHandler().Start(when, grain_offset, grain_duration, 762 GetAudioBufferSourceHandler().Start(when, grain_offset, grain_duration,
769 exception_state); 763 exception_state);
770 } 764 }
771 765
772 } // namespace blink 766 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698