blob: dbe10548fb4b8f4c0c810ee18f646763208fb67a [file] [log] [blame]
crogers@google.com53b9a1f2011-08-09 20:26:15 +00001<!DOCTYPE html>
2
3<!--
4See if we can load an AudioBuffer, create an AudioBufferSourceNode, attach the buffer to it, then play it.
5-->
6
7<html>
8<head>
9<script type="text/javascript" src="resources/audio-testing.js"></script>
10<script type="text/javascript" src="resources/buffer-loader.js"></script>
11
12<script>
13
14window.onload = init;
15
16var sampleRate = 44100.0;
17var lengthInSeconds = 2;
18
19var context = 0;
20var bufferLoader = 0;
21
22function init() {
rniwa@webkit.orgcc082ecd2012-06-16 03:42:58 +000023 if (!window.testRunner)
crogers@google.com53b9a1f2011-08-09 20:26:15 +000024 return;
25
26 // Create offline audio context.
crogers@google.com24fec262012-12-12 22:35:44 +000027 context = new webkitOfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);
crogers@google.com53b9a1f2011-08-09 20:26:15 +000028
29 bufferLoader = new BufferLoader(
30 context,
31 [
32 "resources/hyper-reality/br-jam-loop.wav",
33 ],
34 finishedLoading
35 );
36
37 bufferLoader.load();
rniwa@webkit.orgcc082ecd2012-06-16 03:42:58 +000038 testRunner.waitUntilDone();
crogers@google.com53b9a1f2011-08-09 20:26:15 +000039}
40
41function finishedLoading(bufferList) {
42 var bufferSource = context.createBufferSource();
43 bufferSource.buffer = bufferList[0];
44
45 bufferSource.connect(context.destination);
crogers@google.com143fd022012-09-21 22:12:36 +000046 bufferSource.start(0);
crogers@google.com53b9a1f2011-08-09 20:26:15 +000047
48 context.oncomplete = finishAudioTest;
49 context.startRendering();
50}
51
52</script>
53</head>
54<body>
55</body>
56</html>