Skip to main content

AudioEngineHandle

Trait AudioEngineHandle 

Source
pub trait AudioEngineHandle: Send {
    // Required methods
    fn start(&self) -> Result<(), BackendError>;
    fn stop(&self) -> Result<(), BackendError>;
    fn is_running(&self) -> bool;
    fn fade_out(&self);
    fn fade_in(&self) -> Result<(), BackendError>;
    fn is_silent(&self) -> bool;

    // Provided methods
    fn set_sleep_gain(&self, _gain: f32, _snap: bool) { ... }
    fn fade_out_quickly(&self) { ... }
    fn fade_in_quickly(&self) -> Result<(), BackendError> { ... }
    fn period(&self) -> Duration { ... }
    fn lead_in(&self, _frames: u64) { ... }
}
Expand description

Handle to a running audio engine. Start/stop control.

start and stop are immediate. fade_out and fade_in are what pause and resume use: the output ramps rather than cuts, and the unit keeps running through a fade out until is_silent, when it can be stopped.

Required Methods§

Source

fn start(&self) -> Result<(), BackendError>

Source

fn stop(&self) -> Result<(), BackendError>

Source

fn is_running(&self) -> bool

Source

fn fade_out(&self)

Source

fn fade_in(&self) -> Result<(), BackendError>

Ramp back to full volume, starting the unit if it was stopped.

Source

fn is_silent(&self) -> bool

Provided Methods§

Source

fn set_sleep_gain(&self, _gain: f32, _snap: bool)

A sleep timer’s gain on the output, glided to, or with snap taken at once. Nothing where the output has no fader.

Source

fn fade_out_quickly(&self)

fade_out and fade_in over a few milliseconds: the dip a DSP change plays through. As the ordinary ones where the output has no fader.

Source

fn fade_in_quickly(&self) -> Result<(), BackendError>

Source

fn period(&self) -> Duration

How long one render callback lasts: how late a fade can begin after it is asked for. Zero where the output does not say.

Source

fn lead_in(&self, _frames: u64)

Play frames of silence before anything from the ring, without counting them as played. A device that has just changed rate is relocking its clock, and many mute while they do: what is sent then is never heard. Nothing reports when the clock has locked, so the wait is a length of time. Cleared by fade_in.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§