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