OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
5 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
6 <script src="../resources/audio-testing.js"></script> | 7 <script src="../resources/audit.js"></script> |
7 <script src="../resources/audioparam-testing.js"></script> | 8 <script src="../resources/audioparam-testing.js"></script> |
8 <title>Test AudioParam.setTargetAtTime</title> | 9 <title>Test AudioParam.setTargetAtTime</title> |
9 </head> | 10 </head> |
10 | 11 |
11 <body> | 12 <body> |
12 <div id="description"></div> | |
13 <div id="console"></div> | |
14 | |
15 <script> | 13 <script> |
16 description("Test AudioParam setTargetAtTime() functionality."); | 14 let audit = Audit.createTaskRunner(); |
17 | 15 |
18 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
and | 16 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
and |
19 // setTargetAtTime at regular intervals to set the starting value and the target | 17 // setTargetAtTime at regular intervals to set the starting value and the target |
20 // value. Each time interval has a ramp with a different starting and target val
ue so that | 18 // value. Each time interval has a ramp with a different starting and target val
ue so that |
21 // there is a discontinuity at each time interval boundary. The discontinuity i
s for testing | 19 // there is a discontinuity at each time interval boundary. The discontinuity i
s for testing |
22 // timing. Also, we alternate between an increasing and decreasing ramp for eac
h interval. | 20 // timing. Also, we alternate between an increasing and decreasing ramp for eac
h interval. |
23 | 21 |
24 // Number of tests to run. | 22 // Number of tests to run. |
25 var numberOfTests = 100; | 23 var numberOfTests = 100; |
26 | 24 |
27 // Max allowed difference between the rendered data and the expected result. | 25 // Max allowed difference between the rendered data and the expected result. |
28 var maxAllowedError = 1.6953e-6; | 26 var maxAllowedError = 1.6953e-6; |
29 | 27 |
30 // The AudioGainNode starts with this value instead of the default value. | 28 // The AudioGainNode starts with this value instead of the default value. |
31 var initialValue = 100; | 29 var initialValue = 100; |
32 | 30 |
33 // Set the gain node value to the specified value at the specified time. | 31 // Set the gain node value to the specified value at the specified time. |
34 function setValue(value, time) | 32 function setValue(value, time) |
35 { | 33 { |
36 gainNode.gain.setValueAtTime(value, time); | 34 gainNode.gain.setValueAtTime(value, time); |
37 } | 35 } |
38 | 36 |
39 // Generate an exponential approach starting at |startTime| with a target value
of |value|. | 37 // Generate an exponential approach starting at |startTime| with a target value
of |value|. |
40 function automation(value, startTime, endTime) | 38 function automation(value, startTime, endTime) |
41 { | 39 { |
42 // endTime is not used for setTargetAtTime. | 40 // endTime is not used for setTargetAtTime. |
43 gainNode.gain.setTargetAtTime(value, startTime, timeConstant) | 41 gainNode.gain.setTargetAtTime(value, startTime, timeConstant) |
44 } | 42 } |
45 | 43 |
46 function runTest() | 44 audit.define("test", function (task, should) { |
47 { | 45 task.describe("AudioParam setTargetAtTime() functionality."); |
48 createAudioGraphAndTest(numberOfTests, | 46 createAudioGraphAndTest(task, should, numberOfTests, |
49 initialValue, | 47 initialValue, |
50 setValue, | 48 setValue, |
51 automation, | 49 automation, |
52 "setTargetAtTime()", | 50 "setTargetAtTime()", |
53 maxAllowedError, | 51 maxAllowedError, |
54 createExponentialApproachArray); | 52 createExponentialApproachArray); |
55 } | 53 }); |
56 | 54 |
57 runTest(); | 55 audit.run(); |
58 successfullyParsed = true; | |
59 | |
60 </script> | 56 </script> |
61 | 57 |
62 </body> | 58 </body> |
63 </html> | 59 </html> |
OLD | NEW |