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.setValueCurveAtTime</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 setValueCurveAtTime() functionality."); | 16 description("Test AudioParam setValueCurveAtTime() functionality."); |
16 | 17 |
17 // Play a long DC signal out through an AudioGainNode and for each time interval
call | 18 // Play a long DC signal out through an AudioGainNode and for each time interval
call |
(...skipping 17 matching lines...) Expand all Loading... |
35 | 36 |
36 // Curve to use for setValueCurveAtTime(). | 37 // Curve to use for setValueCurveAtTime(). |
37 var curve; | 38 var curve; |
38 | 39 |
39 // Sets the curve data for the entire time interval. | 40 // Sets the curve data for the entire time interval. |
40 function automation(value, startTime, endTime) | 41 function automation(value, startTime, endTime) |
41 { | 42 { |
42 gainNode.gain.setValueCurveAtTime(curve, startTime, endTime - startTime); | 43 gainNode.gain.setValueCurveAtTime(curve, startTime, endTime - startTime); |
43 } | 44 } |
44 | 45 |
45 // Create a sine wave of the specified duration. | |
46 function createReferenceSineArray(startTime, endTime, startValue, endValue, samp
leRate) | |
47 { | |
48 // Ignore |startValue| and |endValue| for the sine wave. | |
49 return createSineWaveArray(endTime - startTime, freqHz, sineAmplitude, sampl
eRate); | |
50 } | |
51 | |
52 function runTest() | 46 function runTest() |
53 { | 47 { |
54 // The curve of values to use. | 48 // The curve of values to use. |
55 curve = createSineWaveArray(timeInterval, freqHz, sineAmplitude, sampleRate)
; | 49 curve = createSineWaveArray(timeInterval, freqHz, sineAmplitude, sampleRate)
; |
56 | 50 |
57 createAudioGraphAndTest(numberOfTests, | 51 createAudioGraphAndTest(numberOfTests, |
58 sineAmplitude, | 52 sineAmplitude, |
59 function(k) { | 53 function(k) { |
60 // Don't need to set the value. | 54 // Don't need to set the value. |
61 }, | 55 }, |
62 automation, | 56 automation, |
63 "setValueCurveAtTime()", | 57 "setValueCurveAtTime()", |
64 maxAllowedError, | 58 maxAllowedError, |
65 createReferenceSineArray, | 59 createReferenceSineArray, |
66 2 * Math.PI * sineAmplitude * freqHz / sampleRate); | 60 2 * Math.PI * sineAmplitude * freqHz / sampleRate, |
| 61 differenceErrorMetric); |
67 } | 62 } |
68 | 63 |
69 runTest(); | 64 runTest(); |
70 successfullyParsed = true; | 65 successfullyParsed = true; |
71 | 66 |
72 </script> | 67 </script> |
73 | 68 |
74 </body> | 69 </body> |
75 </html> | 70 </html> |
OLD | NEW |