Trait Backend

Source
pub trait Backend: Send + 'static {
    // Required method
    fn play(
        self: Box<Self>,
        signal: Box<dyn Iterator<Item = f32> + Send>,
        sample_rate: u32,
        num_channels: u16,
        stop_flag: Arc<AtomicBool>,
    ) -> Result<()>;
}
Expand description

Trait for audio playback backends.

Backends receive an iterator of interleaved f32 samples and are responsible for sending them to the audio output device.

Required Methods§

Source

fn play( self: Box<Self>, signal: Box<dyn Iterator<Item = f32> + Send>, sample_rate: u32, num_channels: u16, stop_flag: Arc<AtomicBool>, ) -> Result<()>

Start playback of the given signal.

This method consumes self (via Box<Self>) because backends typically need to move ownership into a background thread.

Implementors§