OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 | |
3 <html> | |
4 <head> | |
5 <script src="../resources/js-test.js"></script> | |
6 <script src="resources/compatibility.js"></script> | |
7 <script src="resources/audit-util.js"></script> | |
8 <script src="resources/audio-testing.js"></script> | |
9 <script src="resources/delay-testing.js"></script> | |
10 </head> | |
11 | |
12 <body> | |
13 | |
14 <div id="description"></div> | |
15 <div id="console"></div> | |
16 | |
17 <script> | |
18 description("Tests attribute and basic functionality of Delay."); | |
19 | |
20 function runTest() { | |
21 if (window.testRunner) { | |
22 testRunner.dumpAsText(); | |
23 testRunner.waitUntilDone(); | |
24 } | |
25 | |
26 window.jsTestIsAsync = true; | |
27 | |
28 // Create offline audio context. | |
29 var context = new OfflineAudioContext(1, sampleRate * renderLengthSeconds, s
ampleRate); | |
30 var toneBuffer = createToneBuffer(context, 20, 20 * toneLengthSeconds, sampl
eRate); // 20Hz tone | |
31 | |
32 var bufferSource = context.createBufferSource(); | |
33 bufferSource.buffer = toneBuffer; | |
34 | |
35 var delay = context.createDelay(); | |
36 | |
37 window.delay = delay; | |
38 shouldBeTrue("delay.numberOfInputs === 1"); | |
39 shouldBeTrue("delay.numberOfOutputs === 1"); | |
40 shouldBeTrue("delay.delayTime.defaultValue === 0.0"); | |
41 shouldBeTrue("delay.delayTime.value === 0.0"); | |
42 | |
43 delay.delayTime.value = delayTimeSeconds; | |
44 shouldBeTrue("delay.delayTime.value === 0.5"); | |
45 | |
46 bufferSource.connect(delay); | |
47 delay.connect(context.destination); | |
48 bufferSource.start(0); | |
49 | |
50 context.oncomplete = checkDelayedResult(toneBuffer); | |
51 context.startRendering(); | |
52 } | |
53 | |
54 runTest(); | |
55 | |
56 </script> | |
57 | |
58 </body> | |
59 </html> | |
OLD | NEW |