test_audioBufferSourceNodePassThrough.html (1148B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test AudioBufferSourceNode with passthrough</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 var gTest = { 14 length: 2048, 15 numberOfChannels: 1, 16 createGraph(context) { 17 var buffer = context.createBuffer(1, 2048, context.sampleRate); 18 for (var i = 0; i < 2048; ++i) { 19 buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate); 20 } 21 22 var source = context.createBufferSource(); 23 24 source.buffer = buffer; 25 26 var srcWrapped = SpecialPowers.wrap(source); 27 ok("passThrough" in srcWrapped, "AudioBufferSourceNode should support the passThrough API"); 28 srcWrapped.passThrough = true; 29 30 source.start(0); 31 return source; 32 }, 33 createExpectedBuffers(context) { 34 var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate); 35 36 return [expectedBuffer]; 37 }, 38 }; 39 40 runTest(); 41 42 </script> 43 </pre> 44 </body> 45 </html>