Struct sdr::fir::FIR [] [src]

pub struct FIR<T: SampleType> {
    // some fields omitted
}

FIR filter.

Methods

impl<T: SampleType> FIR<T>
[src]

fn new(taps: &Vec<T::TapType>, decimate: usize) -> FIR<T>

Create a new FIR with the given taps and decimation.

Taps should sum to T::tap_sum() or close to it.

Set decimate=1 for no decimation, decimate=2 for /2, etc.

fn from_gains(n_taps: usize, gains: &Vec<f64>, decimate: usize) -> FIR<T>

Create a new FIR from a number of taps, desired frequency response (a 512-long vector from 0 to Nyquist freq) and decimation.

Set decimate=1 for no decimation, decimate=2 for /2, etc.

fn cic_compensator(n_taps: usize, q: usize, r: usize, decimate: usize) -> FIR<T>

Create a new FIR that compensates for a CIC filter specified by q and r, optionally also cutting off the frequency response after Fs/(2*decimate) and having the FIR decimate by that factor.

Set decimate=1 for no decimation, decimate=2 for /2, etc.

TODO: Does not quite match results obtained in Python, with slightly worse simulated performance. Investigate.

fn taps(&self) -> &Vec<T::TapType>

Return a reference to the filter's taps.

fn process(&mut self, x: &Vec<T>) -> Vec<T>

Process a block of data x, outputting the filtered and possibly decimated data.