| 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 playbackRate modulation.'); | |
| 13 window.jsTestIsAsync = true; | |
| 14 | 13 |
| 15 var sampleRate = 44100; | 14 var sampleRate = 44100; |
| 16 | 15 |
| 17 // To get an observable change on playbackRate modulation, the minimum | 16 // To get an observable change on playbackRate 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 playbackRate of 1, the duration of impulse buffer should be 4 | 21 // With the playbackRate of 1, the duration of impulse buffer should be 4 |
| 23 // samples (which means the interval between impulses is 4). Doubling | 22 // samples (which means the interval between impulses is 4). Doubling |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 nextImpulseIndex += (i < half) ? impulseLength : impulseLength / 2; | 77 nextImpulseIndex += (i < half) ? impulseLength : impulseLength / 2; |
| 79 } else if (data[i] !== 0) { | 78 } else if (data[i] !== 0) { |
| 80 // If a value is neither 0 or 1, break the loop and fail the test. | 79 // If a value is neither 0 or 1, break the loop and fail the test. |
| 81 passed = false; | 80 passed = false; |
| 82 break; | 81 break; |
| 83 } | 82 } |
| 84 | 83 |
| 85 i++; | 84 i++; |
| 86 } | 85 } |
| 87 | 86 |
| 88 if (passed) { | 87 Should('Doubling playbackRate', passed) |
| 89 testPassed('Doubling playbackRate decreased the interval between impul
ses to half.'); | 88 .summarize( |
| 90 } else { | 89 'decreased the interval between impulses to half', |
| 91 testFailed('Doubling playbackRate produced the incorrect result' + | 90 'produced the incorrect result' + 'at the index ' + i) |
| 92 'at the index ' + i + '.'); | |
| 93 } | |
| 94 }).then(done); | 91 }).then(done); |
| 95 }); | 92 }); |
| 96 | 93 |
| 97 audit.defineTask('finish', function (done) { | 94 audit.defineTask('finish', function (done) { |
| 98 finishJSTest(); | |
| 99 done(); | 95 done(); |
| 100 }); | 96 }); |
| 101 | 97 |
| 102 audit.runTasks( | 98 audit.runTasks( |
| 103 'build-buffers', | 99 'build-buffers', |
| 104 'synthesize-verify', | 100 'synthesize-verify', |
| 105 'finish' | 101 'finish' |
| 106 ); | 102 ); |
| 107 | 103 |
| 108 successfullyParsed = true; | 104 successfullyParsed = true; |
| 109 </script> | 105 </script> |
| 110 </body> | 106 </body> |
| 111 | 107 |
| 112 </html> | 108 </html> |
| OLD | NEW |