mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1203616 - Test that waveshaper nodes don't corrupt their input buffer. r=karlt
This commit is contained in:
parent
a65bb299b6
commit
7de0462cdc
@ -172,6 +172,7 @@ skip-if = (toolkit == 'gonk' && !debug) || android_version == '10' || android_ve
|
||||
[test_stereoPanningWithGain.html]
|
||||
[test_waveDecoder.html]
|
||||
[test_waveShaper.html]
|
||||
[test_waveShaperGain.html]
|
||||
[test_waveShaperNoCurve.html]
|
||||
[test_waveShaperPassThrough.html]
|
||||
[test_waveShaperInvalidLengthCurve.html]
|
||||
|
51
dom/media/webaudio/test/test_waveShaperGain.html
Normal file
51
dom/media/webaudio/test/test_waveShaperGain.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test that WaveShaperNode doesn't corrupt its inputs when the gain is !=
|
||||
1.0 (bug 1203616)</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var samplerate = 44100;
|
||||
var context = new OfflineAudioContext(1, 44100, samplerate);
|
||||
|
||||
var dc = context.createBufferSource();
|
||||
|
||||
var buffer = context.createBuffer(1, 1, samplerate);
|
||||
buffer.getChannelData(0)[0] = 1.0;
|
||||
dc.buffer = buffer;
|
||||
|
||||
var gain = context.createGain();
|
||||
var ws2 = context.createWaveShaper();
|
||||
var ws = [];
|
||||
|
||||
// No-op waveshaper curves.
|
||||
for (var i = 0; i < 2; i++) {
|
||||
ws[i] = context.createWaveShaper();
|
||||
var curve = new Float32Array(2);
|
||||
curve[0] = -1.0;
|
||||
curve[1] = 1.0;
|
||||
ws[i].curve = curve;
|
||||
ws[i].connect(context.destination);
|
||||
gain.connect(ws[i]);
|
||||
}
|
||||
|
||||
dc.connect(gain);
|
||||
dc.start();
|
||||
|
||||
gain.gain.value = 0.5;
|
||||
|
||||
context.startRendering().then(buffer => {
|
||||
document.querySelector("pre").innerHTML = buffer.getChannelData(0)[0];
|
||||
ok(buffer.getChannelData(0)[0] == 1.0, "Volume was handled properly");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
<pre>
|
||||
</pre>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user