diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/webaudio/test/test_pannerNode_audioparam_distance.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webaudio/test/test_pannerNode_audioparam_distance.html')
-rw-r--r-- | dom/media/webaudio/test/test_pannerNode_audioparam_distance.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/dom/media/webaudio/test/test_pannerNode_audioparam_distance.html b/dom/media/webaudio/test/test_pannerNode_audioparam_distance.html new file mode 100644 index 0000000000..2d955de19d --- /dev/null +++ b/dom/media/webaudio/test/test_pannerNode_audioparam_distance.html @@ -0,0 +1,43 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Distance effect of a PannerNode with the position set via AudioParams (Bug 1472550)</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="webaudio.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<pre id="test"> +<script class="testbody" type="text/javascript"> + SimpleTest.waitForExplicitFinish(); + var o = new OfflineAudioContext(2, 256, 44100); + + // We want a stereo constant source. + var b = o.createBuffer(2, 1, 44100); + b.getChannelData(0)[0] = 1; + b.getChannelData(1)[0] = 1; + var c = o.createBufferSource(); + c.buffer = b; + c.loop = true; + + var p = o.createPanner(); + p.positionY.setValueAtTime(1, 0); + p.positionX.setValueAtTime(1, 0); + p.positionZ.setValueAtTime(1, 0); + + // Set the listener somewhere far + o.listener.setPosition(20, 2, 20); + + c.start(); + c.connect(p).connect(o.destination); + + o.startRendering().then((ab) => { + // Check that the distance attenuates the sound. + ok(ab.getChannelData(0)[0] < 0.1, "left channel must be very quiet"); + ok(ab.getChannelData(1)[0] < 0.1, "right channel must be very quiet"); + SimpleTest.finish(); + }); +</script> +</pre> +</body> +</html> |