1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <script src="resources/audio-testing.js"></script>
5 <script src="resources/audioparam-testing.js"></script>
6 <script src="../fast/js/resources/js-test-pre.js"></script>
10 <div id="description"></div>
11 <div id="console"></div>
14 description("Test AudioParam setValueCurveAtTime() functionality.");
16 // Play a long DC signal out through an AudioGainNode and for each time interval call
17 // setValueCurveAtTime() to set the values for the duration of the interval. Each curve is a sine
18 // wave, and we assume that the time interval is not an exact multiple of the period. This causes a
19 // discontinuity between time intervals which is used to test timing.
21 // Number of tests to run.
22 var numberOfTests = 20;
24 // Max allowed difference between the rendered data and the expected result. (The error is zero
25 // because the rendered curve should really be exactly the same as the reference.)
26 var maxAllowedError = 0;
28 // The amplitude of the sine wave.
29 var sineAmplitude = 1;
31 // Frequency of the sine wave.
34 // Curve to use for setValueCurveAtTime().
37 // Sets the curve data for the entire time interval.
38 function automation(value, startTime, endTime)
40 gainNode.gain.setValueCurveAtTime(curve, startTime, endTime - startTime);
43 // Create a sine wave of the specified duration.
44 function createReferenceSineArray(startTime, endTime, startValue, endValue, sampleRate)
46 // Ignore |startValue| and |endValue| for the sine wave.
47 return createSineWaveArray(endTime - startTime, freqHz, sineAmplitude, sampleRate);
52 // The curve of values to use.
53 curve = createSineWaveArray(timeInterval, freqHz, sineAmplitude, sampleRate);
55 createAudioGraphAndTest(numberOfTests,
58 // Don't need to set the value.
61 "setValueCurveAtTime()",
63 createReferenceSineArray,
64 2 * Math.PI * sineAmplitude * freqHz / sampleRate);
68 successfullyParsed = true;
72 <script src="../fast/js/resources/js-test-post.js"></script>