| 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.linearRampToValueAtTime</title> | |
| 10 </head> | |
| 11 | |
| 12 <body> | |
| 13 <div id="description"></div> | |
| 14 <div id="console"></div> | |
| 15 | |
| 16 <script> | |
| 17 description("Test AudioParam linearRampToValueAtTime() functionality."); | |
| 18 | |
| 19 // Play a long DC signal out through an AudioGainNode, and call setValueAtTime()
and | |
| 20 // linearRampToValueAtTime() at regular intervals to set the starting and ending
values for a | |
| 21 // linear ramp. Each time interval has a ramp with a different starting and endi
ng value so | |
| 22 // that there is a discontinuity at each time interval boundary. The discontinu
ity is for | |
| 23 // testing timing. Also, we alternate between an increasing and decreasing ramp
for each | |
| 24 // interval. | |
| 25 | |
| 26 // Number of tests to run. | |
| 27 var numberOfTests = 100; | |
| 28 | |
| 29 // Max allowed difference between the rendered data and the expected result. | |
| 30 var maxAllowedError = 1.865e-6; | |
| 31 | |
| 32 // Set the gain node value to the specified value at the specified time. | |
| 33 function setValue(value, time) | |
| 34 { | |
| 35 gainNode.gain.setValueAtTime(value, time); | |
| 36 } | |
| 37 | |
| 38 // Generate a linear ramp ending at time |endTime| with an ending value of |valu
e|. | |
| 39 function generateRamp(value, startTime, endTime) | |
| 40 { | |
| 41 // |startTime| is ignored because the linear ramp uses the value from the se
tValueAtTime() call above. | |
| 42 gainNode.gain.linearRampToValueAtTime(value, endTime) | |
| 43 } | |
| 44 | |
| 45 function runTest() | |
| 46 { | |
| 47 createAudioGraphAndTest(numberOfTests, | |
| 48 1, | |
| 49 setValue, | |
| 50 generateRamp, | |
| 51 "linearRampToValueAtTime()", | |
| 52 maxAllowedError, | |
| 53 createLinearRampArray); | |
| 54 } | |
| 55 | |
| 56 runTest(); | |
| 57 successfullyParsed = true; | |
| 58 | |
| 59 </script> | |
| 60 | |
| 61 </body> | |
| 62 </html> | |
| OLD | NEW |