42 lines
1.2 KiB
HTML
42 lines
1.2 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src="../resources/js-test.js"></script>
|
|
<script src="resources/audio-testing.js"></script>
|
|
<title>Test Supported Number of Channels for ConvolverNode</title>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
description("Test Supported Number of Channels for ConvolverNode");
|
|
window.jsTestIsAsync = true;
|
|
|
|
function runTest() {
|
|
// Just need a context to create nodes on, so any allowed length and rate is ok.
|
|
var context = new OfflineAudioContext(1, 1, 48000);
|
|
|
|
for (var count = 1; count <= 32; ++count) {
|
|
var convolver = context.createConvolver();
|
|
var buffer = context.createBuffer(count, 1, context.sampleRate);
|
|
var message = "ConvolverNode with buffer of " + count + " channels";
|
|
|
|
if (count == 1 || count == 2 || count == 4) {
|
|
// These are the only valid channel counts for the buffer.
|
|
shouldNotThrow(function () {
|
|
convolver.buffer = buffer;
|
|
}, message);
|
|
} else {
|
|
shouldThrowErrorName(function() {
|
|
convolver.buffer = buffer;
|
|
}, "NotSupportedError", message);
|
|
}
|
|
}
|
|
|
|
finishJSTest();
|
|
}
|
|
|
|
runTest();
|
|
successfullyParsed = true;
|
|
</script>
|
|
</body>
|
|
</html>
|