test_oscillatorNodeStart.html (906B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test the OscillatorNode interface</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 </head> 8 <body> 9 <pre id="test"> 10 <script class="testbody" type="text/javascript"> 11 12 SimpleTest.waitForExplicitFinish(); 13 addLoadEvent(function() { 14 15 var context = new AudioContext(); 16 var osc = context.createOscillator(); 17 var sp = context.createScriptProcessor(0, 1, 0); 18 19 osc.connect(sp); 20 21 sp.onaudioprocess = function (e) { 22 var input = e.inputBuffer.getChannelData(0); 23 var isSilent = true; 24 for (var i = 0; i < input.length; i++) { 25 if (input[i] != 0.0) { 26 isSilent = false; 27 } 28 } 29 sp.onaudioprocess = null; 30 ok(isSilent, "OscillatorNode should be silent before calling start."); 31 SimpleTest.finish(); 32 } 33 }); 34 35 </script> 36 </pre> 37 </body> 38 </html>