Struct Oversampler
pub struct Oversampler { /* private fields */ }Expand description
Oversampling processor that wraps a nonlinear processing function.
Usage:
ⓘ
let mut os = Oversampler::new(OversamplingFactor::X4);
let output = os.process(input, |x| my_nonlinear_fn(x));Implementations§
§impl Oversampler
impl Oversampler
pub fn new(factor: OversamplingFactor) -> Oversampler
pub fn new(factor: OversamplingFactor) -> Oversampler
Create a new oversampler with the given factor.
pub fn factor(&self) -> OversamplingFactor
pub fn factor(&self) -> OversamplingFactor
Get the oversampling factor.
pub fn process<F>(&mut self, input: f64, f: F) -> f64
pub fn process<F>(&mut self, input: f64, f: F) -> f64
Process a single input sample through oversampled nonlinear processing.
The closure f is called once per oversampled sample (so 4 times for
4x oversampling). It should implement the nonlinear operation.
Returns one output sample at the base sample rate.
pub fn reset(&mut self)
pub fn reset(&mut self)
Reset internal filter state.
Trait Implementations§
§impl Clone for Oversampler
impl Clone for Oversampler
§fn clone(&self) -> Oversampler
fn clone(&self) -> Oversampler
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Oversampler
impl RefUnwindSafe for Oversampler
impl Send for Oversampler
impl Sync for Oversampler
impl Unpin for Oversampler
impl UnsafeUnpin for Oversampler
impl UnwindSafe for Oversampler
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