BoxStackFilter

Struct BoxStackFilter 

Source
pub struct BoxStackFilter<T: Float> { /* private fields */ }
Expand description

FIR filter made from a stack of BoxFilters.

This filter has a non-negative impulse (monotonic step response), making it useful for smoothing positive-only values.

Implementations§

Source§

impl<T: Float> BoxStackFilter<T>

Source

pub fn new(max_size: usize, layers: usize) -> Self

Create a new box stack filter with the specified maximum size and number of layers

Source

pub fn optimal_ratios(layer_count: usize) -> Vec<f32>

Returns an optimal set of length ratios (heuristic for larger depths)

Source

pub fn layers_to_bandwidth(layers: usize) -> f32

Approximate (optimal) bandwidth for a given number of layers

Source

pub fn layers_to_peak_db(layers: usize) -> f32

Approximate (optimal) peak in the stop-band

Source

pub fn resize(&mut self, max_size: usize, layer_count: usize)

Sets size using an optimal (heuristic at larger sizes) set of length ratios

Source

pub fn resize_with_ratios(&mut self, max_size: usize, ratios: Vec<f32>)

Sets the maximum (and current) impulse response length and explicit length ratios

Source

pub fn set(&mut self, size: usize)

Sets the impulse response length (does not reset if sizemax_size)

Source

pub fn reset(&mut self)

Resets the filter

Source

pub fn process(&mut self, v: T) -> T

Process a sample

Auto Trait Implementations§

§

impl<T> Freeze for BoxStackFilter<T>

§

impl<T> RefUnwindSafe for BoxStackFilter<T>
where T: RefUnwindSafe,

§

impl<T> Send for BoxStackFilter<T>
where T: Send,

§

impl<T> Sync for BoxStackFilter<T>
where T: Sync,

§

impl<T> Unpin for BoxStackFilter<T>
where T: Unpin,

§

impl<T> UnwindSafe for BoxStackFilter<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.