AudioStream

actual class AudioStream : AutoCloseable

A platform audio stream for playback or recording.

Lifecycle

A stream moves through the following states:

UNINITIALIZED -> OPEN -> STARTING -> STARTED
-> PAUSING -> PAUSED
-> STOPPING -> STOPPED
CLOSING -> CLOSED

Create a stream via AudioEngine.openStream. The stream starts in the StreamState.OPEN state. Call start to begin audio processing, pause to temporarily halt, stop to end processing, and close to release all resources.

Thread Safety

Stream control methods (start, pause, stop, close) are safe to call from any thread. The write and read methods should be called from a dedicated audio thread or from within an AudioStreamCallback.

actual class AudioStream : <ERROR CLASS> ERROR CLASS: Symbol not found for AutoCloseable

A platform audio stream for playback or recording.

Lifecycle

A stream moves through the following states:

UNINITIALIZED -> OPEN -> STARTING -> STARTED
-> PAUSING -> PAUSED
-> STOPPING -> STOPPED
CLOSING -> CLOSED

Create a stream via AudioEngine.openStream. The stream starts in the StreamState.OPEN state. Call start to begin audio processing, pause to temporarily halt, stop to end processing, and close to release all resources.

Thread Safety

Stream control methods (start, pause, stop, close) are safe to call from any thread. The write and read methods should be called from a dedicated audio thread or from within an AudioStreamCallback.

expect class AudioStream : AutoCloseable

A platform audio stream for playback or recording.

Lifecycle

A stream moves through the following states:

UNINITIALIZED -> OPEN -> STARTING -> STARTED
-> PAUSING -> PAUSED
-> STOPPING -> STOPPED
CLOSING -> CLOSED

Create a stream via AudioEngine.openStream. The stream starts in the StreamState.OPEN state. Call start to begin audio processing, pause to temporarily halt, stop to end processing, and close to release all resources.

Thread Safety

Stream control methods (start, pause, stop, close) are safe to call from any thread. The write and read methods should be called from a dedicated audio thread or from within an AudioStreamCallback.

actual class AudioStream : AutoCloseable

A platform audio stream for playback or recording.

Lifecycle

A stream moves through the following states:

UNINITIALIZED -> OPEN -> STARTING -> STARTED
-> PAUSING -> PAUSED
-> STOPPING -> STOPPED
CLOSING -> CLOSED

Create a stream via AudioEngine.openStream. The stream starts in the StreamState.OPEN state. Call start to begin audio processing, pause to temporarily halt, stop to end processing, and close to release all resources.

Thread Safety

Stream control methods (start, pause, stop, close) are safe to call from any thread. The write and read methods should be called from a dedicated audio thread or from within an AudioStreamCallback.

actual class AudioStream : AutoCloseable

A platform audio stream for playback or recording.

Lifecycle

A stream moves through the following states:

UNINITIALIZED -> OPEN -> STARTING -> STARTED
-> PAUSING -> PAUSED
-> STOPPING -> STOPPED
CLOSING -> CLOSED

Create a stream via AudioEngine.openStream. The stream starts in the StreamState.OPEN state. Call start to begin audio processing, pause to temporarily halt, stop to end processing, and close to release all resources.

Thread Safety

Stream control methods (start, pause, stop, close) are safe to call from any thread. The write and read methods should be called from a dedicated audio thread or from within an AudioStreamCallback.

actual class AudioStream : AutoCloseable

A platform audio stream for playback or recording.

Lifecycle

A stream moves through the following states:

UNINITIALIZED -> OPEN -> STARTING -> STARTED
-> PAUSING -> PAUSED
-> STOPPING -> STOPPED
CLOSING -> CLOSED

Create a stream via AudioEngine.openStream. The stream starts in the StreamState.OPEN state. Call start to begin audio processing, pause to temporarily halt, stop to end processing, and close to release all resources.

Thread Safety

Stream control methods (start, pause, stop, close) are safe to call from any thread. The write and read methods should be called from a dedicated audio thread or from within an AudioStreamCallback.

Properties

Link copied to clipboard

The configuration used to create this stream.

The configuration used to create this stream.

The configuration used to create this stream.

The configuration used to create this stream.

The configuration used to create this stream.

The configuration used to create this stream.

Link copied to clipboard

The effect chain currently attached to this stream, or null if none.

The effect chain currently attached to this stream, or null if none.

The effect chain currently attached to this stream, or null if none.

The effect chain currently attached to this stream, or null if none.

The effect chain currently attached to this stream, or null if none.

The effect chain currently attached to this stream, or null if none.

Link copied to clipboard

Current latency measurements for this stream.

Current latency measurements for this stream.

Current latency measurements for this stream.

Current latency measurements for this stream.

Current latency measurements for this stream.

Current latency measurements for this stream.

Link copied to clipboard
actual val peakLevel: Float

Current peak audio level from the most recently processed callback buffer.

actual val peakLevel: Float

Current peak audio level from the most recently processed callback buffer.

expect val peakLevel: Float

Current peak audio level from the most recently processed callback buffer.

actual val peakLevel: Float

Current peak audio level from the most recently processed callback buffer.

actual val peakLevel: Float

Current peak audio level from the most recently processed callback buffer.

actual val peakLevel: Float

Current peak audio level from the most recently processed callback buffer.

Link copied to clipboard
actual val state: StreamState

The current lifecycle state of this stream.

actual val state: StreamState

The current lifecycle state of this stream.

expect val state: StreamState

The current lifecycle state of this stream.

actual val state: StreamState

The current lifecycle state of this stream.

actual val state: StreamState

The current lifecycle state of this stream.

actual val state: StreamState

The current lifecycle state of this stream.

Functions

Link copied to clipboard
actual open override fun close()

Close the stream and release all associated native resources.

actual open override fun close()

Close the stream and release all associated native resources.

expect open override fun close()

Close the stream and release all associated native resources.

actual open override fun close()

Close the stream and release all associated native resources.

actual open override fun close()

Close the stream and release all associated native resources.

actual open override fun close()

Close the stream and release all associated native resources.

Link copied to clipboard
actual fun pause()

Pause audio processing.

actual fun pause()

Pause audio processing.

expect fun pause()

Pause audio processing.

actual fun pause()

Pause audio processing.

actual fun pause()

Pause audio processing.

actual fun pause()

Pause audio processing.

Link copied to clipboard
actual fun read(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Read audio data from an input stream.

actual fun read(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Push-model read is not supported on Apple platforms.

expect fun read(data: FloatArray, numFrames: Int, timeoutNanos: Long = 0): Int

Read audio data from an input stream.

actual fun read(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Read audio data from an input stream.

actual fun read(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Read audio data from an input stream.

actual fun read(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Read audio data from an input stream.

Link copied to clipboard
actual fun start()

Start audio processing.

actual fun start()

Start audio processing.

expect fun start()

Start audio processing.

actual fun start()

Start audio processing.

actual fun start()

Start audio processing.

actual fun start()

Start audio processing.

Link copied to clipboard
actual fun stop()

Stop audio processing.

actual fun stop()

Stop audio processing.

expect fun stop()

Stop audio processing.

actual fun stop()

Stop audio processing.

actual fun stop()

Stop audio processing.

actual fun stop()

Stop audio processing.

Link copied to clipboard
actual fun write(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Write audio data to an output stream.

actual fun write(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Push-model write is not supported on Apple platforms.

expect fun write(data: FloatArray, numFrames: Int, timeoutNanos: Long = 0): Int

Write audio data to an output stream.

actual fun write(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Write audio data to an output stream.

actual fun write(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Write audio data to an output stream.

actual fun write(data: FloatArray, numFrames: Int, timeoutNanos: Long): Int

Write audio data to an output stream.