| OLD | NEW |
| 1 <!doctype html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test AudioBufferSourceNode With Looping a Single-Sample Buffer</title
> | 4 <title> |
| 5 Test AudioBufferSourceNode With Looping a Single-Sample Buffer |
| 6 </title> |
| 5 <script src="../../resources/testharness.js"></script> | 7 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 8 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audit-util.js"></script> | 9 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audit.js"></script> | 10 <script src="../resources/audit.js"></script> |
| 9 </head> | 11 </head> |
| 10 | |
| 11 <body> | 12 <body> |
| 12 <script> | 13 <script id="layout-test-code"> |
| 13 let audit = Audit.createTaskRunner(); | 14 let audit = Audit.createTaskRunner(); |
| 14 | 15 |
| 15 let sampleRate = 44100; | 16 let sampleRate = 44100; |
| 16 let testDurationSamples = 1000; | 17 let testDurationSamples = 1000; |
| 17 | 18 |
| 18 audit.define("one-sample-loop", function (task, should) { | 19 audit.define('one-sample-loop', function(task, should) { |
| 19 // Create the offline context for the test. | 20 // Create the offline context for the test. |
| 20 let context = new OfflineAudioContext(1, testDurationSamples, | 21 let context = |
| 21 sampleRate); | 22 new OfflineAudioContext(1, testDurationSamples, sampleRate); |
| 22 | 23 |
| 23 // Create the single sample buffer | 24 // Create the single sample buffer |
| 24 let buffer = createConstantBuffer(context, 1, 1); | 25 let buffer = createConstantBuffer(context, 1, 1); |
| 25 | 26 |
| 26 // Create the source and connect it to the destination | 27 // Create the source and connect it to the destination |
| 27 let source = context.createBufferSource(); | 28 let source = context.createBufferSource(); |
| 28 source.buffer = buffer; | 29 source.buffer = buffer; |
| 29 source.loop = true; | 30 source.loop = true; |
| 30 source.connect(context.destination); | 31 source.connect(context.destination); |
| 31 source.start(); | 32 source.start(); |
| 32 | 33 |
| 33 // Render it! | 34 // Render it! |
| 34 context.startRendering() | 35 context.startRendering() |
| 35 .then(function(audioBuffer) { | 36 .then(function(audioBuffer) { |
| 36 should(audioBuffer.getChannelData(0), "Rendered data") | 37 should(audioBuffer.getChannelData(0), 'Rendered data') |
| 37 .beConstantValueOf(1); | 38 .beConstantValueOf(1); |
| 38 }) | 39 }) |
| 39 .then(task.done.bind(task));; | 40 .then(task.done.bind(task)); |
| 41 ; |
| 40 }); | 42 }); |
| 41 | 43 |
| 42 audit.run(); | 44 audit.run(); |
| 43 </script> | 45 </script> |
| 44 </body> | 46 </body> |
| 45 </html> | 47 </html> |
| OLD | NEW |