Skip to main content

AudioStream

Trait AudioStream 

Source
pub trait AudioStream: Send + 'static {
    // Required method
    fn fill(&mut self, out: &mut [f32]);
}
Expand description

A source of mono samples, produced on demand at its own sample rate.

Implemented for any FnMut(&mut [f32]) + Send + 'static, so a closure that owns a synthesizer or an emulated sound chip can be played directly.

Required Methods§

Source

fn fill(&mut self, out: &mut [f32])

Overwrite out with the next samples in -1.0..=1.0.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> AudioStream for F
where F: FnMut(&mut [f32]) + Send + 'static,