| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <script src="resources/audio-testing.js"></script> |
| <script src="resources/note-grain-on-testing.js"></script> |
| <script src="../resources/js-test-pre.js"></script> |
| </head> |
| |
| <body> |
| <div id="description"></div> |
| <div id="console"></div> |
| |
| <script> |
| description("Test timing of noteGrainOn."); |
| |
| var squarePulseBuffer; |
| |
| function checkResult(event) { |
| var buffer = event.renderedBuffer; |
| renderedData = buffer.getChannelData(0); |
| var nSamples = renderedData.length; |
| |
| var success = true; |
| |
| var startEndFrames = findStartAndEndSamples(renderedData); |
| |
| success = success && verifyStartAndEndFrames(startEndFrames); |
| |
| if (success) { |
| testPassed("noteGrainOn timing tests passed."); |
| } else { |
| testFailed("noteGrainOn timing tests failed."); |
| } |
| |
| finishJSTest(); |
| } |
| |
| function runTest() { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| window.jsTestIsAsync = true; |
| |
| // Create offline audio context. |
| context = new webkitOfflineAudioContext(2, sampleRate * renderTime, sampleRate); |
| |
| squarePulseBuffer = createSignalBuffer(context, function (k) { return 1 }); |
| |
| playAllGrains(context, squarePulseBuffer, numberOfTests); |
| |
| context.oncomplete = checkResult; |
| context.startRendering(); |
| } |
| |
| runTest(); |
| successfullyParsed = true; |
| |
| </script> |
| |
| <script src="../resources/js-test-post.js"></script> |
| </body> |
| </html> |