blob: 955b770362640c58363534949ab0b13687ebc0d8 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Tests that precision issues do not cause ConeEffect::gain() to return NaN");
jsTestIsAsync = true;
function test() {
const audioContext = new OfflineAudioContext(1, 44100, 44100);
const panner = audioContext.createPanner();
panner.panningModel = "HRTF";
panner.refDistance = 50;
panner.coneInnerAngle = 0;
panner.coneOuterAngle = 180;
panner.coneOuterGain = 0.25;
const source = new ConstantSourceNode(audioContext);
source.connect(panner);
panner.connect(audioContext.destination);
audioContext.listener.setPosition(203.4781799316, 0, 200);
panner.setPosition(121.7528991699, 0, 137.7344207764);
panner.setOrientation(0.7954952121, 0, 0.6058534384);
source.start();
audioContext.startRendering().then((buffer) => {
data = buffer.getChannelData(0);
shouldBeFalse("data.some(isNaN)");
finishJSTest();
});
}
onload = test;
</script>
</body>
</html>