write

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

Write audio data to an output stream.

This method is used in blocking I/O mode (when no AudioStreamCallback was provided). The samples in data are interleaved by channel: for stereo, the layout is [L0, R0, L1, R1, ...].

Return

The number of frames actually written. On Android a negative value is an Oboe error code.

Parameters

data

Float array containing interleaved audio samples to write. The array must contain at least numFrames * channelCount elements.

numFrames

Number of frames to write. One frame contains one sample per channel.

timeoutNanos

Maximum time to wait in nanoseconds for buffer space to become available. Use 0 for non-blocking behavior; Long.MAX_VALUE to block indefinitely. Ignored on JS (cannot block the main thread).

Throws

if push-mode I/O is not supported (Apple, JVM, Linux/Windows native) or if this stream's direction is StreamDirection.INPUT.

if the stream is closed.

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

Push-model write is not supported on Apple platforms.

Apple's AVAudioEngine uses a pull-model via render callbacks (AVAudioSourceNode). Use AudioStreamCallback.onAudioReady instead.

Throws

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

Write audio data to an output stream.

This method is used in blocking I/O mode (when no AudioStreamCallback was provided). The samples in data are interleaved by channel: for stereo, the layout is [L0, R0, L1, R1, ...].

Return

The number of frames actually written. On Android a negative value is an Oboe error code.

Parameters

data

Float array containing interleaved audio samples to write. The array must contain at least numFrames * channelCount elements.

numFrames

Number of frames to write. One frame contains one sample per channel.

timeoutNanos

Maximum time to wait in nanoseconds for buffer space to become available. Use 0 for non-blocking behavior; Long.MAX_VALUE to block indefinitely. Ignored on JS (cannot block the main thread).

Throws

if push-mode I/O is not supported (Apple, JVM, Linux/Windows native) or if this stream's direction is StreamDirection.INPUT.

if the stream is closed.

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

Write audio data to an output stream.

This method is used in blocking I/O mode (when no AudioStreamCallback was provided). The samples in data are interleaved by channel: for stereo, the layout is [L0, R0, L1, R1, ...].

Return

The number of frames actually written. On Android a negative value is an Oboe error code.

Parameters

data

Float array containing interleaved audio samples to write. The array must contain at least numFrames * channelCount elements.

numFrames

Number of frames to write. One frame contains one sample per channel.

timeoutNanos

Maximum time to wait in nanoseconds for buffer space to become available. Use 0 for non-blocking behavior; Long.MAX_VALUE to block indefinitely. Ignored on JS (cannot block the main thread).

Throws

if push-mode I/O is not supported (Apple, JVM, Linux/Windows native) or if this stream's direction is StreamDirection.INPUT.

if the stream is closed.

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

Write audio data to an output stream.

This method is used in blocking I/O mode (when no AudioStreamCallback was provided). The samples in data are interleaved by channel: for stereo, the layout is [L0, R0, L1, R1, ...].

Return

The number of frames actually written. On Android a negative value is an Oboe error code.

Parameters

data

Float array containing interleaved audio samples to write. The array must contain at least numFrames * channelCount elements.

numFrames

Number of frames to write. One frame contains one sample per channel.

timeoutNanos

Maximum time to wait in nanoseconds for buffer space to become available. Use 0 for non-blocking behavior; Long.MAX_VALUE to block indefinitely. Ignored on JS (cannot block the main thread).

Throws

if push-mode I/O is not supported (Apple, JVM, Linux/Windows native) or if this stream's direction is StreamDirection.INPUT.

if the stream is closed.

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

Write audio data to an output stream.

This method is used in blocking I/O mode (when no AudioStreamCallback was provided). The samples in data are interleaved by channel: for stereo, the layout is [L0, R0, L1, R1, ...].

Return

The number of frames actually written. On Android a negative value is an Oboe error code.

Parameters

data

Float array containing interleaved audio samples to write. The array must contain at least numFrames * channelCount elements.

numFrames

Number of frames to write. One frame contains one sample per channel.

timeoutNanos

Maximum time to wait in nanoseconds for buffer space to become available. Use 0 for non-blocking behavior; Long.MAX_VALUE to block indefinitely. Ignored on JS (cannot block the main thread).

Throws

if push-mode I/O is not supported (Apple, JVM, Linux/Windows native) or if this stream's direction is StreamDirection.INPUT.

if the stream is closed.