Initialize Tizen 2.3
[framework/web/webkit-efl.git] / LayoutTests / webaudio / audioparam-setTargetAtTime.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 setTargetAtTime() functionality.");
15
16 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime() and
17 // setTargetAtTime at regular intervals to set the starting value and the target
18 // value. Each time interval has a ramp with a different starting and target value so that
19 // there is a discontinuity at each time interval boundary.  The discontinuity is for testing
20 // timing.  Also, we alternate between an increasing and decreasing ramp for each interval.
21
22 // Number of tests to run.
23 var numberOfTests = 100;
24
25 // Max allowed difference between the rendered data and the expected result.
26 var maxAllowedError = 2.79e-5;
27
28 // The AudioGainNode starts with this value instead of the default value.
29 var initialValue = 100;
30
31 // Set the gain node value to the specified value at the specified time.
32 function setValue(value, time)
33 {
34     gainNode.gain.setValueAtTime(value, time);
35 }
36
37 // Generate an exponential approach starting at |startTime| with a target value of |value|.
38 function automation(value, startTime, endTime)
39 {
40     // endTime is not used for setTargetAtTime.
41     gainNode.gain.setTargetAtTime(value, startTime, timeConstant)
42 }
43
44 function runTest()
45 {
46     createAudioGraphAndTest(numberOfTests,
47                             initialValue,
48                             setValue,
49                             automation,
50                             "setTargetAtTime()",
51                             maxAllowedError,
52                             createExponentialApproachArray);
53 }
54
55 runTest();
56 successfullyParsed = true;
57
58 </script>
59
60 <script src="../fast/js/resources/js-test-post.js"></script>
61 </body>
62 </html>