[][src]Function aaudio_sys::AAudioStream_read

pub unsafe extern "C" fn AAudioStream_read(
    stream: *mut AAudioStream,
    buffer: *mut c_void,
    num_frames: i32,
    timeout_nanoseconds: i64
) -> i32

Read data from the stream. Returns the number of frames actually read or a negative error.

The call will wait until the read is complete or until it runs out of time. If timeoutNanos is zero then this call will not wait.

Note that timeoutNanoseconds is a relative duration in wall clock time. Time will not stop if the thread is asleep. So it will be implemented using CLOCK_BOOTTIME.

This call is "strong non-blocking" unless it has to wait for data.

If the call times out then zero or a partial frame count will be returned.

Available since API level 26.

Arguments

  • stream - A stream created using AAudioStreamBuilder_openStream().
  • buffer - The address of the first sample.
  • num_frames - Number of frames to read. Only complete frames will be written.
  • timeout_nanoseconds - Maximum number of nanoseconds to wait for completion.