don't split ringbuffer blocks in the output; this means up to 3ms stay

in the buffer.
This commit is contained in:
Jakob Ketterl 2019-10-20 23:48:49 +02:00
parent dd7d262bd3
commit 7ef0ef0d7c

View File

@ -32,11 +32,11 @@ class OwrxAudioProcessor extends AudioWorkletProcessor {
this.port.start();
}
process(inputs, outputs) {
const samples = Math.min(128, this.remaining());
if (this.remaining() < 128) return true;
outputs[0].forEach((output) => {
output.set(this.audioBuffer.subarray(this.outPos, this.outPos + samples));
output.set(this.audioBuffer.subarray(this.outPos, this.outPos + 128));
});
this.outPos = (this.outPos + samples) % this.bufferSize;
this.outPos = (this.outPos + 128) % this.bufferSize;
return true;
}
remaining() {