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.linearRampToValueAtTime |
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.linearRampToValueAtTime</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 linearRampToValueAtTime() at regular intervals to |
14 let audit = Audit.createTaskRunner(); | 19 // set the starting and ending values for a linear ramp. Each time |
| 20 // interval has a ramp with a different starting and ending value so that |
| 21 // there is a discontinuity at each time interval boundary. The |
| 22 // discontinuity is for testing timing. Also, we alternate between an |
| 23 // increasing and decreasing ramp 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 linearRampToValueAtTime() at regular intervals to set the starting and | 26 let numberOfTests = 100; |
18 // ending values for a linear ramp. Each time interval has a ramp with a | |
19 // different starting and ending value so that there is a discontinuity at each | |
20 // time interval boundary. The discontinuity is for testing timing. Also, we | |
21 // alternate between an 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 let numberOfTests = 100; | 29 // result. |
| 30 let maxAllowedError = 1.865e-6; |
25 | 31 |
26 // Max allowed difference between the rendered data and the expected result. | 32 // Set the gain node value to the specified value at the specified time. |
27 let maxAllowedError = 1.865e-6; | 33 function setValue(value, time) { |
| 34 gainNode.gain.setValueAtTime(value, time); |
| 35 } |
28 | 36 |
29 // Set the gain node value to the specified value at the specified time. | 37 // Generate a linear ramp ending at time |endTime| with an ending value of |
30 function setValue(value, time) { | 38 // |value|. |
31 gainNode.gain.setValueAtTime(value, time); | 39 function generateRamp(value, startTime, endTime){ |
32 } | 40 // |startTime| is ignored because the linear ramp uses the value from |
| 41 // the |
| 42 // setValueAtTime() call above. |
| 43 gainNode.gain.linearRampToValueAtTime(value, endTime)} |
33 | 44 |
34 // Generate a linear ramp ending at time |endTime| with an ending value of | 45 audit.define( |
35 // |value|. | 46 { |
36 function generateRamp(value, startTime, endTime){ | 47 label: 'test', |
37 // |startTime| is ignored because the linear ramp uses the value from the | 48 description: 'AudioParam linearRampToValueAtTime() functionality' |
38 // setValueAtTime() call above. | 49 }, |
39 gainNode.gain.linearRampToValueAtTime(value, endTime)} | 50 function(task, should) { |
| 51 createAudioGraphAndTest( |
| 52 task, should, numberOfTests, 1, setValue, generateRamp, |
| 53 'linearRampToValueAtTime()', maxAllowedError, |
| 54 createLinearRampArray); |
| 55 }); |
40 | 56 |
41 audit.define({ | 57 audit.run(); |
42 label: 'test', | 58 </script> |
43 description: 'AudioParam linearRampToValueAtTime() functionality' | 59 </body> |
44 }, function(task, should) { | |
45 createAudioGraphAndTest( | |
46 task, should, numberOfTests, 1, setValue, generateRamp, | |
47 'linearRampToValueAtTime()', maxAllowedError, createLinearRampArray); | |
48 }); | |
49 | |
50 audit.run(); | |
51 </script> | |
52 | |
53 </body> | |
54 </html> | 60 </html> |
OLD | NEW |