Struct oddio::GainControl
source · 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 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