reactor::sdk alone brings in no audio library, no device enumeration and none of this.
Speaker
Plays what arrives on a recvonly audio track.
Definition
InvalidStateError if the track is not a recvonly audio
track — a speaker on anything else would play nothing, forever, without saying why.
Neither copyable nor movable: the device callback holds a pointer to it.
start() / stop()
Signature
stop() is safe to call from a handler.
The device is opened on the first frame rather than in start(), because its sample rate and
channel count come from the audio itself — guessing them and reopening on the first mismatch is
audible.
dropped_ms() / under_runs()
Signature
Speaker is a jitter buffer, and that is the whole design: audio arrives in ~10
ms frames on the library’s thread, and a playback device asks for samples on its clock. Neither
waits for the other, so the buffer absorbs the difference — and when it cannot, the two failure
modes are worth telling apart.
A single “glitches” counter would hide which of the two you have.
submit()
Signature
Microphone
Captures from a real microphone and pushes into a published sendonly track.
Definition
Microphone opens no device, and start() is the
only thing that does. Throws InvalidStateError if the track is not a sendonly audio track.
The track has to be published before
start(). Publishing is
what puts a sender behind the slot, and a push before it is refused rather than dropped — which is
what blocks_refused() counts.blocks_sent() / blocks_refused()
Signature
blocks_refused() climbing with blocks_sent() stuck at zero means the track was never
published.
devices_available()
Signature
false in a build made without the audio backend — the
classes above then throw on start() rather than silently playing nothing.