Change setTargetValueAtTime() to setTargetAtTime()
authorcrogers@google.com <crogers@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Oct 2012 22:11:31 +0000 (22:11 +0000)
committercrogers@google.com <crogers@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Oct 2012 22:11:31 +0000 (22:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100153

Reviewed by Adam Barth.

Source/WebCore:

The AudioParam method name has changed due to Web Audio API spec review.
Keep legacy support for the old name.

Test: webaudio/audioparam-setTargetAtTime.html

* Modules/webaudio/AudioParam.h:
(WebCore::AudioParam::setTargetAtTime):
* Modules/webaudio/AudioParam.idl:
* Modules/webaudio/AudioParamTimeline.cpp:
(WebCore::AudioParamTimeline::setTargetAtTime):
(WebCore::AudioParamTimeline::valuesForTimeRangeImpl):
* Modules/webaudio/AudioParamTimeline.h:
(AudioParamTimeline):

LayoutTests:

* webaudio/audioparam-setTargetAtTime-expected.txt: Renamed from LayoutTests/webaudio/audioparam-setTargetValueAtTime-expected.txt.
* webaudio/audioparam-setTargetAtTime.html: Renamed from LayoutTests/webaudio/audioparam-setTargetValueAtTime.html.
* webaudio/resources/audioparam-testing.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132274 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/webaudio/audioparam-setTargetAtTime-expected.txt [moved from LayoutTests/webaudio/audioparam-setTargetValueAtTime-expected.txt with 70% similarity]
LayoutTests/webaudio/audioparam-setTargetAtTime.html [moved from LayoutTests/webaudio/audioparam-setTargetValueAtTime.html with 83% similarity]
LayoutTests/webaudio/resources/audioparam-testing.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioParam.h
Source/WebCore/Modules/webaudio/AudioParam.idl
Source/WebCore/Modules/webaudio/AudioParamTimeline.cpp
Source/WebCore/Modules/webaudio/AudioParamTimeline.h

index 5e71378..3f35812 100644 (file)
@@ -1,3 +1,14 @@
+2012-10-23  Chris Rogers  <crogers@google.com>
+
+        Change setTargetValueAtTime() to setTargetAtTime()
+        https://bugs.webkit.org/show_bug.cgi?id=100153
+
+        Reviewed by Adam Barth.
+
+        * webaudio/audioparam-setTargetAtTime-expected.txt: Renamed from LayoutTests/webaudio/audioparam-setTargetValueAtTime-expected.txt.
+        * webaudio/audioparam-setTargetAtTime.html: Renamed from LayoutTests/webaudio/audioparam-setTargetValueAtTime.html.
+        * webaudio/resources/audioparam-testing.js:
+
 2012-10-23  Elliott Sprehn  <esprehn@chromium.org>
 
         Generated should not be supported for things with a shadow
@@ -1,10 +1,10 @@
-Test AudioParam setTargetValueAtTime() functionality.
+Test AudioParam setTargetAtTime() functionality.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS All 100 tests started and ended at the correct time.
 PASS All 100 tests passed within an acceptable tolerance.
-PASS AudioParam setTargetValueAtTime() test passed.
+PASS AudioParam setTargetAtTime() test passed.
 PASS successfullyParsed is true
 
 TEST COMPLETE
 <div id="console"></div>
 
 <script>
-description("Test AudioParam setTargetValueAtTime() functionality.");
+description("Test AudioParam setTargetAtTime() functionality.");
 
 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime() and
-// setTargetValueAtTime at regular intervals to set the starting value and the target
+// setTargetAtTime at regular intervals to set the starting value and the target
 // value. Each time interval has a ramp with a different starting and target value so that
 // there is a discontinuity at each time interval boundary.  The discontinuity is for testing
 // timing.  Also, we alternate between an increasing and decreasing ramp for each interval.
@@ -37,8 +37,8 @@ function setValue(value, time)
 // Generate an exponential approach starting at |startTime| with a target value of |value|.
 function automation(value, startTime, endTime)
 {
-    // endTime is not used for setTargetValueAtTime.
-    gainNode.gain.setTargetValueAtTime(value, startTime, timeConstant)
+    // endTime is not used for setTargetAtTime.
+    gainNode.gain.setTargetAtTime(value, startTime, timeConstant)
 }
 
 function runTest()
@@ -47,7 +47,7 @@ function runTest()
                             initialValue,
                             setValue,
                             automation,
-                            "setTargetValueAtTime()",
+                            "setTargetAtTime()",
                             maxAllowedError,
                             createExponentialApproachArray);
 }
index a176300..a59f67d 100644 (file)
@@ -20,7 +20,7 @@ var discontinuityThreshold;
 var timeInterval = .03;
 
 // Some suitable time constant so that we can see a significant change over a timeInterval.  This is
-// only needed by setTargetValueAtTime() which needs a time constant.
+// only needed by setTargetAtTime() which needs a time constant.
 var timeConstant = timeInterval / 3;
 
 var gainNode;
index 6302cb0..ba1e854 100644 (file)
@@ -1,3 +1,24 @@
+2012-10-23  Chris Rogers  <crogers@google.com>
+
+        Change setTargetValueAtTime() to setTargetAtTime()
+        https://bugs.webkit.org/show_bug.cgi?id=100153
+
+        Reviewed by Adam Barth.
+
+        The AudioParam method name has changed due to Web Audio API spec review.
+        Keep legacy support for the old name.
+
+        Test: webaudio/audioparam-setTargetAtTime.html
+
+        * Modules/webaudio/AudioParam.h:
+        (WebCore::AudioParam::setTargetAtTime):
+        * Modules/webaudio/AudioParam.idl:
+        * Modules/webaudio/AudioParamTimeline.cpp:
+        (WebCore::AudioParamTimeline::setTargetAtTime):
+        (WebCore::AudioParamTimeline::valuesForTimeRangeImpl):
+        * Modules/webaudio/AudioParamTimeline.h:
+        (AudioParamTimeline):
+
 2012-10-23  Benjamin Poulain  <benjamin@webkit.org>
 
         [Mac] Remove extraneous conversion to String->NSString
index d17c6a6..524f98f 100644 (file)
@@ -88,7 +88,7 @@ public:
     void setValueAtTime(float value, float time) { m_timeline.setValueAtTime(value, time); }
     void linearRampToValueAtTime(float value, float time) { m_timeline.linearRampToValueAtTime(value, time); }
     void exponentialRampToValueAtTime(float value, float time) { m_timeline.exponentialRampToValueAtTime(value, time); }
-    void setTargetValueAtTime(float targetValue, float time, float timeConstant) { m_timeline.setTargetValueAtTime(targetValue, time, timeConstant); }
+    void setTargetAtTime(float target, float time, float timeConstant) { m_timeline.setTargetAtTime(target, time, timeConstant); }
     void setValueCurveAtTime(Float32Array* curve, float time, float duration) { m_timeline.setValueCurveAtTime(curve, time, duration); }
     void cancelScheduledValues(float startTime) { m_timeline.cancelScheduledValues(startTime); }
 
index 84a952c..d6d01fe 100644 (file)
@@ -44,8 +44,8 @@
     void linearRampToValueAtTime(in float value, in float time);
     void exponentialRampToValueAtTime(in float value, in float time);
 
-    // Exponentially approach the target value with a rate having the given time constant.
-    void setTargetValueAtTime(in float targetValue, in float time, in float timeConstant);
+    // Exponentially approach the target with a rate having the given time constant.
+    void setTargetAtTime(in float target, in float time, in float timeConstant);
 
     // Sets an array of arbitrary parameter values starting at time for the given duration.
     // The number of values will be scaled to fit into the desired duration.
@@ -53,4 +53,9 @@
 
     // Cancels all scheduled parameter changes with times greater than or equal to startTime.
     void cancelScheduledValues(in float startTime);
+
+#if defined(ENABLE_LEGACY_WEB_AUDIO) && ENABLE_LEGACY_WEB_AUDIO
+    [V8MeasureAs=LegacyWebAudio, ImplementedAs=setTargetAtTime] void setTargetValueAtTime(in float targetValue, in float time, in float timeConstant);
+#endif
+
 };
index 303c5b1..a61c0ad 100644 (file)
@@ -53,9 +53,9 @@ void AudioParamTimeline::exponentialRampToValueAtTime(float value, float time)
     insertEvent(ParamEvent(ParamEvent::ExponentialRampToValue, value, time, 0, 0, 0));
 }
 
-void AudioParamTimeline::setTargetValueAtTime(float targetValue, float time, float timeConstant)
+void AudioParamTimeline::setTargetAtTime(float target, float time, float timeConstant)
 {
-    insertEvent(ParamEvent(ParamEvent::SetTargetValue, targetValue, time, timeConstant, 0, 0));
+    insertEvent(ParamEvent(ParamEvent::SetTarget, target, time, timeConstant, 0, 0));
 }
 
 void AudioParamTimeline::setValueCurveAtTime(Float32Array* curve, float time, float duration)
@@ -274,18 +274,18 @@ float AudioParamTimeline::valuesForTimeRangeImpl(float startTime,
                     break;
                 }
 
-            case ParamEvent::SetTargetValue:
+            case ParamEvent::SetTarget:
                 {
                     currentTime = fillToTime;
 
                     // Exponential approach to target value with given time constant.
-                    float targetValue = event.value();
+                    float target = event.value();
                     float timeConstant = event.timeConstant();
                     float discreteTimeConstant = static_cast<float>(AudioUtilities::discreteTimeConstantForSampleRate(timeConstant, controlRate));
 
                     for (; writeIndex < fillToFrame; ++writeIndex) {
                         values[writeIndex] = value;
-                        value += (targetValue - value) * discreteTimeConstant;
+                        value += (target - value) * discreteTimeConstant;
                     }
 
                     break;
index abc147d..9a3d138 100644 (file)
@@ -47,7 +47,7 @@ public:
     void setValueAtTime(float value, float time);
     void linearRampToValueAtTime(float value, float time);
     void exponentialRampToValueAtTime(float value, float time);
-    void setTargetValueAtTime(float targetValue, float time, float timeConstant);
+    void setTargetAtTime(float target, float time, float timeConstant);
     void setValueCurveAtTime(Float32Array* curve, float time, float duration);
     void cancelScheduledValues(float startTime);
 
@@ -71,7 +71,7 @@ private:
             SetValue,
             LinearRampToValue,
             ExponentialRampToValue,
-            SetTargetValue,
+            SetTarget,
             SetValueCurve,
             LastType
         };