From a RingBuffer, build an object that can enqueue enqueue audio in a ring buffer.
Enqueue a buffer of interleaved audio into the ring buffer.
Care should be taken to enqueue a number of samples that is a multiple of the channel count of the audio stream.
An array of interleaved audio frames.
The number of samples that have been successfully written to the
queue. buf
is not written to during this call, so the samples that
haven't been written to the queue are still available.
Send interleaved audio frames to another thread, wait-free.
These classes allow communicating between a non-real time thread (browser main thread or worker) and a real-time thread (in an AudioWorkletProcessor). Write and Reader cannot change role after setup, unless externally synchronized.
GC can happen during the initial construction of this object when hopefully no audio is being output. This depends on how implementations schedule GC passes. After the setup phase no GC is triggered on either side of the queue.