pub trait AudioSource: Send + Sync {
// Required methods
fn sample_rate(&self) -> u32;
fn channels(&self) -> u16;
fn read(&self, start_frame: u64, output: &mut [f32]) -> usize;
fn duration(&self) -> Option<Duration>;
// Provided methods
fn composition(&self) -> Option<&Timeline> { ... }
fn file_path(&self) -> Option<&Path> { ... }
fn try_read(&self, start_frame: u64, output: &mut [f32]) -> Result<usize> { ... }
}Expand description
A pure, concurrent random-access interleaved PCM source. Repeated reads must not depend on prior requests. Implementations return frames, never samples; EOF/short reads leave the rest of the caller’s buffer silent.
Required Methods§
Sourcefn sample_rate(&self) -> u32
fn sample_rate(&self) -> u32
Native PCM sampling frequency, in frames per second.
Provided Methods§
Sourcefn composition(&self) -> Option<&Timeline>
fn composition(&self) -> Option<&Timeline>
Deferred child mix, resolved by the encoding boundary before PCM queries.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".