pub struct GainControl(/* private fields */);Expand description
Thread-safe control for a Gain filter
Implementations§
Source§impl GainControl
impl GainControl
Sourcepub fn set_gain(&mut self, db: f32)
pub fn set_gain(&mut self, db: f32)
Amplify the signal by db decibels
Perceptually linear. Negative values make the signal quieter.
Equivalent to self.set_amplitude_ratio(10.0f32.powf(db / 20.0)).
Sourcepub fn amplitude_ratio(&self) -> f32
pub fn amplitude_ratio(&self) -> f32
Get the current amplitude scaling factor
Sourcepub fn set_amplitude_ratio(&mut self, factor: f32)
pub fn set_amplitude_ratio(&mut self, factor: f32)
Scale the amplitude of the signal directly
This is nonlinear in terms of both perception and power. Most users should prefer
set_gain. Unlike set_gain, this method allows a signal to be completely zeroed out if
needed, or even have its phase inverted with a negative factor.
Auto Trait Implementations§
impl Freeze for GainControl
impl RefUnwindSafe for GainControl
impl Send for GainControl
impl Sync for GainControl
impl Unpin for GainControl
impl UnwindSafe for GainControl
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