don't split ringbuffer blocks in the output; this means up to 3ms stay
in the buffer.
This commit is contained in:
parent
dd7d262bd3
commit
7ef0ef0d7c
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user