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