|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test the OscillatorNode interface</title> |
|
5 <script type="text/javascript" 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(); |
|
18 |
|
19 osc.connect(sp); |
|
20 // Work around bug 916387. |
|
21 sp.connect(context.destination); |
|
22 |
|
23 sp.onaudioprocess = function (e) { |
|
24 var input = e.inputBuffer.getChannelData(0); |
|
25 var isSilent = true; |
|
26 for (var i = 0; i < input.length; i++) { |
|
27 if (input[i] != 0.0) { |
|
28 isSilent = false; |
|
29 } |
|
30 } |
|
31 sp.onaudioprocess = null; |
|
32 ok(isSilent, "OscillatorNode should be silent before calling start."); |
|
33 SimpleTest.finish(); |
|
34 } |
|
35 }); |
|
36 |
|
37 </script> |
|
38 </pre> |
|
39 </body> |
|
40 </html> |