Struct oboe::AudioStreamSync

source ·
pub struct AudioStreamSync<D, F> { /* private fields */ }
Expand description

The audio stream for synchronous (blocking) mode

Trait Implementations§

source§

impl<F: IsFrameType> AudioInputStreamSync for AudioStreamSync<Input, F>

§

type FrameType = F

source§

fn read( &mut self, buffer: &mut [<Self::FrameType as IsFrameType>::Type], timeout_nanoseconds: i64 ) -> Result<i32>

Read data into the supplied buffer from the stream. This method will block until the read is complete or it runs out of time. Read more
source§

impl<F: IsFrameType> AudioOutputStreamSync for AudioStreamSync<Output, F>

§

type FrameType = F

source§

fn write( &mut self, buffer: &[<Self::FrameType as IsFrameType>::Type], timeout_nanoseconds: i64 ) -> Result<i32>

Write data from the supplied buffer into the stream. This method will block until the write is complete or it runs out of time. Read more
source§

impl<D, F> Debug for AudioStreamSync<D, F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<D, F> Drop for AudioStreamSync<D, F>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<D, F> RefUnwindSafe for AudioStreamSync<D, F>

§

impl<D, F> Send for AudioStreamSync<D, F>
where D: Send, F: Send,

§

impl<D, F> Sync for AudioStreamSync<D, F>
where D: Sync, F: Sync,

§

impl<D, F> Unpin for AudioStreamSync<D, F>
where D: Unpin, F: Unpin,

§

impl<D, F> UnwindSafe for AudioStreamSync<D, F>
where D: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AudioInputStreamSafe for T
where T: RawAudioInputStream + RawAudioStream + RawAudioStreamBase,

source§

fn get_frames_read(&mut self) -> i64

The number of audio frames read from the stream. This monotonic counter will never get reset.
source§

impl<T> AudioOutputStream for T
where T: RawAudioOutputStream + RawAudioStream + RawAudioStreamBase,

source§

fn pause_with_timeout(&mut self, timeout_nanoseconds: i64) -> Result<(), Error>

Pause the stream. This will block until the stream has been paused, an error occurs or timeoutNanoseconds has been reached.
source§

fn flush_with_timeout(&mut self, timeout_nanoseconds: i64) -> Result<(), Error>

Flush the stream. This will block until the stream has been flushed, an error occurs or timeoutNanoseconds has been reached.
source§

fn request_pause(&mut self) -> Result<(), Error>

Pause the stream asynchronously. Returns immediately (does not block). Equivalent to calling pause(0).
source§

fn request_flush(&mut self) -> Result<(), Error>

Flush the stream asynchronously. Returns immediately (does not block). Equivalent to calling flush(0).
source§

fn pause(&mut self) -> Status

Pause the stream. This will block until the stream has been paused, an error occurs or timeoutNanoseconds has been reached.
source§

fn flush(&mut self) -> Status

Flush the stream. This will block until the stream has been flushed, an error occurs or timeoutNanoseconds has been reached.
source§

impl<T> AudioOutputStreamSafe for T
where T: RawAudioOutputStream + RawAudioStream + RawAudioStreamBase,

source§

fn get_frames_written(&mut self) -> i64

The number of audio frames written into the stream. This monotonic counter will never get reset.
source§

impl<T> AudioStream for T
where T: RawAudioStream + RawAudioStreamBase,

source§

fn open(&mut self) -> Result<(), Error>

Open a stream based on the current settings. Read more
source§

fn close(&mut self) -> Result<(), Error>

Close the stream and deallocate any resources from the open() call.
source§

fn start_with_timeout(&mut self, timeout_nanoseconds: i64) -> Result<(), Error>

Start the stream. This will block until the stream has been started, an error occurs or timeout_nanoseconds has been reached.
source§

fn stop_with_timeout(&mut self, timeout_nanoseconds: i64) -> Result<(), Error>

Stop the stream. This will block until the stream has been stopped, an error occurs or timeoutNanoseconds has been reached.
source§

fn request_start(&mut self) -> Result<(), Error>

Start the stream asynchronously. Returns immediately (does not block). Equivalent to calling start(0).
source§

fn request_stop(&mut self) -> Result<(), Error>

Stop the stream asynchronously. Returns immediately (does not block). Equivalent to calling stop(0).
source§

fn wait_for_state_change( &mut self, input_state: StreamState, timeout_nanoseconds: i64 ) -> Result<StreamState, Error>

Wait until the stream’s current state no longer matches the input state. The input state is passed to avoid race conditions caused by the state changing between calls. Read more
source§

fn wait_for_available_frames( &mut self, num_frames: i32, timeout_nanoseconds: i64 ) -> Result<i32, Error>

Wait until the stream has a minimum amount of data available in its buffer. This can be used with an EXCLUSIVE MMAP input stream to avoid reading data too close to the DSP write position, which may cause glitches.
source§

fn start(&mut self) -> Status

Start the stream. This will block until the stream has been started, an error occurs or timeout_nanoseconds has been reached.
source§

fn stop(&mut self) -> Status

Stop the stream. This will block until the stream has been stopped, an error occurs or timeoutNanoseconds has been reached.
source§

impl<T> AudioStreamBase for T
where T: RawAudioStreamBase,

source§

fn get_channel_count(&self) -> ChannelCount

Get actual number of channels
source§

fn get_direction(&self) -> Direction

Get actual stream direction Read more
source§

fn get_sample_rate(&self) -> i32

Get the actual sample rate for the stream
source§

fn get_frames_per_callback(&self) -> i32

Get the number of frames in each callback
source§

fn get_format(&self) -> AudioFormat

Get the audio sample format (e.g. F32 or I16)
source§

fn get_buffer_size_in_frames(&self) -> i32

Query the maximum number of frames that can be filled without blocking. If the stream has been closed the last known value will be returned.
source§

fn get_buffer_capacity_in_frames(&self) -> i32

Get the capacity in number of frames
source§

fn get_sharing_mode(&self) -> SharingMode

Get the sharing mode of the stream
source§

fn get_performance_mode(&self) -> PerformanceMode

Get the performance mode of the stream
source§

fn get_device_id(&self) -> i32

Get the device identifier of the stream
source§

fn get_usage(&self) -> Usage

Get the usage for this stream
source§

fn get_content_type(&self) -> ContentType

Get the stream’s content type
source§

fn get_input_preset(&self) -> InputPreset

Get the stream’s input preset
source§

fn get_session_id(&self) -> SessionId

Get the stream’s session ID allocation strategy (None or Allocate)
source§

fn is_channel_conversion_allowed(&self) -> bool

Return true if can convert channel counts to achieve optimal results.
source§

fn is_format_conversion_allowed(&self) -> bool

Return true if Oboe can convert data formats to achieve optimal results.
source§

fn get_sample_rate_conversion_quality(&self) -> SampleRateConversionQuality

Get whether and how Oboe can convert sample rates to achieve optimal results.
source§

impl<T> AudioStreamSafe for T
where T: RawAudioStream + RawAudioStreamBase,

source§

fn set_buffer_size_in_frames( &mut self, requested_frames: i32 ) -> Result<i32, Error>

This can be used to adjust the latency of the buffer by changing the threshold where blocking will occur. By combining this with AudioStreamSafe::get_xrun_count, the latency can be tuned at run-time for each device. Read more
source§

fn get_state(&self) -> StreamState

Query the current state, eg. StreamState::Pausing
source§

fn get_xrun_count(&self) -> Result<i32, Error>

An XRun is an Underrun or an Overrun. During playing, an underrun will occur if the stream is not written in time and the system runs out of valid data. During recording, an overrun will occur if the stream is not read in time and there is no place to put the incoming data so it is discarded. Read more
source§

fn is_xrun_count_supported(&self) -> bool

Returns true if XRun counts are supported on the stream
source§

fn get_frames_per_burst(&mut self) -> i32

Query the number of frames that are read or written by the endpoint at one time.
source§

fn get_bytes_per_sample(&mut self) -> i32

Get the number of bytes per sample. This is calculated using the sample format. For example, a stream using 16-bit integer samples will have 2 bytes per sample. Read more
source§

fn calculate_latency_millis(&mut self) -> Result<f64, Error>

Calculate the latency of a stream based on getTimestamp(). Read more
source§

fn get_timestamp(&mut self, clock_id: i32) -> Result<FrameTimestamp, Error>

Get the estimated time that the frame at frame_position entered or left the audio processing pipeline. Read more
source§

fn get_audio_api(&self) -> AudioApi

Get the underlying audio API which the stream uses.
source§

fn get_available_frames(&mut self) -> Result<i32, Error>

Returns the number of frames of data currently in the buffer
source§

fn get_bytes_per_frame(&mut self) -> i32

Get the number of bytes in each audio frame. This is calculated using the channel count and the sample format. For example, a 2 channel floating point stream will have 2 * 4 = 8 bytes per frame.
source§

fn uses_aaudio(&self) -> bool

Returns true if the underlying audio API is AAudio.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> AudioInputStream for T
where T: RawAudioInputStream + RawAudioStream + RawAudioStreamBase,