Struct WdfClipper
pub struct WdfClipper { /* private fields */ }Expand description
WDF processing engine for a Tube-Screamer-style clipping circuit.
Tree topology:
[DiodePair root]
|
SeriesAdaptor
/ \
VoltageSource ParallelAdaptor
(input) / \
Resistor CapacitorThe voltage source injects the input signal. The series adaptor connects it with the parallel RC + diode clipping network. The diode pair at the root provides the nonlinearity.
Implementations§
§impl WdfClipper
impl WdfClipper
pub fn new(
resistance: f64,
capacitance: f64,
diode_model: DiodeModel,
sample_rate: f64,
) -> WdfClipper
pub fn new( resistance: f64, capacitance: f64, diode_model: DiodeModel, sample_rate: f64, ) -> WdfClipper
Create a new WDF clipper circuit.
resistance— clipping resistor value (Ω)capacitance— clipping capacitor value (F)diode_model— diode pair characteristicssample_rate— audio sample rate (Hz)
pub fn process(&mut self, input: f64) -> f64
pub fn process(&mut self, input: f64) -> f64
Process one sample through the WDF tree. Zero allocations.
pub fn set_resistance(&mut self, resistance: f64)
pub fn set_resistance(&mut self, resistance: f64)
Update the clipping resistance in-place without resetting capacitor state. This avoids the discontinuity (click/pop) that occurs when the entire WDF tree is reconstructed on a knob change.
pub fn set_sample_rate(&mut self, fs: f64)
pub fn set_sample_rate(&mut self, fs: f64)
Update port resistances after sample rate change.
pub fn reset(&mut self)
pub fn reset(&mut self)
Reset all state (capacitor memory).
Auto Trait Implementations§
impl Freeze for WdfClipper
impl RefUnwindSafe for WdfClipper
impl Send for WdfClipper
impl Sync for WdfClipper
impl Unpin for WdfClipper
impl UnsafeUnpin for WdfClipper
impl UnwindSafe for WdfClipper
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