explicitly fill buffer with 0s to avoid noise on newer chrome versions

This commit is contained in:
Jakob Ketterl 2020-09-11 00:19:04 +02:00
parent 87ba4ea524
commit 7d509eeb48

View File

@ -33,7 +33,10 @@ class OwrxAudioProcessor extends AudioWorkletProcessor {
this.port.start(); this.port.start();
} }
process(inputs, outputs) { process(inputs, outputs) {
if (this.remaining() < 128) return true; if (this.remaining() < 128) {
outputs[0].forEach(output => output.fill(0));
return true;
}
outputs[0].forEach((output) => { outputs[0].forEach((output) => {
output.set(this.audioBuffer.subarray(this.outPos, this.outPos + 128)); output.set(this.audioBuffer.subarray(this.outPos, this.outPos + 128));
}); });