diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/webaudio/test/test_pannerNodeAtZeroDistance.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/webaudio/test/test_pannerNodeAtZeroDistance.html')
-rw-r--r-- | dom/media/webaudio/test/test_pannerNodeAtZeroDistance.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/dom/media/webaudio/test/test_pannerNodeAtZeroDistance.html b/dom/media/webaudio/test/test_pannerNodeAtZeroDistance.html new file mode 100644 index 000000000..21abd2b60 --- /dev/null +++ b/dom/media/webaudio/test/test_pannerNodeAtZeroDistance.html @@ -0,0 +1,86 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test PannerNode produces output even when the even when the distance is from the listener is zero</title> + <script type="text/javascript" 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"> + +var BUF_SIZE = 128; + +var types = [ + "equalpower", + "HRTF" +] + +var finished = types.length; + +function finish() { + if (!--finished) { + SimpleTest.finish(); + } +} + +function test(type) { + var ac = new OfflineAudioContext(1, BUF_SIZE, 44100); + + // A sine to be used to fill the buffers + function sine(t) { + return Math.sin(440 * 2 * Math.PI * t / ac.sampleRate); + } + + var monoBuffer = ac.createBuffer(1, BUF_SIZE, ac.sampleRate); + for (var i = 0; i < BUF_SIZE; ++i) { + monoBuffer.getChannelData(0)[i] = sine(i); + } + + var monoSource = ac.createBufferSource(); + monoSource.buffer = monoBuffer; + monoSource.start(0); + + var panner = ac.createPanner(); + panner.distanceModel = "linear"; + panner.refDistance = 1; + panner.positionX.value = 0; + panner.positionY.value = 0; + panner.positionZ.value = 0; + monoSource.connect(panner); + + var panner2 = ac.createPanner(); + panner2.distanceModel = "inverse"; + panner2.refDistance = 1; + panner2.positionX.value = 0; + panner2.positionY.value = 0; + panner2.positionZ.value = 0; + panner.connect(panner2); + + var panner3 = ac.createPanner(); + panner3.distanceModel = "exponential"; + panner3.refDistance = 1; + panner3.positionX.value = 0; + panner3.positionY.value = 0; + panner3.positionZ.value = 0; + panner2.connect(panner3); + + panner3.connect(ac.destination); + + ac.startRendering().then(function(buffer) { + compareBuffers(buffer, monoBuffer); + finish(); + }); +} + +addLoadEvent(function() { + types.forEach(test); +}); + +SimpleTest.waitForExplicitFinish(); + +</script> +</pre> +</body> +</html> |