pub trait AudioSource: Send + Sync {
// Required methods
fn sample_rate(&self) -> u32;
fn channels(&self) -> u8;
fn total_samples(&self) -> Option<u64>;
fn read_frame(&mut self, frame_size: usize) -> Result<Option<AudioFrame>>;
fn is_exhausted(&self) -> bool;
fn reset(&mut self) -> Result<()>;
}Expand description
Audio source trait for unified input handling.
Required Methods§
Sourcefn sample_rate(&self) -> u32
fn sample_rate(&self) -> u32
Get the sample rate in Hz.
Sourcefn total_samples(&self) -> Option<u64>
fn total_samples(&self) -> Option<u64>
Get the total number of samples (None for streams).
Sourcefn 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.
Sourcefn is_exhausted(&self) -> bool
fn is_exhausted(&self) -> bool
Check if the source is exhausted.