5 <script src=
"../resources/js-test.js"></script>
6 <script src=
"resources/compatibility.js"></script>
7 <script src=
"resources/audio-testing.js"></script>
8 <script src=
"resources/delay-testing.js"></script>
13 <div id=
"description"></div>
14 <div id=
"console"></div>
17 description("Tests basic functionality of DelayNode with a non-default max delay time.");
20 if (window
.testRunner
) {
21 testRunner
.dumpAsText();
22 testRunner
.waitUntilDone();
25 window
.jsTestIsAsync
= true;
27 // Create offline audio context.
28 var context
= new OfflineAudioContext(1, sampleRate
* renderLengthSeconds
, sampleRate
);
29 var toneBuffer
= createToneBuffer(context
, 20, 20 * toneLengthSeconds
, sampleRate
); // 20Hz tone
31 var bufferSource
= context
.createBufferSource();
32 bufferSource
.buffer
= toneBuffer
;
34 // Create a delay node with an explicit max delay time (greater than the default of 1 second).
35 var delay
= context
.createDelay(2);
36 // Set the delay time to a value greater than the default max delay so we can verify the delay
37 // is working for this case.
38 delayTimeSeconds
= 1.5;
39 delay
.delayTime
.value
= delayTimeSeconds
;
41 bufferSource
.connect(delay
);
42 delay
.connect(context
.destination
);
43 bufferSource
.start(0);
45 context
.oncomplete
= checkDelayedResult(toneBuffer
);
46 context
.startRendering();