pub struct Saturation { /* private fields */ }Expand description
Tube Saturation processor with configurable drive and mix
When highpass_mode is enabled, only high frequencies (>4kHz) are saturated, creating a more transparent “exciter” effect without muddying the low end.
Configuration is done through the set_* methods; current values can be read
back with Saturation::get_settings. For shared mutable access from another
thread, wrap this in Arc<Mutex<Saturation>>.
Implementations§
Source§impl Saturation
impl Saturation
Sourcepub fn with_type(sat_type: SaturationType) -> Self
pub fn with_type(sat_type: SaturationType) -> Self
Create with specific saturation type
Sourcepub fn set_threshold(&mut self, threshold: f64)
pub fn set_threshold(&mut self, threshold: f64)
Set threshold (0.0 - 1.0)
Sourcepub fn set_input_gain(&mut self, gain_db: f64)
pub fn set_input_gain(&mut self, gain_db: f64)
Set input gain (dB) - applied before saturation
Sourcepub fn set_output_gain(&mut self, gain_db: f64)
pub fn set_output_gain(&mut self, gain_db: f64)
Set output gain (dB) - applied only to saturated samples for compensation
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable/disable saturation
Sourcepub fn set_type(&mut self, sat_type: SaturationType)
pub fn set_type(&mut self, sat_type: SaturationType)
Set saturation type
Sourcepub fn set_highpass_mode(&mut self, enabled: bool)
pub fn set_highpass_mode(&mut self, enabled: bool)
Enable/disable high-pass mode (exciter mode)
Sourcepub fn set_highpass_cutoff(&mut self, hz: f64)
pub fn set_highpass_cutoff(&mut self, hz: f64)
Set high-pass cutoff frequency in Hz
Sourcepub fn set_sample_rate(&mut self, sr: f64)
pub fn set_sample_rate(&mut self, sr: f64)
Update sample rate and recalculate HPF coefficient
Sourcepub fn set_channel_count(&mut self, channels: usize)
pub fn set_channel_count(&mut self, channels: usize)
Pre-size the per-channel HPF state for channels, off the audio thread.
Call this during setup (when the processor is built for a stream) so
process_highpass never resizes hpf_states/prev_inputs on the realtime
audio thread. Defaults keep the stereo size when channels == 0.
Sourcepub fn process_with_channels(&mut self, samples: &mut [f64], channels: usize)
pub fn process_with_channels(&mut self, samples: &mut [f64], channels: usize)
Process interleaved f64 samples with specified channel count
Sourcepub fn process_with_sr(
&mut self,
samples: &mut [f64],
channels: usize,
sample_rate: f64,
)
pub fn process_with_sr( &mut self, samples: &mut [f64], channels: usize, sample_rate: f64, )
Process with explicit sample rate (for cases where SR differs from cached value)
Sourcepub fn get_settings(&self) -> SaturationSettings
pub fn get_settings(&self) -> SaturationSettings
Get current settings as a struct
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Saturation
impl RefUnwindSafe for Saturation
impl Send for Saturation
impl Sync for Saturation
impl Unpin for Saturation
impl UnsafeUnpin for Saturation
impl UnwindSafe for Saturation
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more