Struct oboe::AudioStreamRef
source · pub struct AudioStreamRef<'s, D> { /* private fields */ }
Expand description
Reference to the audio stream for passing to callbacks
Trait Implementations§
Auto Trait Implementations§
impl<'s, D> RefUnwindSafe for AudioStreamRef<'s, D>where
D: RefUnwindSafe,
impl<'s, D> Send for AudioStreamRef<'s, D>where
D: Send,
impl<'s, D> Sync for AudioStreamRef<'s, D>where
D: Sync,
impl<'s, D> Unpin for AudioStreamRef<'s, D>where
D: Unpin,
impl<'s, D> !UnwindSafe for AudioStreamRef<'s, D>
Blanket Implementations§
source§impl<T> AudioInputStreamSafe for Twhere
T: RawAudioInputStream + RawAudioStream + RawAudioStreamBase,
impl<T> AudioInputStreamSafe for Twhere
T: RawAudioInputStream + RawAudioStream + RawAudioStreamBase,
source§fn get_frames_read(&mut self) -> i64
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 Twhere
T: RawAudioOutputStream + RawAudioStream + RawAudioStreamBase,
impl<T> AudioOutputStream for Twhere
T: RawAudioOutputStream + RawAudioStream + RawAudioStreamBase,
source§fn pause_with_timeout(&mut self, timeout_nanoseconds: i64) -> Result<(), Error>
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>
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>
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>
fn request_flush(&mut self) -> Result<(), Error>
Flush the stream asynchronously. Returns immediately (does not block). Equivalent to calling
flush(0)
.source§impl<T> AudioOutputStreamSafe for Twhere
T: RawAudioOutputStream + RawAudioStream + RawAudioStreamBase,
impl<T> AudioOutputStreamSafe for Twhere
T: RawAudioOutputStream + RawAudioStream + RawAudioStreamBase,
source§fn get_frames_written(&mut self) -> i64
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 Twhere
T: RawAudioStream + RawAudioStreamBase,
impl<T> AudioStream for Twhere
T: RawAudioStream + RawAudioStreamBase,
source§fn open(&mut self) -> Result<(), Error>
fn open(&mut self) -> Result<(), Error>
Open a stream based on the current settings. Read more
source§fn close(&mut self) -> Result<(), Error>
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>
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>
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>
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>
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>
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>
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§impl<T> AudioStreamBase for Twhere
T: RawAudioStreamBase,
impl<T> AudioStreamBase for Twhere
T: RawAudioStreamBase,
source§fn get_channel_count(&self) -> ChannelCount
fn get_channel_count(&self) -> ChannelCount
Get actual number of channels
source§fn get_direction(&self) -> Direction
fn get_direction(&self) -> Direction
Get actual stream direction Read more
source§fn get_sample_rate(&self) -> i32
fn get_sample_rate(&self) -> i32
Get the actual sample rate for the stream
source§fn get_frames_per_callback(&self) -> i32
fn get_frames_per_callback(&self) -> i32
Get the number of frames in each callback
source§fn get_format(&self) -> AudioFormat
fn get_format(&self) -> AudioFormat
Get the audio sample format (e.g. F32 or I16)
source§fn get_buffer_size_in_frames(&self) -> i32
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
fn get_buffer_capacity_in_frames(&self) -> i32
Get the capacity in number of frames
source§fn get_sharing_mode(&self) -> SharingMode
fn get_sharing_mode(&self) -> SharingMode
Get the sharing mode of the stream
source§fn get_performance_mode(&self) -> PerformanceMode
fn get_performance_mode(&self) -> PerformanceMode
Get the performance mode of the stream
source§fn get_device_id(&self) -> i32
fn get_device_id(&self) -> i32
Get the device identifier of the stream
source§fn get_content_type(&self) -> ContentType
fn get_content_type(&self) -> ContentType
Get the stream’s content type
source§fn get_input_preset(&self) -> InputPreset
fn get_input_preset(&self) -> InputPreset
Get the stream’s input preset
source§fn get_session_id(&self) -> SessionId
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
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
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
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 Twhere
T: RawAudioStream + RawAudioStreamBase,
impl<T> AudioStreamSafe for Twhere
T: RawAudioStream + RawAudioStreamBase,
source§fn set_buffer_size_in_frames(
&mut self,
requested_frames: i32
) -> Result<i32, Error>
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 moresource§fn get_state(&self) -> StreamState
fn get_state(&self) -> StreamState
Query the current state, eg.
StreamState::Pausing
source§fn get_xrun_count(&self) -> Result<i32, Error>
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
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
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
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>
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>
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 moresource§fn get_audio_api(&self) -> AudioApi
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>
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
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
fn uses_aaudio(&self) -> bool
Returns true if the underlying audio API is AAudio.
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more