This repository was archived by the owner on Jun 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathscriptprocessornode-zero-input-channels.html
More file actions
64 lines (56 loc) · 1.98 KB
/
scriptprocessornode-zero-input-channels.html
File metadata and controls
64 lines (56 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
<head>
<title>
scriptprocessornode-zero-input-channels.html
</title>
<script src="../../imported/w3c/web-platform-tests/resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script>
<script src="../resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
let audit = Audit.createTaskRunner();
let sampleRate = 44100.0;
let renderLengthInFrames = 512;
let bufferSize = 512;
audit.define(
{
label: 'test',
description:
'Tests that ScriptProcessorNode accepts 0 input channels'
},
(task, should) => {
let context =
new OfflineAudioContext(1, renderLengthInFrames, sampleRate);
let node;
should(
() => {
node = context.createScriptProcessor(bufferSize, 0, 1);
},
'node = context.createScriptProcessor(bufferSize, 0, 1)')
.notThrow();
let source = context.createBufferSource();
source.buffer = createImpulseBuffer(context, bufferSize);
// The onaudioprocess function doesn't need to do anything. We just
// need the process to start to test that implementation accepts 0
// input channels.
//
// FIXME: check the .inputBuffer attribute of the
// AudioProcessingEvent.
node.onaudioprocess = function(e) {};
source.connect(node);
node.connect(context.destination);
source.start(0);
context.oncomplete = event => {
should(true, 'ScriptProcessorNode accepts 0 input channels')
.beTrue();
task.done();
};
context.startRendering();
});
audit.run();
</script>
</body>
</html>