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 <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 setValueAtTime() |
16 description("Test AudioParam linearRampToValueAtTime() functionality."); | 17 // and linearRampToValueAtTime() at regular intervals to set the starting and |
17 | 18 // ending values for a linear ramp. Each time interval has a ramp with a |
18 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
and | 19 // different starting and ending value so that there is a discontinuity at each |
19 // linearRampToValueAtTime() at regular intervals to set the starting and ending
values for a | 20 // time interval boundary. The discontinuity is for testing timing. Also, we |
20 // linear ramp. Each time interval has a ramp with a different starting and endi
ng value so | 21 // alternate between an increasing and decreasing ramp for each interval. |
21 // 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 | |
23 // 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 gainNode.gain.setValueAtTime(value, time); |
34 gainNode.gain.setValueAtTime(value, time); | |
35 } | 32 } |
36 | 33 |
37 // Generate a linear ramp ending at time |endTime| with an ending value of |valu
e|. | 34 // Generate a linear ramp ending at time |endTime| with an ending value of |
38 function generateRamp(value, startTime, endTime) | 35 // |value|. |
39 { | 36 function generateRamp(value, startTime, endTime){ |
40 // |startTime| is ignored because the linear ramp uses the value from the se
tValueAtTime() call above. | 37 // |startTime| is ignored because the linear ramp uses the value from the |
41 gainNode.gain.linearRampToValueAtTime(value, endTime) | 38 // setValueAtTime() call above. |
42 } | 39 gainNode.gain.linearRampToValueAtTime(value, endTime)} |
43 | 40 |
44 function runTest() | 41 audit.define('test', function(task, should) { |
45 { | 42 task.describe('AudioParam linearRampToValueAtTime() functionality'); |
46 createAudioGraphAndTest(numberOfTests, | 43 createAudioGraphAndTest( |
47 1, | 44 task, should, numberOfTests, 1, setValue, generateRamp, |
48 setValue, | 45 'linearRampToValueAtTime()', maxAllowedError, createLinearRampArray); |
49 generateRamp, | 46 }); |
50 "linearRampToValueAtTime()", | |
51 maxAllowedError, | |
52 createLinearRampArray); | |
53 } | |
54 | 47 |
55 runTest(); | 48 audit.run(); |
56 successfullyParsed = true; | |
57 | |
58 </script> | 49 </script> |
59 | 50 |
60 </body> | 51 </body> |
61 </html> | 52 </html> |
OLD | NEW |