| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <!-- | 3 <!-- |
| 4 Tests that we are able to schedule a series of notes to playback with sample-acc
uracy. | 4 Tests that we are able to schedule a series of notes to playback with sample-acc
uracy. |
| 5 We use an impulse so we can tell exactly where the rendering is happening. | 5 We use an impulse so we can tell exactly where the rendering is happening. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <html> | 8 <html> |
| 9 <head> | 9 <head> |
| 10 <script src="../../resources/testharness.js"></script> | 10 <script src="../../resources/testharness.js"></script> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 should(impulseCount, "Number of impulses found") | 80 should(impulseCount, "Number of impulses found") |
| 81 .beEqualTo(sampleOffsets.length); | 81 .beEqualTo(sampleOffsets.length); |
| 82 | 82 |
| 83 if (impulseCount == sampleOffsets.length) { | 83 if (impulseCount == sampleOffsets.length) { |
| 84 should(badOffsetCount, "bad offset") | 84 should(badOffsetCount, "bad offset") |
| 85 .beEqualTo(0); | 85 .beEqualTo(0); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 audit.define("test", function (task, should) { | 89 audit.define({ |
| 90 task.describe("Test sample-accurate scheduling"); | 90 label: "test", |
| 91 description: "Test sample-accurate scheduling" |
| 92 }, function (task, should) { |
| 91 | 93 |
| 92 // Create offline audio context. | 94 // Create offline audio context. |
| 93 context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, | 95 context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, |
| 94 sampleRate); | 96 sampleRate); |
| 95 createImpulse(); | 97 createImpulse(); |
| 96 | 98 |
| 97 for (let i = 0; i < sampleOffsets.length; ++i) { | 99 for (let i = 0; i < sampleOffsets.length; ++i) { |
| 98 let timeInSeconds = sampleOffsets[i] / sampleRate; | 100 let timeInSeconds = sampleOffsets[i] / sampleRate; |
| 99 playNote(timeInSeconds); | 101 playNote(timeInSeconds); |
| 100 } | 102 } |
| 101 | 103 |
| 102 context.startRendering() | 104 context.startRendering() |
| 103 .then(function (buffer) { | 105 .then(function (buffer) { |
| 104 checkSampleAccuracy(buffer, should); | 106 checkSampleAccuracy(buffer, should); |
| 105 task.done(); | 107 task.done(); |
| 106 }); | 108 }); |
| 107 }); | 109 }); |
| 108 | 110 |
| 109 audit.run(); | 111 audit.run(); |
| 110 </script> | 112 </script> |
| 111 | 113 |
| 112 </body> | 114 </body> |
| 113 </html> | 115 </html> |
| OLD | NEW |