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§
fn start(&self) -> Result<(), BackendError>
fn stop(&self) -> Result<(), BackendError>
fn is_running(&self) -> bool
fn fade_out(&self)
Sourcefn fade_in(&self) -> Result<(), BackendError>
fn fade_in(&self) -> Result<(), BackendError>
Ramp back to full volume, starting the unit if it was stopped.
fn is_silent(&self) -> bool
Provided Methods§
Sourcefn set_sleep_gain(&self, _gain: f32, _snap: bool)
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.
Sourcefn fade_out_quickly(&self)
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.
fn fade_in_quickly(&self) -> Result<(), BackendError>
Sourcefn period(&self) -> Duration
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.
Sourcefn lead_in(&self, _frames: u64)
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".