mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
fc44cd635c
Here's what this patch does: -- Makes AudioNodes mostly not use nsWrapperCache. AudioDestinationNode still does. -- Rename MaxNumberOfInputs/Outputs to NumberOfInputs/Outputs, and have them default to 1 in AudioNode. -- Allow any number of nodes to be connected to any given input/output port.
58 lines
1.9 KiB
HTML
58 lines
1.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test whether we can create an AudioContext interface</title>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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() {
|
|
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
|
|
|
|
var context = new AudioContext();
|
|
var buffer = context.createBuffer(1, 2048, 44100);
|
|
for (var i = 0; i < 2048; ++i) {
|
|
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / 44100);
|
|
}
|
|
|
|
var destination = context.destination;
|
|
is(destination.context, context, "Destination node has proper context");
|
|
is(destination.context, context, "Destination node has proper context");
|
|
is(destination.numberOfInputs, 1, "Destination node has 1 inputs");
|
|
is(destination.numberOfOutputs, 0, "Destination node has 0 outputs");
|
|
|
|
var source = context.createBufferSource();
|
|
is(source.context, context, "Source node has proper context");
|
|
is(source.numberOfInputs, 0, "Source node has 0 inputs");
|
|
is(source.numberOfOutputs, 1, "Source node has 1 outputs");
|
|
ok(!source.buffer, "Source node should not have a buffer when it's created");
|
|
|
|
source.buffer = buffer;
|
|
ok(source.buffer, "Source node should have a buffer now");
|
|
|
|
source.connect(destination);
|
|
|
|
is(source.numberOfInputs, 0, "Source node has 0 inputs");
|
|
is(source.numberOfOutputs, 1, "Source node has 0 outputs");
|
|
is(destination.numberOfInputs, 1, "Destination node has 0 inputs");
|
|
is(destination.numberOfOutputs, 0, "Destination node has 0 outputs");
|
|
|
|
source.start(0);
|
|
SimpleTest.executeSoon(function() {
|
|
source.stop(0);
|
|
source.disconnect();
|
|
|
|
SpecialPowers.clearUserPref("media.webaudio.enabled");
|
|
SimpleTest.finish();
|
|
});
|
|
});
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|