1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <script src=
"resources/compatibility.js"></script>
5 <script src=
"resources/audio-testing.js"></script>
6 <script src=
"resources/note-grain-on-testing.js"></script>
7 <script src=
"../resources/js-test.js"></script>
11 <div id=
"description"></div>
12 <div id=
"console"></div>
15 description("Test timing of noteGrainOn.");
17 var squarePulseBuffer
;
19 function checkResult(event
) {
20 var buffer
= event
.renderedBuffer
;
21 renderedData
= buffer
.getChannelData(0);
22 var nSamples
= renderedData
.length
;
26 var startEndFrames
= findStartAndEndSamples(renderedData
);
28 success
= success
&& verifyStartAndEndFrames(startEndFrames
);
31 testPassed("noteGrainOn timing tests passed.");
33 testFailed("noteGrainOn timing tests failed.");
40 if (window
.testRunner
) {
41 testRunner
.dumpAsText();
42 testRunner
.waitUntilDone();
45 window
.jsTestIsAsync
= true;
47 // Create offline audio context.
48 context
= new OfflineAudioContext(2, sampleRate
* renderTime
, sampleRate
);
50 squarePulseBuffer
= createSignalBuffer(context
, function (k
) { return 1 });
52 playAllGrains(context
, squarePulseBuffer
, numberOfTests
);
54 context
.oncomplete
= checkResult
;
55 context
.startRendering();
59 successfullyParsed
= true;