MacosAudioRecordingSession

class MacosAudioRecordingSession(requestedDevice: AudioDevice.Input?, requestedFormat: AudioFormat? = requestedDevice?.formatSupport?.defaultFormat, bufferDurationSec: Double = 0.05, bufferCount: Int = 5) : BaseAudioRecordingSession

macOS implementation for AVAudioRecordingSession using AudioQueue input.

Constructors

Link copied to clipboard
constructor(requestedDevice: AudioDevice.Input?, requestedFormat: AudioFormat? = requestedDevice?.formatSupport?.defaultFormat, bufferDurationSec: Double = 0.05, bufferCount: Int = 5)

Properties

Link copied to clipboard
open override val audioFlow: StateFlow<AudioFlow?>

A flow that emits audio data chunks as ByteArrays while recording.

Link copied to clipboard
open override val state: StateFlow<AudioRecordingSession.State>

A flow that emits the current state of the recording.

Functions

Link copied to clipboard
open suspend override fun pause()

Pauses recording while preserving the captured buffer, the live recording job, and the publicly exposed AudioFlow. Calling resume appends further chunks to the same hot flow, so consumers see one continuous stream.

Link copied to clipboard
open override fun reset()
Link copied to clipboard
open suspend override fun resume()

Resumes a recording previously paused. The buffered chunks from before the pause remain in the audio flow; new chunks are appended to the same hot flow.

Link copied to clipboard
open suspend override fun start()

Starts the recording. Sets the state to RECORDING.

Link copied to clipboard
open override fun stop()

Stops the current recording. Sets the state to STOPPED.