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

Unified Diff: Source/modules/webaudio/AudioBufferSourceNode.cpp

Issue 26913005: start/stop method for AudioBufferSourceNodes and OscillatorNodes can take no args. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webaudio/AudioBufferSourceNode.h ('k') | Source/modules/webaudio/AudioBufferSourceNode.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioBufferSourceNode.cpp
diff --git a/Source/modules/webaudio/AudioBufferSourceNode.cpp b/Source/modules/webaudio/AudioBufferSourceNode.cpp
index e9bb788e033e897f967969f35a96ee6554fb5b2a..efc3344d5510ed70e9a063f5cb751a6372a322f2 100644
--- a/Source/modules/webaudio/AudioBufferSourceNode.cpp
+++ b/Source/modules/webaudio/AudioBufferSourceNode.cpp
@@ -381,13 +381,17 @@ unsigned AudioBufferSourceNode::numberOfChannels()
return output(0)->numberOfChannels();
}
-void AudioBufferSourceNode::startGrain(double when, double grainOffset)
+void AudioBufferSourceNode::start(double when)
{
- // Duration of 0 has special value, meaning calculate based on the entire buffer's duration.
- startGrain(when, grainOffset, 0);
+ start(when, 0, buffer()->duration());
}
-void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration)
+void AudioBufferSourceNode::start(double when, double grainOffset)
+{
+ start(when, grainOffset, buffer()->duration() - grainOffset);
+}
+
+void AudioBufferSourceNode::start(double when, double grainOffset, double grainDuration)
{
ASSERT(isMainThread());
@@ -404,16 +408,14 @@ void AudioBufferSourceNode::startGrain(double when, double grainOffset, double g
grainOffset = min(bufferDuration, grainOffset);
m_grainOffset = grainOffset;
- // Handle default/unspecified duration.
double maxDuration = bufferDuration - grainOffset;
- if (!grainDuration)
- grainDuration = maxDuration;
grainDuration = max(0.0, grainDuration);
grainDuration = min(maxDuration, grainDuration);
m_grainDuration = grainDuration;
- m_isGrain = true;
+ // Make this a grain if we're not playing the entire buffer.
+ m_isGrain = m_grainOffset || m_grainDuration != bufferDuration;
Ken Russell (switch to Gerrit) 2013/10/28 21:32:30 The == comparison with bufferDuration seems like i
m_startTime = when;
// We call timeToSampleFrame here since at playbackRate == 1 we don't want to go through linear interpolation
@@ -427,7 +429,7 @@ void AudioBufferSourceNode::startGrain(double when, double grainOffset, double g
void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration)
{
- startGrain(when, grainOffset, grainDuration);
+ start(when, grainOffset, grainDuration);
}
double AudioBufferSourceNode::totalPitchRate()
« no previous file with comments | « Source/modules/webaudio/AudioBufferSourceNode.h ('k') | Source/modules/webaudio/AudioBufferSourceNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698