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

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

Issue 637653002: Looping one-sample AudioBufferSourceNode should work. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/webaudio/audiobuffersource-one-sample-loop-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 double loopEndFrame = m_loopEnd * buffer()->sampleRate(); 229 double loopEndFrame = m_loopEnd * buffer()->sampleRate();
230 230
231 virtualEndFrame = std::min(loopEndFrame, virtualEndFrame); 231 virtualEndFrame = std::min(loopEndFrame, virtualEndFrame);
232 virtualDeltaFrames = virtualEndFrame - loopStartFrame; 232 virtualDeltaFrames = virtualEndFrame - loopStartFrame;
233 } 233 }
234 234
235 235
236 double pitchRate = totalPitchRate(); 236 double pitchRate = totalPitchRate();
237 237
238 // Sanity check that our playback rate isn't larger than the loop size. 238 // Sanity check that our playback rate isn't larger than the loop size.
239 if (pitchRate >= virtualDeltaFrames) 239 if (pitchRate > virtualDeltaFrames)
240 return false; 240 return false;
241 241
242 // Get local copy. 242 // Get local copy.
243 double virtualReadIndex = m_virtualReadIndex; 243 double virtualReadIndex = m_virtualReadIndex;
244 244
245 // Render loop - reading from the source buffer to the destination using lin ear interpolation. 245 // Render loop - reading from the source buffer to the destination using lin ear interpolation.
246 int framesToProcess = numberOfFrames; 246 int framesToProcess = numberOfFrames;
247 247
248 const float** sourceChannels = m_sourceChannels.get(); 248 const float** sourceChannels = m_sourceChannels.get();
249 float** destinationChannels = m_destinationChannels.get(); 249 float** destinationChannels = m_destinationChannels.get();
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 { 503 {
504 visitor->trace(m_buffer); 504 visitor->trace(m_buffer);
505 visitor->trace(m_playbackRate); 505 visitor->trace(m_playbackRate);
506 visitor->trace(m_pannerNode); 506 visitor->trace(m_pannerNode);
507 AudioScheduledSourceNode::trace(visitor); 507 AudioScheduledSourceNode::trace(visitor);
508 } 508 }
509 509
510 } // namespace blink 510 } // namespace blink
511 511
512 #endif // ENABLE(WEB_AUDIO) 512 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « LayoutTests/webaudio/audiobuffersource-one-sample-loop-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698