blob: caa2a8e5931193962c07f8ff9c4985fc6062033f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="resources/audio-testing.js"></script>
<script src="resources/delay-testing.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Tests attribute and maximum allowed delay of DelayNode.");
function runTest() {
window.jsTestIsAsync = true;
// Create offline audio context.
var context = new OfflineAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
var toneBuffer = createToneBuffer(context, 20, 20 * toneLengthSeconds, sampleRate); // 20Hz tone
var bufferSource = context.createBufferSource();
bufferSource.buffer = toneBuffer;
window.context = context;
shouldThrow("context.createDelay(180)");
shouldThrow("context.createDelay(0)");
shouldThrow("context.createDelay(-1)");
var delay = context.createDelay(179);
delay.delayTime.value = delayTimeSeconds;
window.delay = delay;
shouldBeTrue("delay.delayTime.value === 0.5");
bufferSource.connect(delay);
delay.connect(context.destination);
bufferSource.start(0);
context.oncomplete = checkDelayedResult(toneBuffer);
context.startRendering();
}
runTest();
</script>
</body>
</html>