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