OLD | NEW |
| (Empty) |
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
2 <html> | |
3 <head> | |
4 <script src="../resources/js-test.js"></script> | |
5 <script src="resources/compatibility.js"></script> | |
6 <script src="resources/audit-util.js"></script> | |
7 <script src="resources/audio-testing.js"></script> | |
8 <script src="resources/audioparam-testing.js"></script> | |
9 <title>Test AudioParam.setTargetAtTime</title> | |
10 </head> | |
11 | |
12 <body> | |
13 <div id="description"></div> | |
14 <div id="console"></div> | |
15 | |
16 <script> | |
17 description("Test AudioParam setTargetAtTime() functionality."); | |
18 | |
19 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
and | |
20 // setTargetAtTime at regular intervals to set the starting value and the target | |
21 // value. Each time interval has a ramp with a different starting and target val
ue so that | |
22 // there is a discontinuity at each time interval boundary. The discontinuity i
s for testing | |
23 // timing. Also, we alternate between an increasing and decreasing ramp for eac
h interval. | |
24 | |
25 // Number of tests to run. | |
26 var numberOfTests = 100; | |
27 | |
28 // Max allowed difference between the rendered data and the expected result. | |
29 var maxAllowedError = 1.6953e-6; | |
30 | |
31 // The AudioGainNode starts with this value instead of the default value. | |
32 var initialValue = 100; | |
33 | |
34 // Set the gain node value to the specified value at the specified time. | |
35 function setValue(value, time) | |
36 { | |
37 gainNode.gain.setValueAtTime(value, time); | |
38 } | |
39 | |
40 // Generate an exponential approach starting at |startTime| with a target value
of |value|. | |
41 function automation(value, startTime, endTime) | |
42 { | |
43 // endTime is not used for setTargetAtTime. | |
44 gainNode.gain.setTargetAtTime(value, startTime, timeConstant) | |
45 } | |
46 | |
47 function runTest() | |
48 { | |
49 createAudioGraphAndTest(numberOfTests, | |
50 initialValue, | |
51 setValue, | |
52 automation, | |
53 "setTargetAtTime()", | |
54 maxAllowedError, | |
55 createExponentialApproachArray); | |
56 } | |
57 | |
58 runTest(); | |
59 successfullyParsed = true; | |
60 | |
61 </script> | |
62 | |
63 </body> | |
64 </html> | |
OLD | NEW |