mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
66 lines
1.9 KiB
HTML
66 lines
1.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test PannerNode</title>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
function near(a, b, msg) {
|
|
ok(Math.abs(a - b) < 1e-4, msg);
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
addLoadEvent(function() {
|
|
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
|
|
|
var context = new AudioContext();
|
|
var buffer = context.createBuffer(1, 2048, context.sampleRate);
|
|
for (var i = 0; i < 2048; ++i) {
|
|
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
|
|
}
|
|
|
|
var destination = context.destination;
|
|
|
|
var source = context.createBufferSource();
|
|
|
|
var panner = context.createPanner();
|
|
|
|
source.buffer = buffer;
|
|
|
|
source.connect(panner);
|
|
panner.connect(destination);
|
|
|
|
// Verify default values
|
|
is(panner.panningModel, "HRTF", "Correct default value for panning model");
|
|
is(panner.distanceModel, "inverse", "Correct default value for distance model");
|
|
near(panner.refDistance, 1, "Correct default value for ref distance");
|
|
near(panner.maxDistance, 10000, "Correct default value for max distance");
|
|
near(panner.rolloffFactor, 1, "Correct default value for rolloff factor");
|
|
near(panner.coneInnerAngle, 360, "Correct default value for cone inner angle");
|
|
near(panner.coneOuterAngle, 360, "Correct default value for cone outer angle");
|
|
near(panner.coneOuterGain, 0, "Correct default value for cone outer gain");
|
|
|
|
panner.setPosition(1, 1, 1);
|
|
panner.setOrientation(1, 1, 1);
|
|
panner.setVelocity(1, 1, 1);
|
|
|
|
source.start(0);
|
|
SimpleTest.executeSoon(function() {
|
|
source.stop(0);
|
|
source.disconnect();
|
|
panner.disconnect();
|
|
|
|
SpecialPowers.clearUserPref("media.webaudio.enabled");
|
|
SimpleTest.finish();
|
|
});
|
|
});
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|