pub struct Control { /* private fields */ }Expand description
A cheap, clonable handle to one Sink’s volume and level.
Everything here is a lone atomic, so it is safe to poll from a UI frame loop while the audio thread is mixing.
Implementations§
Source§impl Control
impl Control
Sourcepub fn set_volume(&self, volume: f32)
pub fn set_volume(&self, volume: f32)
Set the playback volume, 0.0 (silent) to 1.0 (unchanged), clamped. A
non-finite volume is ignored rather than clamped, since NaN would ride
the ramp into every sample this sink contributes.
The change ramps in over a few milliseconds rather than landing on one sample, so muting mid-stream does not click. A muted sink keeps consuming its input: this is live audio, so it stays on the timeline instead of queueing up and jumping ahead when it unmutes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Control
impl RefUnwindSafe for Control
impl Send for Control
impl Sync for Control
impl Unpin for Control
impl UnsafeUnpin for Control
impl UnwindSafe for Control
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more