Revert "WebAudio task shouldn't be running on suspend to reduce usage of CPU."
[framework/web/webkit-efl.git] / Source / WebCore / Modules / webaudio / AudioBufferSourceNode.cpp
index 42fdd7e..32f43d3 100644 (file)
@@ -69,9 +69,9 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* context, float sample
 {
     setNodeType(NodeTypeAudioBufferSource);
 
-    m_gain = AudioGain::create(context, "gain", 1.0, 0.0, 1.0);
+    m_gain = AudioParam::create(context, "gain", 1.0, 0.0, 1.0);
     m_playbackRate = AudioParam::create(context, "playbackRate", 1.0, 0.0, MaxRate);
-    
+
     // Default to mono.  A call to setBuffer() will set the number of output channels to that of the buffer.
     addOutput(adoptPtr(new AudioNodeOutput(this, 1)));
 
@@ -372,18 +372,37 @@ unsigned AudioBufferSourceNode::numberOfChannels()
     return output(0)->numberOfChannels();
 }
 
+#if ENABLE(TIZEN_WEB_AUDIO)
+void AudioBufferSourceNode::startGrain(double when, double grainOffset, ExceptionCode& ec)
+{
+    // Duration of 0 has special value, meaning calculate based on the entire buffer's duration.
+    startGrain(when, grainOffset, 0, ec);
+}
+#else
 void AudioBufferSourceNode::startGrain(double when, double grainOffset)
 {
     // Duration of 0 has special value, meaning calculate based on the entire buffer's duration.
     startGrain(when, grainOffset, 0);
 }
+#endif
 
+#if ENABLE(TIZEN_WEB_AUDIO)
+void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration, ExceptionCode& ec)
+#else
 void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration)
+#endif
 {
     ASSERT(isMainThread());
 
+#if ENABLE(TIZEN_WEB_AUDIO)
+    if (m_playbackState != UNSCHEDULED_STATE) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+#else
     if (m_playbackState != UNSCHEDULED_STATE)
         return;
+#endif
 
     if (!buffer())
         return;
@@ -416,12 +435,21 @@ void AudioBufferSourceNode::startGrain(double when, double grainOffset, double g
     m_playbackState = SCHEDULED_STATE;
 }
 
+#if ENABLE(TIZEN_WEB_AUDIO)
+#if ENABLE(LEGACY_WEB_AUDIO)
+void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode& ec)
+{
+    startGrain(when, grainOffset, grainDuration, ec);
+}
+#endif
+#else
 #if ENABLE(LEGACY_WEB_AUDIO)
 void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration)
 {
     startGrain(when, grainOffset, grainDuration);
 }
 #endif
+#endif
 
 double AudioBufferSourceNode::totalPitchRate()
 {