|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test PannerNode directly above</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 src="webaudio.js" type="text/javascript"></script> |
|
11 <script class="testbody" type="text/javascript"> |
|
12 |
|
13 var gTest = { |
|
14 length: 2048, |
|
15 numberOfChannels: 2, |
|
16 createGraph: function(context) { |
|
17 var buffer = context.createBuffer(2, 2048, context.sampleRate); |
|
18 for (var i = 0; i < 2048; ++i) { |
|
19 var sample = Math.sin(440 * 2 * Math.PI * i / context.sampleRate); |
|
20 // When mixed into a single channel, this produces silence |
|
21 buffer.getChannelData(0)[i] = sample; |
|
22 buffer.getChannelData(1)[i] = -sample; |
|
23 } |
|
24 |
|
25 var panner = context.createPanner(); |
|
26 panner.setPosition(1, 2, 3); |
|
27 panner.channelCount = 1; |
|
28 expectException(function() { panner.channelCount = 3; }, |
|
29 DOMException.NOT_SUPPORTED_ERR); |
|
30 panner.channelCountMode = "explicit"; |
|
31 expectException(function() { panner.channelCountMode = "max"; }, |
|
32 DOMException.NOT_SUPPORTED_ERR); |
|
33 panner.channelInterpretation = "discrete"; |
|
34 panner.channelInterpretation = "speakers"; |
|
35 |
|
36 var source = context.createBufferSource(); |
|
37 source.buffer = buffer; |
|
38 source.connect(panner); |
|
39 source.start(0); |
|
40 |
|
41 return panner; |
|
42 }, |
|
43 }; |
|
44 |
|
45 runTest(); |
|
46 |
|
47 </script> |
|
48 </pre> |
|
49 </body> |
|
50 </html> |