pub struct LowpassState<const N: usize>(pub [i64; N]);Expand description
Lowpass filter state
Tuple Fields§
§0: [i64; N]Trait Implementations§
Source§impl<const N: usize> Clone for LowpassState<N>
impl<const N: usize> Clone for LowpassState<N>
Source§fn clone(&self) -> LowpassState<N>
fn clone(&self) -> LowpassState<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize> Debug for LowpassState<N>
impl<const N: usize> Debug for LowpassState<N>
Source§impl<const N: usize> Default for LowpassState<N>
impl<const N: usize> Default for LowpassState<N>
Source§impl<const N: usize> SplitInplace<i32, LowpassState<N>> for Lowpass<N>
impl<const N: usize> SplitInplace<i32, LowpassState<N>> for Lowpass<N>
Source§impl<const N: usize> SplitProcess<i32, i32, LowpassState<N>> for Lowpass<N>
impl<const N: usize> SplitProcess<i32, i32, LowpassState<N>> for Lowpass<N>
Source§fn process(&self, state: &mut LowpassState<N>, x: i32) -> i32
fn process(&self, state: &mut LowpassState<N>, x: i32) -> i32
The filter configuration Config contains the filter gains.
For the first-order lowpass this is a single element array [k] with
the corner frequency in scaled Q31:
k = pi*(1 << 31)*f0/fn where
f0 is the 3dB corner frequency and
fn is the Nyquist frequency.
The corner frequency is warped in the usual way.
For the second-order lowpass this is [k**2/(1 << 32), -k/q] with q = 1/sqrt(2)
for a Butterworth response.
In addition to the poles at the corner frequency the filters have zeros at Nyquist.
The first-order lowpass works fine and accurate for any positive gain
1 <= k <= (1 << 31) - 1.
The second-order lowpass works and is accurate for
1 << 16 <= k <= q*(1 << 31).
Auto Trait Implementations§
impl<const N: usize> Freeze for LowpassState<N>
impl<const N: usize> RefUnwindSafe for LowpassState<N>
impl<const N: usize> Send for LowpassState<N>
impl<const N: usize> Sync for LowpassState<N>
impl<const N: usize> Unpin for LowpassState<N>
impl<const N: usize> UnwindSafe for LowpassState<N>
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