Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test stereo equalpower panning with a GainNode</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 7 | </head> |
michael@0 | 8 | <body> |
michael@0 | 9 | <pre id="test"> |
michael@0 | 10 | <script src="webaudio.js" type="text/javascript"></script> |
michael@0 | 11 | <script class="testbody" type="text/javascript"> |
michael@0 | 12 | |
michael@0 | 13 | const size = 256; |
michael@0 | 14 | |
michael@0 | 15 | var gTest = { |
michael@0 | 16 | numberOfChannels: 2, |
michael@0 | 17 | createGraph: function(context) { |
michael@0 | 18 | var panner = context.createPanner(); |
michael@0 | 19 | panner.setPosition(1.0, 0.0, 0.0); // reference distance the right |
michael@0 | 20 | panner.panningModel = "equalpower"; |
michael@0 | 21 | |
michael@0 | 22 | var gain = context.createGain(); |
michael@0 | 23 | gain.gain.value = -0.5; |
michael@0 | 24 | gain.connect(panner); |
michael@0 | 25 | |
michael@0 | 26 | var buffer = context.createBuffer(2, 2, context.sampleRate); |
michael@0 | 27 | buffer.getChannelData(0)[0] = 1.0; |
michael@0 | 28 | buffer.getChannelData(1)[1] = 1.0; |
michael@0 | 29 | var source = context.createBufferSource(); |
michael@0 | 30 | source.buffer = buffer; |
michael@0 | 31 | source.connect(gain); |
michael@0 | 32 | source.start(0); |
michael@0 | 33 | |
michael@0 | 34 | return panner; |
michael@0 | 35 | }, |
michael@0 | 36 | createExpectedBuffers: function(context) { |
michael@0 | 37 | var expectedBuffer = context.createBuffer(2, size, context.sampleRate); |
michael@0 | 38 | expectedBuffer.getChannelData(1)[0] = -0.5; |
michael@0 | 39 | expectedBuffer.getChannelData(1)[1] = -0.5; |
michael@0 | 40 | return expectedBuffer; |
michael@0 | 41 | }, |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | runTest(); |
michael@0 | 45 | |
michael@0 | 46 | </script> |
michael@0 | 47 | </pre> |
michael@0 | 48 | </body> |
michael@0 | 49 | </html> |