2013-09-04 13:20:59 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test PannerNode directly above</title>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2013-09-04 13:20:59 +04:00
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="test">
|
|
|
|
<script src="webaudio.js" type="text/javascript"></script>
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
var gTest = {
|
|
|
|
numberOfChannels: 2,
|
2019-09-02 14:22:27 +03:00
|
|
|
createGraph(context) {
|
2013-09-04 13:20:59 +04:00
|
|
|
// An up vector will be made perpendicular to the front vector, in the
|
|
|
|
// front-up plane.
|
|
|
|
context.listener.setOrientation(0, 6.311749985202524e+307, 0, 0.1, 1000, 0);
|
|
|
|
// Linearly dependent vectors are ignored.
|
|
|
|
context.listener.setOrientation(0, 0, -6.311749985202524e+307, 0, 0, 6.311749985202524e+307);
|
|
|
|
var panner = context.createPanner();
|
2016-06-23 20:41:52 +03:00
|
|
|
panner.positionX.value = 2; // directly above
|
2013-09-04 13:20:59 +04:00
|
|
|
panner.rolloffFactor = 0; // no distance gain
|
|
|
|
panner.panningModel = "equalpower"; // no effect when directly above
|
|
|
|
|
|
|
|
var source = context.createBufferSource();
|
|
|
|
source.buffer = this.buffer;
|
|
|
|
source.connect(panner);
|
|
|
|
source.start(0);
|
|
|
|
|
|
|
|
return panner;
|
|
|
|
},
|
2019-09-02 14:22:27 +03:00
|
|
|
createExpectedBuffers(context) {
|
2013-09-04 13:20:59 +04:00
|
|
|
var expectedBuffer = context.createBuffer(2, 2048, context.sampleRate);
|
|
|
|
for (var i = 0; i < 2048; ++i) {
|
|
|
|
// Different signals in left and right buffers
|
|
|
|
expectedBuffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
|
|
|
expectedBuffer.getChannelData(1)[i] = Math.sin(220 * 2 * Math.PI * i / context.sampleRate);
|
|
|
|
}
|
|
|
|
this.buffer = expectedBuffer;
|
|
|
|
return expectedBuffer;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
runTest();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|