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 </head> | 8 </head> |
9 | 9 |
10 <body> | 10 <body> |
11 <div id="description"></div> | 11 <div id="description"></div> |
12 <div id="console"></div> | 12 <div id="console"></div> |
13 | 13 |
14 <script> | 14 <script> |
15 description("Test AudioParam setValueCurveAtTime() functionality."); | 15 description("Test AudioParam setValueCurveAtTime() functionality."); |
16 | 16 |
17 // Play a long DC signal out through an AudioGainNode and for each time interval
call | 17 // Play a long DC signal out through an AudioGainNode and for each time interval
call |
18 // setValueCurveAtTime() to set the values for the duration of the interval. Ea
ch curve is a sine | 18 // setValueCurveAtTime() to set the values for the duration of the interval. Ea
ch curve is a sine |
19 // wave, and we assume that the time interval is not an exact multiple of the pe
riod. This causes a | 19 // wave, and we assume that the time interval is not an exact multiple of the pe
riod. This causes a |
20 // discontinuity between time intervals which is used to test timing. | 20 // discontinuity between time intervals which is used to test timing. |
21 | 21 |
22 // Number of tests to run. | 22 // Number of tests to run. |
23 var numberOfTests = 20; | 23 var numberOfTests = 20; |
24 | 24 |
25 // Max allowed difference between the rendered data and the expected result. (T
he error is zero | 25 // Max allowed difference between the rendered data and the expected result. Be
cause of the linear |
26 // because the rendered curve should really be exactly the same as the reference
.) | 26 // interpolation, the rendered curve isn't exactly the same as the reference. T
his value is |
27 var maxAllowedError = 0; | 27 // experimentally determined. |
| 28 var maxAllowedError = 4.657e-10; |
28 | 29 |
29 // The amplitude of the sine wave. | 30 // The amplitude of the sine wave. |
30 var sineAmplitude = 1; | 31 var sineAmplitude = 1; |
31 | 32 |
32 // Frequency of the sine wave. | 33 // Frequency of the sine wave. |
33 var freqHz = 440; | 34 var freqHz = 440; |
34 | 35 |
35 // Curve to use for setValueCurveAtTime(). | 36 // Curve to use for setValueCurveAtTime(). |
36 var curve; | 37 var curve; |
37 | 38 |
(...skipping 27 matching lines...) Expand all Loading... |
65 2 * Math.PI * sineAmplitude * freqHz / sampleRate); | 66 2 * Math.PI * sineAmplitude * freqHz / sampleRate); |
66 } | 67 } |
67 | 68 |
68 runTest(); | 69 runTest(); |
69 successfullyParsed = true; | 70 successfullyParsed = true; |
70 | 71 |
71 </script> | 72 </script> |
72 | 73 |
73 </body> | 74 </body> |
74 </html> | 75 </html> |
OLD | NEW |