| 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.exponentialRampToValueAtTime</title> | |
| 10 </head> | |
| 11 | |
| 12 <body> | |
| 13 <div id="description"></div> | |
| 14 <div id="console"></div> | |
| 15 | |
| 16 <script> | |
| 17 description("Test AudioParam exponentialRampToValueAtTime() functionality.
"); | |
| 18 | |
| 19 // Play a long DC signal out through an AudioGainNode, and call setValueAt
Time() and | |
| 20 // exponentialRampToValueAtTime() at regular intervals to set the starting
and ending values | |
| 21 // for an exponential ramp. Each time interval has a ramp with a differen
t starting and | |
| 22 // ending value so that there is a discontinuity at each time interval bou
ndary. The | |
| 23 // discontinuity is for testing timing. Also, we alternate between an inc
reasing and | |
| 24 // decreasing ramp for each interval. | |
| 25 | |
| 26 // Number of tests to run. | |
| 27 var numberOfTests = 100; | |
| 28 | |
| 29 // Max allowed difference between the rendered data and the expected resul
t. | |
| 30 var maxAllowedError = 1.222e-5; | |
| 31 | |
| 32 // The AudioGainNode starts with this value instead of the default value. | |
| 33 var initialValue = 100; | |
| 34 | |
| 35 // Set the gain node value to the specified value at the specified time. | |
| 36 function setValue(value, time) | |
| 37 { | |
| 38 gainNode.gain.setValueAtTime(value, time); | |
| 39 } | |
| 40 | |
| 41 // Generate an exponential ramp ending at time |endTime| with an ending va
lue of |value|. | |
| 42 function generateRamp(value, startTime, endTime) | |
| 43 { | |
| 44 // |startTime| is ignored because the exponential ramp | |
| 45 // uses the value from the setValueAtTime() call above. | |
| 46 gainNode.gain.exponentialRampToValueAtTime(value, endTime) | |
| 47 } | |
| 48 | |
| 49 function runTest() | |
| 50 { | |
| 51 createAudioGraphAndTest(numberOfTests, | |
| 52 initialValue, | |
| 53 setValue, | |
| 54 generateRamp, | |
| 55 "exponentialRampToValueAtTime()", | |
| 56 maxAllowedError, | |
| 57 createExponentialRampArray); | |
| 58 | |
| 59 } | |
| 60 | |
| 61 runTest(); | |
| 62 successfullyParsed = true; | |
| 63 | |
| 64 </script> | |
| 65 | |
| 66 </body> | |
| 67 </html> | |
| OLD | NEW |