Class: AudioReader

AudioReader()

Receive interleaved audio frames to another thread, wait-free. 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.

Constructor

new AudioReader()

From a RingBuffer, build an object that can dequeue audio in a ring buffer.
Source:

Classes

AudioReader

Methods

available_read()

Query the occupied space in the queue.
Source:
Returns:
The amount of samples that can be read with a guarantee of success.

dequeue(buf)

Attempt to dequeue at most `buf.length` samples from the queue. This returns the number of samples dequeued. If greater than 0, the samples are at the beginning of `buf`. Care should be taken to dequeue a number of samples that is a multiple of the channel count of the audio stream.
Parameters:
Name Type Description
buf Float32Array A buffer in which to copy the dequeued interleaved audio frames.
Source:
Returns:
The number of samples dequeued.