pub trait Stream: Send {
// Required methods
fn sample_rate(&self) -> u32;
fn channels(&self) -> usize;
fn read(&mut self, out: &mut [f32]) -> Result<usize>;
fn seek(&mut self, frame: u64) -> Result<()>;
// Provided method
fn frames(&self) -> Option<u64> { ... }
}Expand description
A source of interleaved frames that a voice plays as it goes.
read runs on the audio thread, so it must not allocate or block.
Required Methods§
fn sample_rate(&self) -> u32
Provided Methods§
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Stream for FileStream
Available on crate feature
mixer only.impl Stream for Synth
Available on crate feature
synth only.A synthesizer plays as a mono or stereo stream. It loops by itself when its
RenderOptions::loops is None; as a voice
loop it can only return to its start.