Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audioparam-setValueCurveAtTime.html
blobfa8f9213111fadb5ceaaf44da554478abd053743
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <script src="resources/compatibility.js"></script>
5 <script src="resources/audio-testing.js"></script>
6 <script src="resources/audioparam-testing.js"></script>
7 <script src="../resources/js-test.js"></script>
8 </head>
10 <body>
11 <div id="description"></div>
12 <div id="console"></div>
14 <script>
15 description("Test AudioParam setValueCurveAtTime() functionality.");
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. Each curve is a sine
19 // wave, and we assume that the time interval is not an exact multiple of the period. This causes a
20 // discontinuity between time intervals which is used to test timing.
22 // Number of tests to run.
23 var numberOfTests = 20;
25 // Max allowed difference between the rendered data and the expected result. Because of the linear
26 // interpolation, the rendered curve isn't exactly the same as the reference. This value is
27 // experimentally determined.
28 var maxAllowedError = 4.657e-10;
30 // The amplitude of the sine wave.
31 var sineAmplitude = 1;
33 // Frequency of the sine wave.
34 var freqHz = 440;
36 // Curve to use for setValueCurveAtTime().
37 var curve;
39 // Sets the curve data for the entire time interval.
40 function automation(value, startTime, endTime)
42 gainNode.gain.setValueCurveAtTime(curve, startTime, endTime - startTime);
45 // Create a sine wave of the specified duration.
46 function createReferenceSineArray(startTime, endTime, startValue, endValue, sampleRate)
48 // Ignore |startValue| and |endValue| for the sine wave.
49 return createSineWaveArray(endTime - startTime, freqHz, sineAmplitude, sampleRate);
52 function runTest()
54 // The curve of values to use.
55 curve = createSineWaveArray(timeInterval, freqHz, sineAmplitude, sampleRate);
57 createAudioGraphAndTest(numberOfTests,
58 sineAmplitude,
59 function(k) {
60 // Don't need to set the value.
62 automation,
63 "setValueCurveAtTime()",
64 maxAllowedError,
65 createReferenceSineArray,
66 2 * Math.PI * sineAmplitude * freqHz / sampleRate);
69 runTest();
70 successfullyParsed = true;
72 </script>
74 </body>
75 </html>