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 </head> | 9 </head> |
9 | 10 |
10 <body> | 11 <body> |
11 <div id="description"></div> | |
12 <div id="console"></div> | |
13 | |
14 <script> | 12 <script> |
15 description("Test AudioParam setValueAtTime() functionality."); | 13 let audit = Audit.createTaskRunner(); |
16 | 14 |
17 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
at regular | 15 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
at regular |
18 // intervals to set the value for the duration of the interval. Each time inter
val has | 16 // intervals to set the value for the duration of the interval. Each time inter
val has |
19 // different value so that there is a discontinuity at each time interval bounda
ry. The | 17 // different value so that there is a discontinuity at each time interval bounda
ry. The |
20 // discontinuity is for testing timing. | 18 // discontinuity is for testing timing. |
21 | 19 |
22 // Number of tests to run. | 20 // Number of tests to run. |
23 var numberOfTests = 100; | 21 let numberOfTests = 100; |
24 | 22 |
25 // Max allowed difference between the rendered data and the expected result. | 23 // Max allowed difference between the rendered data and the expected result. |
26 var maxAllowedError = 6e-8; | 24 let maxAllowedError = 6e-8; |
27 | 25 |
28 // Set the gain node value to the specified value at the specified time. | 26 // Set the gain node value to the specified value at the specified time. |
29 function setValue(value, time) | 27 function setValue(value, time) |
30 { | 28 { |
31 gainNode.gain.setValueAtTime(value, time); | 29 gainNode.gain.setValueAtTime(value, time); |
32 } | 30 } |
33 | 31 |
34 // For testing setValueAtTime(), we don't need to do anything for automation. be
cause the value at | 32 // For testing setValueAtTime(), we don't need to do anything for automation. be
cause the value at |
35 // the beginning of the interval is set by setValue and it remains constant for
the duration, which | 33 // the beginning of the interval is set by setValue and it remains constant for
the duration, which |
36 // is what we want. | 34 // is what we want. |
37 function automation(value, startTime, endTime) | 35 function automation(value, startTime, endTime) |
38 { | 36 { |
39 // Do nothing. | 37 // Do nothing. |
40 } | 38 } |
41 | 39 |
42 function runTest() | 40 audit.define("test", function (task, should) { |
43 { | 41 task.describe("AudioParam setValueAtTime() functionality."); |
44 createAudioGraphAndTest(numberOfTests, | 42 createAudioGraphAndTest(task, should, numberOfTests, |
45 1, | 43 1, |
46 setValue, | 44 setValue, |
47 automation, | 45 automation, |
48 "setValueAtTime()", | 46 "setValueAtTime()", |
49 maxAllowedError, | 47 maxAllowedError, |
50 createConstantArray); | 48 createConstantArray); |
51 } | 49 }); |
52 | 50 |
53 runTest(); | 51 audit.run(); |
54 successfullyParsed = true; | |
55 | |
56 </script> | 52 </script> |
57 | 53 |
58 </body> | 54 </body> |
59 </html> | 55 </html> |
OLD | NEW |