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/compatibility.js"></script> | 4 <script src="resources/compatibility.js"></script> |
5 <script src="resources/audio-testing.js"></script> | 5 <script src="resources/audio-testing.js"></script> |
6 <script src="resources/audioparam-testing.js"></script> | 6 <script src="resources/audioparam-testing.js"></script> |
7 <script src="../resources/js-test.js"></script> | 7 <script src="../resources/js-test.js"></script> |
| 8 <title>Test AudioParam.linearRampToValueAtTime</title> |
8 </head> | 9 </head> |
9 | 10 |
10 <body> | 11 <body> |
11 <div id="description"></div> | 12 <div id="description"></div> |
12 <div id="console"></div> | 13 <div id="console"></div> |
13 | 14 |
14 <script> | 15 <script> |
15 description("Test AudioParam linearRampToValueAtTime() functionality."); | 16 description("Test AudioParam linearRampToValueAtTime() functionality."); |
16 | 17 |
17 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
and | 18 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
and |
18 // linearRampToValueAtTime() at regular intervals to set the starting and ending
values for a | 19 // linearRampToValueAtTime() at regular intervals to set the starting and ending
values for a |
19 // linear ramp. Each time interval has a ramp with a different starting and endi
ng value so | 20 // linear ramp. Each time interval has a ramp with a different starting and endi
ng value so |
20 // that there is a discontinuity at each time interval boundary. The discontinu
ity is for | 21 // that there is a discontinuity at each time interval boundary. The discontinu
ity is for |
21 // testing timing. Also, we alternate between an increasing and decreasing ramp
for each | 22 // testing timing. Also, we alternate between an increasing and decreasing ramp
for each |
22 // interval. | 23 // interval. |
23 | 24 |
24 // Number of tests to run. | 25 // Number of tests to run. |
25 var numberOfTests = 100; | 26 var numberOfTests = 100; |
26 | 27 |
27 // Max allowed difference between the rendered data and the expected result. | 28 // Max allowed difference between the rendered data and the expected result. |
28 var maxAllowedError = 7.51e-7; | 29 var maxAllowedError = 1.865e-6; |
29 | 30 |
30 // Set the gain node value to the specified value at the specified time. | 31 // Set the gain node value to the specified value at the specified time. |
31 function setValue(value, time) | 32 function setValue(value, time) |
32 { | 33 { |
33 gainNode.gain.setValueAtTime(value, time); | 34 gainNode.gain.setValueAtTime(value, time); |
34 } | 35 } |
35 | 36 |
36 // Generate a linear ramp ending at time |endTime| with an ending value of |valu
e|. | 37 // Generate a linear ramp ending at time |endTime| with an ending value of |valu
e|. |
37 function generateRamp(value, startTime, endTime) | 38 function generateRamp(value, startTime, endTime) |
38 { | 39 { |
(...skipping 12 matching lines...) Expand all Loading... |
51 createLinearRampArray); | 52 createLinearRampArray); |
52 } | 53 } |
53 | 54 |
54 runTest(); | 55 runTest(); |
55 successfullyParsed = true; | 56 successfullyParsed = true; |
56 | 57 |
57 </script> | 58 </script> |
58 | 59 |
59 </body> | 60 </body> |
60 </html> | 61 </html> |
OLD | NEW |