|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test AudioParam timeline events scheduled after the destination stream has started playback</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <script type="text/javascript" src="webaudio.js"></script> |
|
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
8 </head> |
|
9 <body> |
|
10 <pre id="test"> |
|
11 <script class="testbody" type="text/javascript"> |
|
12 |
|
13 var gTest = { |
|
14 length: 16384, |
|
15 numberOfChannels: 1, |
|
16 createGraphAsync: function(context, callback) { |
|
17 var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate); |
|
18 for (var i = 0; i < 2048; ++i) { |
|
19 sourceBuffer.getChannelData(0)[i] = 1; |
|
20 } |
|
21 |
|
22 setTimeout(function() { |
|
23 var source = context.createBufferSource(); |
|
24 source.buffer = sourceBuffer; |
|
25 source.start(context.currentTime); |
|
26 source.stop(context.currentTime + sourceBuffer.duration); |
|
27 |
|
28 var gain = context.createGain(); |
|
29 gain.gain.setValueAtTime(0, context.currentTime); |
|
30 gain.gain.setTargetAtTime(0, context.currentTime + sourceBuffer.duration, 1); |
|
31 source.connect(gain); |
|
32 |
|
33 callback(gain); |
|
34 }, 100); |
|
35 }, |
|
36 }; |
|
37 |
|
38 runTest(); |
|
39 |
|
40 </script> |
|
41 </pre> |
|
42 </body> |
|
43 </html> |