pub struct Cic<T, const N: usize> { /* private fields */ }
Expand description
Cascaded integrator comb structure
Order N
where N = 3
is cubic.
Implementations§
Source§impl<T, const N: usize> Cic<T, N>where
T: Num + AddAssign + WrappingAdd + WrappingSub + Pow<usize, Output = T> + Copy + 'static,
u32: AsPrimitive<T>,
impl<T, const N: usize> Cic<T, N>where
T: Num + AddAssign + WrappingAdd + WrappingSub + Pow<usize, Output = T> + Copy + 'static,
u32: AsPrimitive<T>,
Sourcepub const fn order(&self) -> usize
pub const fn order(&self) -> usize
Filter order
- 0: zero order hold
- 1: linear
- 2: quadratic
- 3: cubic interpolation/decimation
etc.
Sourcepub const fn tick(&self) -> bool
pub const fn tick(&self) -> bool
Accepts/provides new slow-rate sample
Interpolator: accepts new input sample Decimator: returns new output sample
Sourcepub fn get_interpolate(&self) -> T
pub fn get_interpolate(&self) -> T
Current interpolator output
Sourcepub fn get_decimate(&self) -> T
pub fn get_decimate(&self) -> T
Current decimator output
Sourcepub const fn gain_log2(&self) -> u32
pub const fn gain_log2(&self) -> u32
Right shift amount
log2(gain())
if gain is a power of two,
otherwise an upper bound.
Sourcepub const fn response_length(&self) -> usize
pub const fn response_length(&self) -> usize
Impulse response length
Sourcepub fn settle_interpolate(&mut self, x: T)
pub fn settle_interpolate(&mut self, x: T)
Establish a settled filter state
Sourcepub fn settle_decimate(&mut self, x: T)
pub fn settle_decimate(&mut self, x: T)
Establish a settled filter state
Unimplemented!
Sourcepub fn interpolate(&mut self, x: Option<T>) -> T
pub fn interpolate(&mut self, x: Option<T>) -> T
Optionally ingest a new low-rate sample and retrieve the next output.
A new sample must be supplied at the correct time (when Cic::tick()
is true)
Trait Implementations§
Auto Trait Implementations§
impl<T, const N: usize> Freeze for Cic<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for Cic<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for Cic<T, N>where
T: Send,
impl<T, const N: usize> Sync for Cic<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for Cic<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for Cic<T, N>where
T: UnwindSafe,
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