Trait sdr::fir::SampleType [] [src]

pub trait SampleType: Copy {
    type AccType: Zero + Copy;
    type TapType: Num + NumCast + Copy;
    fn tap_sum() -> Self::TapType;
    fn from_acc(acc: Self::AccType) -> Self;
    fn to_acc(x: Self) -> Self::AccType;
    fn tap_delay(tap: Self::TapType, delay: Self::AccType) -> Self::AccType;
    fn scale_acc(acc: Self::AccType, gain: Self::TapType) -> Self;
}

Implement the underlying operations and types required by the FIR.

The FIR is a delay line of AccTypes that is tap_delay()'d by TapTypes, which should add up to tap_sum(), and the input SampleType may be to_acc()'d or from_acc()'d to transform it. Finally the output AccType is turned back into a SampleType scaled against the gain with scale_acc().

In general the AccType should be larger than the SampleType but compatible (i.e. you can add a SampleType to an AccType), while the TapType should always be scalar and is usually the same size as the AccType.

Associated Types

type AccType: Zero + Copy

type TapType: Num + NumCast + Copy

Required Methods

fn tap_sum() -> Self::TapType

fn from_acc(acc: Self::AccType) -> Self

fn to_acc(x: Self) -> Self::AccType

fn tap_delay(tap: Self::TapType, delay: Self::AccType) -> Self::AccType

fn scale_acc(acc: Self::AccType, gain: Self::TapType) -> Self

Implementors