OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 | |
3 <!-- | |
4 See if we can load an AudioBuffer, create an AudioBufferSourceNode, attach the b
uffer to it, then play it. | |
5 --> | |
6 | |
7 <html> | |
8 <head> | |
9 <script src="resources/audit-util.js"></script> | |
10 <script src="resources/audio-testing.js"></script> | |
11 <script type="text/javascript" src="resources/buffer-loader.js"></script> | |
12 | |
13 <script> | |
14 | |
15 window.onload = init; | |
16 | |
17 var sampleRate = 44100.0; | |
18 var lengthInSeconds = 2; | |
19 | |
20 var context = 0; | |
21 var bufferLoader = 0; | |
22 | |
23 function init() { | |
24 if (!window.testRunner) | |
25 return; | |
26 | |
27 // Create offline audio context. | |
28 context = new OfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRat
e); | |
29 | |
30 bufferLoader = new BufferLoader( | |
31 context, | |
32 [ | |
33 "resources/hyper-reality/br-jam-loop.wav", | |
34 ], | |
35 finishedLoading | |
36 ); | |
37 | |
38 bufferLoader.load(); | |
39 testRunner.waitUntilDone(); | |
40 } | |
41 | |
42 function finishedLoading(bufferList) { | |
43 var bufferSource = context.createBufferSource(); | |
44 bufferSource.buffer = bufferList[0]; | |
45 | |
46 bufferSource.connect(context.destination); | |
47 bufferSource.start(0); | |
48 | |
49 context.oncomplete = finishAudioTest; | |
50 context.startRendering(); | |
51 } | |
52 | |
53 </script> | |
54 </head> | |
55 <body> | |
56 </body> | |
57 </html> | |
OLD | NEW |