test_audioParamTimelineDestinationOffset.html (1306B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test AudioParam timeline events scheduled after the destination stream has started playback</title> 5 <script 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 SimpleTest.requestFlakyTimeout("This test needs to wait until the AudioDestinationNode's stream's timer starts."); 14 15 var gTest = { 16 length: 16384, 17 numberOfChannels: 1, 18 createGraphAsync(context, callback) { 19 var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate); 20 for (var i = 0; i < 2048; ++i) { 21 sourceBuffer.getChannelData(0)[i] = 1; 22 } 23 24 setTimeout(function() { 25 var source = context.createBufferSource(); 26 source.buffer = sourceBuffer; 27 source.start(context.currentTime); 28 source.stop(context.currentTime + sourceBuffer.duration); 29 30 var gain = context.createGain(); 31 gain.gain.setValueAtTime(0, context.currentTime); 32 gain.gain.setTargetAtTime(0, context.currentTime + sourceBuffer.duration, 1); 33 source.connect(gain); 34 35 callback(gain); 36 }, 100); 37 }, 38 }; 39 40 runTest(); 41 42 </script> 43 </pre> 44 </body> 45 </html>