Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <!-- | 3 <!-- |
| 4 See if we can load an AudioBuffer, create an AudioBufferSourceNode, attach the b uffer to it, then play it. | 4 See if we can load an AudioBuffer, create an AudioBufferSourceNode, attach the b uffer to it, then play it. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <html> | 7 <html> |
| 8 <head> | 8 <head> |
| 9 <script src="../../resources/js-test.js"></script> | 9 <script src="../../resources/testharness.js"></script> |
| 10 <script src="../../resources/testharnessreport.js"></script> | |
| 10 <script src="../resources/audit-util.js"></script> | 11 <script src="../resources/audit-util.js"></script> |
| 11 <script src="../resources/audio-testing.js"></script> | 12 <script src="../resources/audit.js"></script> |
| 12 <script type="text/javascript" src="../resources/buffer-loader.js"></script> | 13 <script src="../resources/buffer-loader.js"></script> |
| 13 | 14 |
| 14 <script> | 15 <script> |
| 16 let audit = Audit.createTaskRunner(); | |
| 15 | 17 |
| 16 window.onload = init; | 18 let sampleRate = 44100.0; |
| 19 let lengthInSeconds = 2; | |
| 17 | 20 |
| 18 var sampleRate = 44100.0; | 21 let context = 0; |
| 19 var lengthInSeconds = 2; | 22 let bufferLoader = 0; |
| 20 | 23 |
| 21 var context = 0; | 24 // Note: The text output from this test is ignored. The test will generate |
| 22 var bufferLoader = 0; | 25 // output WAV file that is compared to the expected file and these two should |
| 26 // match exactly. | |
| 27 audit.define('test', (task, should) => { | |
| 28 // This test requires testRunner to exist | |
| 29 should(window.testRunner, 'window.testRunner').notBeEqualTo(undefined); | |
| 23 | 30 |
| 24 function init() { | 31 // Create offline audio context. |
| 25 if (!window.testRunner) | 32 context = |
| 26 return; | 33 new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate); |
| 27 | |
| 28 // Create offline audio context. | |
| 29 context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRat e); | |
| 30 | |
| 31 bufferLoader = new BufferLoader( | |
| 32 context, | |
| 33 [ | |
| 34 "../resources/hyper-reality/br-jam-loop.wav", | |
| 35 ], | |
| 36 finishedLoading | |
| 37 ); | |
| 38 | |
| 39 bufferLoader.load(); | |
| 40 testRunner.waitUntilDone(); | |
| 41 } | |
| 42 | 34 |
| 43 function finishedLoading(bufferList) { | 35 Audit.loadFileFromUrl('../resources/hyper-reality/br-jam-loop.wav') |
| 44 var bufferSource = context.createBufferSource(); | 36 .then(buffer => { |
| 45 bufferSource.buffer = bufferList[0]; | 37 let bufferSource = context.createBufferSource(); |
| 46 | 38 bufferSource.buffer = bufferList[0]; |
|
hongchan
2017/02/27 19:12:54
Does this work? I think this should be:
bufferSou
Raymond Toy
2017/02/27 19:28:48
Uhoh. This conversion isn't working, even if I cha
| |
| 47 bufferSource.connect(context.destination); | 39 |
| 48 bufferSource.start(0); | 40 bufferSource.connect(context.destination); |
| 49 | 41 bufferSource.start(0); |
| 50 context.oncomplete = finishAudioTest; | 42 |
| 51 context.startRendering(); | 43 context.oncomplete = (event) => { |
| 52 } | 44 finishAudioTest(event); |
| 45 task.done(); | |
| 46 }; | |
| 47 context.startRendering(); | |
| 48 }) | |
|
hongchan
2017/02/27 19:12:54
A missing semicolon.
| |
| 49 testRunner.waitUntilDone(); | |
| 50 }); | |
| 51 | |
| 52 audit.run(); | |
| 53 | |
| 53 | 54 |
|
hongchan
2017/02/27 19:12:54
Remove l.53~l.54.
| |
| 54 </script> | 55 </script> |
| 55 </head> | 56 </head> |
| 56 <body> | 57 <body> |
| 57 </body> | 58 </body> |
| 58 </html> | 59 </html> |
| OLD | NEW |