ReadOnly

class ReadOnly(aqRef: AudioQueueRef, asbd: AudioStreamBasicDescription, stateRef: StableRef<MacosAudioQueue.ReadOnly.State>) : MacosAudioQueue<MacosAudioQueue.ReadOnly.State>

Constructors

Link copied to clipboard
constructor(aqRef: AudioQueueRef, asbd: AudioStreamBasicDescription, stateRef: StableRef<MacosAudioQueue.ReadOnly.State>)

Types

Link copied to clipboard
class State(var running: Boolean, val channel: Channel<ByteArray>)

Callback-visible state. running mirrors Apple's mIsRunning flag from the Audio Queue Services Programming Guide (Recording Audio, Listing 2-5 / 2-14): the input callback must return without enqueueing when the flag is clear.

Functions

Link copied to clipboard
fun dispose(inImmediate: Boolean = true)

Stops and disposes the aqRef, matching Apple's recording cleanup sequence: clear running → AudioQueueStop(true) → AudioQueueDispose(true).

Link copied to clipboard
fun flush()

Resets the aqRef's decoder state.

Link copied to clipboard
fun pause()

Pauses playing or recording audio.

Link copied to clipboard
fun reset()

Resets the aqRef.

Link copied to clipboard
fun start()

Begins playing or recordings audio.

Link copied to clipboard
fun stop(inImmediate: Boolean = true)

Stops playing or recording audio.

Link copied to clipboard
suspend fun streamTo(dst: SendChannel<ByteArray>)