#[non_exhaustive]
pub struct CompressorBuilder { pub threshold: Value<f64>, pub ratio: Value<f64>, pub attack_duration: Value<Duration>, pub release_duration: Value<Duration>, pub makeup_gain: Value<f64>, pub mix: Value<f64>, }
Expand description

Configures a compressor.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§threshold: Value<f64>

The volume above which volume will start to be decreased (in dBFS).

§ratio: Value<f64>

How much the signal will be compressed.

A ratio of 2.0 (or 2 to 1) means an increase of 3dB will become an increase of 1.5dB. Ratios between 0.0 and 1.0 will actually expand the audio.

§attack_duration: Value<Duration>

How much time it takes for the volume attenuation to ramp up once the input volume exceeds the threshold.

§release_duration: Value<Duration>

How much time it takes for the volume attenuation to relax once the input volume dips below the threshold.

§makeup_gain: Value<f64>

The amount to change the volume after processing (in dB).

This can be used to compensate for the decrease in volume resulting from compression. This is only applied to the wet signal, nto the dry signal.

§mix: Value<f64>

How much dry (unprocessed) signal should be blended with the wet (processed) signal. 0.0 means only the dry signal will be heard. 1.0 means only the wet signal will be heard.

Implementations§

source§

impl CompressorBuilder

source

pub fn new() -> Self

Creates a new CompressorBuilder with the default settings.

source

pub fn threshold(self, threshold: impl Into<Value<f64>>) -> Self

Sets the volume above which volume will start to be decreased (in dBFS).

source

pub fn ratio(self, ratio: impl Into<Value<f64>>) -> Self

Sets how much the signal will be compressed.

A ratio of 2.0 (or 2 to 1) means an increase of 3dB will become an increase of 1.5dB. Ratios between 0.0 and 1.0 will actually expand the audio.

source

pub fn attack_duration( self, attack_duration: impl Into<Value<Duration>> ) -> Self

Sets how much time it takes for the volume attenuation to ramp up once the input volume exceeds the threshold.

source

pub fn release_duration( self, release_duration: impl Into<Value<Duration>> ) -> Self

Sets how much time it takes for the volume attenuation to relax once the input volume dips below the threshold.

source

pub fn makeup_gain(self, makeup_gain: impl Into<Value<f64>>) -> Self

Sets the amount to change the volume after processing (in dB).

This can be used to compensate for the decrease in volume resulting from compression. This is only applied to the wet signal, nto the dry signal.

source

pub fn mix(self, mix: impl Into<Value<f64>>) -> Self

Sets how much dry (unprocessed) signal should be blended with the wet (processed) signal. 0.0 means only the dry signal will be heard. 1.0 means only the wet signal will be heard.

Trait Implementations§

source§

impl Default for CompressorBuilder

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl EffectBuilder for CompressorBuilder

§

type Handle = CompressorHandle

Allows the user to control the effect from gameplay code.
source§

fn build(self) -> (Box<dyn Effect>, Self::Handle)

Creates the effect and a handle to the effect.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,