read

fun read(output: FloatArray, frames: Int): Int(source)

Decodes up to frames frames into the start of output, interleaved by channel, and returns how many frames were written. Returns fewer than frames only at the end of the file, and 0 once the end has been reached.

Allocates nothing beyond pinning output for the call, so it is safe on the audio thread.

Throws

if frames is negative or output holds fewer than frames * channels values.

if the stream is closed.