blob: 59a36b87e62bebd83e047a71d9959dbde81e8126 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<!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 basic functionality of DelayNode with a non-default max delay time.");
function runTest() {
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.jsTestIsAsync = true;
// Create offline audio context.
var context = new webkitOfflineAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
var toneBuffer = createToneBuffer(context, 20, 20 * toneLengthSeconds, sampleRate); // 20Hz tone
var bufferSource = context.createBufferSource();
bufferSource.buffer = toneBuffer;
// Create a delay node with an explicit max delay time (greater than the default of 1 second).
var delay = context.createDelayNode(2);
// Set the delay time to a value greater than the default max delay so we can verify the delay
// is working for this case.
delayTimeSeconds = 1.5;
delay.delayTime.value = delayTimeSeconds;
bufferSource.connect(delay);
delay.connect(context.destination);
bufferSource.noteOn(0);
context.oncomplete = checkDelayedResult(toneBuffer);
context.startRendering();
}
runTest();
</script>
</body>
</html>
|