pub struct DeviceStream { /* private fields */ }Expand description
Real-time audio device stream.
Implementations§
Source§impl DeviceStream
impl DeviceStream
Sourcepub fn new(_config: DeviceConfig) -> Result<Self>
pub fn new(_config: DeviceConfig) -> Result<Self>
Create a dummy device stream (for testing without audio device).
Sourcepub fn mock(
sample_rate: u32,
channels: u8,
_sender: Sender<Vec<f32>>,
receiver: Receiver<Vec<f32>>,
) -> Self
pub fn mock( sample_rate: u32, channels: u8, _sender: Sender<Vec<f32>>, receiver: Receiver<Vec<f32>>, ) -> Self
Create a mock stream for testing.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the stream is running.
Trait Implementations§
Source§impl AudioSource for DeviceStream
impl AudioSource for DeviceStream
Source§fn sample_rate(&self) -> u32
fn sample_rate(&self) -> u32
Get the sample rate in Hz.
Source§fn total_samples(&self) -> Option<u64>
fn total_samples(&self) -> Option<u64>
Get the total number of samples (None for streams).
Source§fn read_frame(&mut self, frame_size: usize) -> Result<Option<AudioFrame>>
fn read_frame(&mut self, frame_size: usize) -> Result<Option<AudioFrame>>
Read the next frame of audio.
Source§fn is_exhausted(&self) -> bool
fn is_exhausted(&self) -> bool
Check if the source is exhausted.
Auto Trait Implementations§
impl Freeze for DeviceStream
impl RefUnwindSafe for DeviceStream
impl Send for DeviceStream
impl Sync for DeviceStream
impl Unpin for DeviceStream
impl UnwindSafe for DeviceStream
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.