1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
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>
11 <div id=
"description"></div>
12 <div id=
"console"></div>
15 description("Test AudioParam linearRampToValueAtTime() functionality.");
17 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime() and
18 // linearRampToValueAtTime() at regular intervals to set the starting and ending values for a
19 // linear ramp. Each time interval has a ramp with a different starting and ending value so
20 // that there is a discontinuity at each time interval boundary. The discontinuity is for
21 // testing timing. Also, we alternate between an increasing and decreasing ramp for each
24 // Number of tests to run.
25 var numberOfTests
= 100;
27 // Max allowed difference between the rendered data and the expected result.
28 var maxAllowedError
= 7.51e-7;
30 // Set the gain node value to the specified value at the specified time.
31 function setValue(value
, time
)
33 gainNode
.gain
.setValueAtTime(value
, time
);
36 // Generate a linear ramp ending at time |endTime| with an ending value of |value|.
37 function generateRamp(value
, startTime
, endTime
)
39 // |startTime| is ignored because the linear ramp uses the value from the setValueAtTime() call above.
40 gainNode
.gain
.linearRampToValueAtTime(value
, endTime
)
45 createAudioGraphAndTest(numberOfTests
,
49 "linearRampToValueAtTime()",
51 createLinearRampArray
);
55 successfullyParsed
= true;