2016-07-18 19:53:24 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test whether we can disconnect an AudioNode</title>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2016-07-18 19:53:24 +03:00
|
|
|
<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 gTest = {
|
|
|
|
length: 256,
|
|
|
|
numberOfChannels: 1,
|
2019-09-02 14:22:27 +03:00
|
|
|
createGraph(context) {
|
|
|
|
var sourceBuffer = context.createBuffer(3, 256, context.sampleRate);
|
|
|
|
for (var i = 1; i <= 3; i++) {
|
|
|
|
var data = sourceBuffer.getChannelData(i-1);
|
|
|
|
for (var j = 0; j < data.length; j++) {
|
|
|
|
data[j] = i;
|
|
|
|
}
|
|
|
|
}
|
2016-07-18 19:53:24 +03:00
|
|
|
|
2019-09-02 14:22:27 +03:00
|
|
|
var source = context.createBufferSource();
|
|
|
|
source.buffer = sourceBuffer;
|
2016-07-18 19:53:24 +03:00
|
|
|
|
2019-09-02 14:22:27 +03:00
|
|
|
var splitter = context.createChannelSplitter(3);
|
|
|
|
var sum = context.createGain();
|
2016-07-18 19:53:24 +03:00
|
|
|
|
2019-09-02 14:22:27 +03:00
|
|
|
source.connect(splitter);
|
|
|
|
splitter.connect(sum, 0);
|
|
|
|
splitter.connect(sum, 1);
|
|
|
|
splitter.connect(sum, 2);
|
|
|
|
source.start();
|
2016-07-18 19:53:24 +03:00
|
|
|
|
2019-09-02 14:22:27 +03:00
|
|
|
splitter.disconnect(1);
|
2016-07-18 19:53:24 +03:00
|
|
|
|
2019-09-02 14:22:27 +03:00
|
|
|
return sum;
|
|
|
|
},
|
|
|
|
createExpectedBuffers(context) {
|
|
|
|
expectedBuffer = context.createBuffer(1, 256, context.sampleRate);
|
|
|
|
for (var i = 0; i < 256; ++i) {
|
|
|
|
expectedBuffer.getChannelData(0)[i] = 4;
|
|
|
|
}
|
2016-07-18 19:53:24 +03:00
|
|
|
|
2019-09-02 14:22:27 +03:00
|
|
|
return expectedBuffer;
|
|
|
|
},
|
2016-07-18 19:53:24 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
runTest();
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|