-
Notifications
You must be signed in to change notification settings - Fork 169
Closed
Milestone
Description
Consider the following:
// In AudioWorkletProcessor class definition.
process(inputs, outputs, parameters) {
for (let i = 0; i < inputs.length; ++i) {
let inputBuffer = inputs[i];
let inputChannelCount = inputBuffer.channel;
}
for (let o = 0; o < outputs.length; ++o) {
let outputBuffer = outputs[o];
let outputChannelCount = outputBuffer.channel;
}
}
In the example above, what you get from inputChannelCount
is determined by the channel count computing algorithm. (spec) However, what you get for outputChannelCount
is not well-defined.
The simplest approach is making the matching input/output buffers have the same channel count. For example, if inputChannelCount
gives you n, you can expected outputChannelCount
to be n.
Although there are more elegant solutions for this, I am against creating AudioBuffer objects (filling in outputs
every render quantum) in the process
method because that will generate garbages fast and furious.
Metadata
Metadata
Assignees
Labels
No labels