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.linearRampToValueAtTime</title> | 9 <title>Test AudioParam.linearRampToValueAtTime</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 linearRampToValueAtTime() 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 // linearRampToValueAtTime() at regular intervals to set the starting and ending
values for a | 17 // linearRampToValueAtTime() at regular intervals to set the starting and ending
values for a |
20 // linear ramp. Each time interval has a ramp with a different starting and endi
ng value so | 18 // linear ramp. Each time interval has a ramp with a different starting and endi
ng value so |
21 // that there is a discontinuity at each time interval boundary. The discontinu
ity is for | 19 // that there is a discontinuity at each time interval boundary. The discontinu
ity is for |
22 // testing timing. Also, we alternate between an increasing and decreasing ramp
for each | 20 // testing timing. Also, we alternate between an increasing and decreasing ramp
for each |
23 // interval. | 21 // interval. |
24 | 22 |
25 // Number of tests to run. | 23 // Number of tests to run. |
26 var numberOfTests = 100; | 24 let numberOfTests = 100; |
27 | 25 |
28 // Max allowed difference between the rendered data and the expected result. | 26 // Max allowed difference between the rendered data and the expected result. |
29 var maxAllowedError = 1.865e-6; | 27 let maxAllowedError = 1.865e-6; |
30 | 28 |
31 // Set the gain node value to the specified value at the specified time. | 29 // Set the gain node value to the specified value at the specified time. |
32 function setValue(value, time) | 30 function setValue(value, time) |
33 { | 31 { |
34 gainNode.gain.setValueAtTime(value, time); | 32 gainNode.gain.setValueAtTime(value, time); |
35 } | 33 } |
36 | 34 |
37 // Generate a linear ramp ending at time |endTime| with an ending value of |valu
e|. | 35 // Generate a linear ramp ending at time |endTime| with an ending value of |valu
e|. |
38 function generateRamp(value, startTime, endTime) | 36 function generateRamp(value, startTime, endTime) |
39 { | 37 { |
40 // |startTime| is ignored because the linear ramp uses the value from the se
tValueAtTime() call above. | 38 // |startTime| is ignored because the linear ramp uses the value from the se
tValueAtTime() call above. |
41 gainNode.gain.linearRampToValueAtTime(value, endTime) | 39 gainNode.gain.linearRampToValueAtTime(value, endTime) |
42 } | 40 } |
43 | 41 |
44 function runTest() | 42 audit.define("test", function (task, should) { |
45 { | 43 task.describe("AudioParam linearRampToValueAtTime() functionality"); |
46 createAudioGraphAndTest(numberOfTests, | 44 createAudioGraphAndTest(task, should, numberOfTests, |
47 1, | 45 1, |
48 setValue, | 46 setValue, |
49 generateRamp, | 47 generateRamp, |
50 "linearRampToValueAtTime()", | 48 "linearRampToValueAtTime()", |
51 maxAllowedError, | 49 maxAllowedError, |
52 createLinearRampArray); | 50 createLinearRampArray); |
53 } | 51 }); |
54 | 52 |
55 runTest(); | 53 audit.run(); |
56 successfullyParsed = true; | |
57 | |
58 </script> | 54 </script> |
59 | 55 |
60 </body> | 56 </body> |
61 </html> | 57 </html> |
OLD | NEW |