Update selection handle position in Ref-Internet browser
[framework/web/webkit-efl.git] / LayoutTests / webaudio / audioparam-setValueCurveAtTime.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
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>
7 </head>
8
9 <body>
10 <div id="description"></div>
11 <div id="console"></div>
12
13 <script>
14 description("Test AudioParam setValueCurveAtTime() functionality.");
15
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.
20
21 // Number of tests to run.
22 var numberOfTests = 20;
23
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;
27
28 // The amplitude of the sine wave.
29 var sineAmplitude = 1;
30
31 // Frequency of the sine wave.
32 var freqHz = 440;
33
34 // Curve to use for setValueCurveAtTime().
35 var curve;
36
37 // Sets the curve data for the entire time interval.
38 function automation(value, startTime, endTime)
39 {
40     gainNode.gain.setValueCurveAtTime(curve, startTime, endTime - startTime);
41 }
42
43 // Create a sine wave of the specified duration.
44 function createReferenceSineArray(startTime, endTime, startValue, endValue, sampleRate)
45 {
46     // Ignore |startValue| and |endValue| for the sine wave.
47     return createSineWaveArray(endTime - startTime, freqHz, sineAmplitude, sampleRate);
48 }
49
50 function runTest() 
51 {
52     // The curve of values to use.
53     curve = createSineWaveArray(timeInterval, freqHz, sineAmplitude, sampleRate);
54
55     createAudioGraphAndTest(numberOfTests,
56                             sineAmplitude,
57                             function(k) {
58                                 // Don't need to set the value.
59                             },
60                             automation,
61                             "setValueCurveAtTime()",
62                             maxAllowedError,
63                             createReferenceSineArray,
64                             2 * Math.PI * sineAmplitude * freqHz / sampleRate);
65 }
66
67 runTest();
68 successfullyParsed = true;
69
70 </script>
71
72 <script src="../fast/js/resources/js-test-post.js"></script>
73 </body>
74 </html>