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.exponentialRampToValueAtTime</title> | 9 <title>Test AudioParam.exponentialRampToValueAtTime</title> |
9 </head> | 10 </head> |
10 | 11 |
11 <body> | 12 <body> |
12 <div id="description"></div> | 13 <script> |
13 <div id="console"></div> | 14 let audit = Audit.createTaskRunner(); |
14 | 15 |
15 <script> | 16 // Play a long DC signal out through an AudioGainNode, and call |
16 description("Test AudioParam exponentialRampToValueAtTime() functionality.
"); | 17 // setValueAtTime() and exponentialRampToValueAtTime() at regular |
17 | 18 // intervals to set the starting and ending values for an exponential |
18 // Play a long DC signal out through an AudioGainNode, and call setValueAt
Time() and | 19 // ramp. Each time interval has a ramp with a different starting and |
19 // exponentialRampToValueAtTime() at regular intervals to set the starting
and ending values | 20 // ending value so that there is a discontinuity at each time interval |
20 // for an exponential ramp. Each time interval has a ramp with a differen
t starting and | 21 // boundary. The discontinuity is for testing timing. Also, we alternate |
21 // ending value so that there is a discontinuity at each time interval bou
ndary. The | 22 // between an increasing and decreasing ramp for each interval. |
22 // discontinuity is for testing timing. Also, we alternate between an inc
reasing and | |
23 // decreasing ramp for each interval. | |
24 | 23 |
25 // Number of tests to run. | 24 // Number of tests to run. |
26 var numberOfTests = 100; | 25 let numberOfTests = 100; |
27 | 26 |
28 // Max allowed difference between the rendered data and the expected resul
t. | 27 // Max allowed difference between the rendered data and the expected |
29 var maxAllowedError = 1.222e-5; | 28 // result. |
| 29 let maxAllowedError = 1.222e-5; |
30 | 30 |
31 // The AudioGainNode starts with this value instead of the default value. | 31 // The AudioGainNode starts with this value instead of the default value. |
32 var initialValue = 100; | 32 let initialValue = 100; |
33 | 33 |
34 // Set the gain node value to the specified value at the specified time. | 34 // Set the gain node value to the specified value at the specified time. |
35 function setValue(value, time) | 35 function setValue(value, time) { |
36 { | 36 gainNode.gain.setValueAtTime(value, time); |
37 gainNode.gain.setValueAtTime(value, time); | |
38 } | 37 } |
39 | 38 |
40 // Generate an exponential ramp ending at time |endTime| with an ending va
lue of |value|. | 39 // Generate an exponential ramp ending at time |endTime| with an ending |
41 function generateRamp(value, startTime, endTime) | 40 // value of |value|. |
42 { | 41 function generateRamp(value, startTime, endTime){ |
43 // |startTime| is ignored because the exponential ramp | 42 // |startTime| is ignored because the exponential ramp |
44 // uses the value from the setValueAtTime() call above. | 43 // uses the value from the setValueAtTime() call above. |
45 gainNode.gain.exponentialRampToValueAtTime(value, endTime) | 44 gainNode.gain.exponentialRampToValueAtTime(value, endTime)} |
46 } | |
47 | |
48 function runTest() | |
49 { | |
50 createAudioGraphAndTest(numberOfTests, | |
51 initialValue, | |
52 setValue, | |
53 generateRamp, | |
54 "exponentialRampToValueAtTime()", | |
55 maxAllowedError, | |
56 createExponentialRampArray); | |
57 | 45 |
58 } | 46 audit.define('test', function(task, should) { |
| 47 task.describe( |
| 48 'AudioParam exponentialRampToValueAtTime() functionality'); |
| 49 createAudioGraphAndTest( |
| 50 task, should, numberOfTests, initialValue, setValue, generateRamp, |
| 51 'exponentialRampToValueAtTime()', maxAllowedError, |
| 52 createExponentialRampArray); |
| 53 }); |
59 | 54 |
60 runTest(); | 55 audit.run(); |
61 successfullyParsed = true; | |
62 | |
63 </script> | 56 </script> |
64 | 57 |
65 </body> | 58 </body> |
66 </html> | 59 </html> |
OLD | NEW |