Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audioparam-setTargetAtTime.html
blobfe77394a670a03472215503f34cb9d0abc3a3be7
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <script src="resources/compatibility.js"></script>
5 <script src="resources/audio-testing.js"></script>
6 <script src="resources/audioparam-testing.js"></script>
7 <script src="../resources/js-test.js"></script>
8 </head>
10 <body>
11 <div id="description"></div>
12 <div id="console"></div>
14 <script>
15 description("Test AudioParam setTargetAtTime() functionality.");
17 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime() and
18 // setTargetAtTime at regular intervals to set the starting value and the target
19 // value. Each time interval has a ramp with a different starting and target value so that
20 // there is a discontinuity at each time interval boundary. The discontinuity is for testing
21 // timing. Also, we alternate between an increasing and decreasing ramp for each interval.
23 // Number of tests to run.
24 var numberOfTests = 100;
26 // Max allowed difference between the rendered data and the expected result.
27 var maxAllowedError = 3.9e-5;
29 // The AudioGainNode starts with this value instead of the default value.
30 var initialValue = 100;
32 // Set the gain node value to the specified value at the specified time.
33 function setValue(value, time)
35 gainNode.gain.setValueAtTime(value, time);
38 // Generate an exponential approach starting at |startTime| with a target value of |value|.
39 function automation(value, startTime, endTime)
41 // endTime is not used for setTargetAtTime.
42 gainNode.gain.setTargetAtTime(value, startTime, timeConstant)
45 function runTest()
47 createAudioGraphAndTest(numberOfTests,
48 initialValue,
49 setValue,
50 automation,
51 "setTargetAtTime()",
52 maxAllowedError,
53 createExponentialApproachArray);
56 runTest();
57 successfullyParsed = true;
59 </script>
61 </body>
62 </html>