Skip to main content

AudioDevice

Trait AudioDevice 

Source
pub trait AudioDevice: Send + Sync {
    // Required method
    fn open(
        self: Box<Self>,
        mix_bus: Arc<dyn AudioMixBus>,
    ) -> Result<Box<dyn AudioStream>>;
}
Expand description

Factory for an audio output stream.

The device is consumed during AudioDevice::open — backends store their hardware handles inside the returned AudioStream.

Required Methods§

Source

fn open( self: Box<Self>, mix_bus: Arc<dyn AudioMixBus>, ) -> Result<Box<dyn AudioStream>>

Opens the output stream. The backend’s audio callback will pull samples from mix_bus on a dedicated real-time thread.

The returned handle keeps the stream alive for as long as it exists. Dropping the handle stops the stream.

Implementors§