1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/webaudio/test/test_oscillatorNodeStart.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,40 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test the OscillatorNode interface</title> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.10 +</head> 1.11 +<body> 1.12 +<pre id="test"> 1.13 +<script class="testbody" type="text/javascript"> 1.14 + 1.15 +SimpleTest.waitForExplicitFinish(); 1.16 +addLoadEvent(function() { 1.17 + 1.18 + var context = new AudioContext(); 1.19 + var osc = context.createOscillator(); 1.20 + var sp = context.createScriptProcessor(); 1.21 + 1.22 + osc.connect(sp); 1.23 + // Work around bug 916387. 1.24 + sp.connect(context.destination); 1.25 + 1.26 + sp.onaudioprocess = function (e) { 1.27 + var input = e.inputBuffer.getChannelData(0); 1.28 + var isSilent = true; 1.29 + for (var i = 0; i < input.length; i++) { 1.30 + if (input[i] != 0.0) { 1.31 + isSilent = false; 1.32 + } 1.33 + } 1.34 + sp.onaudioprocess = null; 1.35 + ok(isSilent, "OscillatorNode should be silent before calling start."); 1.36 + SimpleTest.finish(); 1.37 + } 1.38 +}); 1.39 + 1.40 +</script> 1.41 +</pre> 1.42 +</body> 1.43 +</html>