summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/webaudio/delaynode-max-default-delay.html
blob: eb526d5fd26914207bbdc7b8dd75bac690be011f (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
<!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 DelayNode with delay set to default maximum delay.");

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;

    var delay = context.createDelayNode();
    delayTimeSeconds = 1;
    delay.delayTime.value = delayTimeSeconds;

    bufferSource.connect(delay);
    delay.connect(context.destination);
    bufferSource.noteOn(0);
    
    context.oncomplete = checkDelayedResult(toneBuffer);
    context.startRendering();
}

runTest();

</script>

</body>
</html>