pub struct AudioVolumeHandle { /* private fields */ }Expand description
Thread-safe runtime control for an AudioVolume.
Retaining this handle only keeps the small atomic control state alive; it does not retain the element, its pad, or the pipeline graph.
Implementations§
Source§impl AudioVolumeHandle
impl AudioVolumeHandle
Sourcepub fn set_gain(&self, gain: f32) -> Result<(), AudioVolumeError>
pub fn set_gain(&self, gain: f32) -> Result<(), AudioVolumeError>
Sets a linear gain. The element ramps to the new value using its
configured AudioVolumeOptions::ramp_duration.
Sourcepub fn set_gain_db(&self, gain_db: f32) -> Result<(), AudioVolumeError>
pub fn set_gain_db(&self, gain_db: f32) -> Result<(), AudioVolumeError>
Sets gain in decibels. 0 dB is unity, -6 dB is roughly half
amplitude, and negative infinity is silence.
Sourcepub fn set_muted(&self, muted: bool)
pub fn set_muted(&self, muted: bool)
Enables or disables mute without discarding the configured gain.
pub fn gain(&self) -> f32
pub fn gain_db(&self) -> f32
pub fn is_muted(&self) -> bool
Trait Implementations§
Source§impl Clone for AudioVolumeHandle
impl Clone for AudioVolumeHandle
Source§fn clone(&self) -> AudioVolumeHandle
fn clone(&self) -> AudioVolumeHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AudioVolumeHandle
impl RefUnwindSafe for AudioVolumeHandle
impl Send for AudioVolumeHandle
impl Sync for AudioVolumeHandle
impl Unpin for AudioVolumeHandle
impl UnsafeUnpin for AudioVolumeHandle
impl UnwindSafe for AudioVolumeHandle
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