OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 | 3 |
4 <head> | 4 <head> |
5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
6 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
7 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audio-testing.js"></script> |
8 </head> | 9 </head> |
9 | 10 |
10 <body> | 11 <body> |
11 <script> | 12 <script> |
12 description('AudioBufferSourceNode: DC-driven detune modulation.'); | |
13 window.jsTestIsAsync = true; | |
14 | 13 |
15 var sampleRate = 44100; | 14 var sampleRate = 44100; |
16 | 15 |
17 // To get an observable change on detune modulation, the minimum | 16 // To get an observable change on detune modulation, the minimum |
18 // rendering length should greater than the rendering quantum. | 17 // rendering length should greater than the rendering quantum. |
19 var renderLength = 256; | 18 var renderLength = 256; |
20 var half = renderLength / 2; | 19 var half = renderLength / 2; |
21 | 20 |
22 // With the detune of 0, the duration of impulse buffer should be 4 | 21 // With the detune of 0, the duration of impulse buffer should be 4 |
23 // samples (which means the interval between impulses is 4). Increasing | 22 // samples (which means the interval between impulses is 4). Increasing |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 nextImpulseIndex += (i < half) ? impulseLength : impulseLength / 2; | 76 nextImpulseIndex += (i < half) ? impulseLength : impulseLength / 2; |
78 } else if (data[i] !== 0) { | 77 } else if (data[i] !== 0) { |
79 // If a value is neither 0 or 1, break the loop and fail the test. | 78 // If a value is neither 0 or 1, break the loop and fail the test. |
80 passed = false; | 79 passed = false; |
81 break; | 80 break; |
82 } | 81 } |
83 | 82 |
84 i++; | 83 i++; |
85 } | 84 } |
86 | 85 |
87 if (passed) { | 86 Should('Increasing detune', passed) |
88 testPassed('Increasing detune to 1200 decreased the interval between i
mpulses to half.'); | 87 .summarize( |
89 } else { | 88 'to 1200 decreased the interval between impulses to half', |
90 testFailed('Increasing detune produced the incorrect result' + | 89 'produced the incorrect result' + 'at the index ' + i); |
91 'at the index ' + i + '.'); | |
92 } | |
93 }).then(done); | 90 }).then(done); |
94 }); | 91 }); |
95 | 92 |
96 audit.defineTask('finish', function (done) { | 93 audit.defineTask('finish', function (done) { |
97 finishJSTest(); | |
98 done(); | 94 done(); |
99 }); | 95 }); |
100 | 96 |
101 audit.runTasks( | 97 audit.runTasks( |
102 'build-buffers', | 98 'build-buffers', |
103 'synthesize-verify', | 99 'synthesize-verify', |
104 'finish' | 100 'finish' |
105 ); | 101 ); |
106 | 102 |
107 successfullyParsed = true; | 103 successfullyParsed = true; |
108 </script> | 104 </script> |
109 </body> | 105 </body> |
110 | 106 |
111 </html> | 107 </html> |
OLD | NEW |