mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
f574450bd6
Copy the periodicWave data into a shareable buffer. Add a SetBuffer call to send the buffer data to the OscillatorNodeEngine. Call into blink's PeriodicWave implementation to generate bandlimited tables bracketing the desired frequency and interpolate the output data from them. Change the PeriodicWave constructor to only take one length, since both arrays must be the same size. Change OscillatorNode's SetType to throw INVALID_STATE instead of NOT_IMPLEMENTED if js tries to assign type = 'custom' directly.
59 lines
1.8 KiB
HTML
59 lines
1.8 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test the OscillatorNode interface</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">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
addLoadEvent(function() {
|
|
|
|
var context = new AudioContext();
|
|
var osc = context.createOscillator();
|
|
|
|
is(osc.channelCount, 2, "Oscillator node has 2 input channels by default");
|
|
is(osc.channelCountMode, "max", "Correct channelCountMode for the Oscillator node");
|
|
is(osc.channelInterpretation, "speakers", "Correct channelCountInterpretation for the Oscillator node");
|
|
is(osc.type, "sine", "Correct default type");
|
|
expectException(function() {
|
|
osc.type = "custom";
|
|
}, DOMException.INVALID_STATE_ERR);
|
|
expectException(function() {
|
|
osc.type = osc.CUSTOM;
|
|
}, DOMException.INVALID_STATE_ERR);
|
|
is(osc.type, "sine", "Cannot set the type to custom");
|
|
is(osc.frequency.value, 440, "Correct default frequency value");
|
|
is(osc.detune.value, 0, "Correct default detine value");
|
|
|
|
// Make sure that we can set all of the valid type values
|
|
var types = [
|
|
"sine",
|
|
"square",
|
|
"sawtooth",
|
|
"triangle",
|
|
];
|
|
for (var i = 0; i < types.length; ++i) {
|
|
osc.type = osc[types[i].toUpperCase()];
|
|
is(osc.type, types[i], "Correct alternname type enum value");
|
|
osc.type = types[i];
|
|
}
|
|
|
|
// Verify setPeriodicWave()
|
|
var real = new Float32Array([1.0, 0.5, 0.25, 0.125]);
|
|
var imag = new Float32Array([1.0, 0.7, -1.0, 0.5]);
|
|
osc.setPeriodicWave(context.createPeriodicWave(real, imag));
|
|
is(osc.type, "custom", "Failed to set custom waveform");
|
|
|
|
SimpleTest.finish();
|
|
});
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|