A C++ library mirroring some of the most common Matlab functions.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
mcl::FirFilter Class Reference

#include <firfilter.h>

Inheritance diagram for mcl::FirFilter:

Public Member Functions

 FirFilter () noexcept
 FirFilter (const std::vector< Real > B) noexcept
virtual Real Filter (const Real input_sample) noexcept
virtual void Filter (const Real *__restrict input_data, const Int num_samples, Real *__restrict output_data) noexcept
void SetImpulseResponse (const std::vector< Real > &impulse_response, const Int update_length=0) noexcept
void Reset () noexcept
std::vector< Realimpulse_response () noexcept
virtual ~FirFilter ()
- Public Member Functions inherited from mcl::DigitalFilter
virtual void Filter (const Real *input_data, const Int num_samples, Real *output_data) noexcept
void FilterSerial (const Real *input_data, const Int num_samples, Real *output_data) noexcept
std::vector< RealFilter (const std::vector< Real > &input) noexcept
virtual ~DigitalFilter ()

Static Public Member Functions

static FirFilter GainFilter (const Real gain) noexcept
static bool Test ()
static void SpeedTests ()

Detailed Description

FIR Filter

Constructor & Destructor Documentation

mcl::FirFilter::FirFilter ( )

Constructs a default FIR filter, i.e. identical filter

mcl::FirFilter::FirFilter ( const std::vector< Real B)

Constructs an FIR filter with impulse response B.

virtual mcl::FirFilter::~FirFilter ( )

Member Function Documentation

Real mcl::FirFilter::Filter ( const Real  input_sample)

Returns the output of the filter for an input equal to input. For example, if B=1, A=1, output will be equal to input. As a second example, if B=[0,1], A=[1], you will have (1) Filter(0.5)==0 and then (2) Filter(0.0)==0.5

Implements mcl::DigitalFilter.

void mcl::FirFilter::Filter ( const Real *__restrict  input_data,
const Int  num_samples,
Real *__restrict  output_data 
FirFilter mcl::FirFilter::GainFilter ( const Real  gain)

Constructs a filter for which output==gain*input always.

std::vector< Real > mcl::FirFilter::impulse_response ( )

Returns the impulse response of the filter

void mcl::FirFilter::Reset ( )

Resets the state of the filter

Implements mcl::DigitalFilter.

void mcl::FirFilter::SetImpulseResponse ( const std::vector< Real > &  impulse_response,
const Int  update_length = 0 

Updates the filter coefficients. You can set how long it takes to update the coefficients (using linear interpolation between old and new impulse response). If an update is requested while another is already in progress, the new interpolation will pick up from where the old one left off to avoid audible artifacts.

[in]update_lengthHow many calls to Filter it takes to update the coefficients. A value of 0 means that the update is instantaneous. A call to Filter(const Real input) counts one, just like Filter(const std::vector<Real>& input).
void mcl::FirFilter::SpeedTests ( )
bool mcl::FirFilter::Test ( )


The documentation for this class was generated from the following files: