The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
MHAFilter::filter_t Class Reference

Generic IIR filter class. More...

Inheritance diagram for MHAFilter::filter_t:
Inheritance graph

Public Member Functions

 filter_t (unsigned int ch, unsigned int lena, unsigned int lenb)
 Constructor. More...
 
 filter_t (unsigned int ch, const std::vector< mha_real_t > &vA, const std::vector< mha_real_t > &vB)
 Constructor with initialization of coefficients. More...
 
 filter_t (const MHAFilter::filter_t &src)
 Copy constructor. More...
 
filter_toperator= (const MHAFilter::filter_t &)=delete
 Assignment operator is not implemented. More...
 
 ~filter_t ()
 
void filter (mha_wave_t *out, const mha_wave_t *in)
 Filter all channels in a waveform structure. More...
 
void filter (mha_real_t *dest, const mha_real_t *src, unsigned int dframes, unsigned int frame_dist, unsigned int channel_dist, unsigned int channel_begin, unsigned int channel_end)
 Filter parts of a waveform structure. More...
 
mha_real_t filter (mha_real_t x, unsigned int ch)
 Filter one sample. More...
 
unsigned int get_len_A () const
 Return length of recursive coefficients. More...
 
unsigned int get_len_B () const
 Return length of non-recursive coefficients. More...
 

Public Attributes

double * A
 Pointer to recursive coefficients. More...
 
double * B
 Pointer to non-recursive coefficients. More...
 

Private Attributes

unsigned int len_A
 
unsigned int len_B
 
unsigned int len
 
unsigned int channels
 
double * state
 

Detailed Description

Generic IIR filter class.

This class implements a generic multichannel IIR filter. It is realized as direct form II. It can work on any float array or on mha_wave_t structs. The filter coefficients can be directly accessed.

Constructor & Destructor Documentation

◆ filter_t() [1/3]

MHAFilter::filter_t::filter_t ( unsigned int  ch,
unsigned int  lena,
unsigned int  lenb 
)

Constructor.

Parameters
chNumber of channels
lenaNumber of recursive coefficients
lenbNumber of non-recursive coefficients

◆ filter_t() [2/3]

MHAFilter::filter_t::filter_t ( unsigned int  ch,
const std::vector< mha_real_t > &  vA,
const std::vector< mha_real_t > &  vB 
)

Constructor with initialization of coefficients.

Parameters
chNumber of channels.
vARecursive coefficients.
vBNon-recursive coefficients.

◆ filter_t() [3/3]

MHAFilter::filter_t::filter_t ( const MHAFilter::filter_t src)

Copy constructor.

◆ ~filter_t()

MHAFilter::filter_t::~filter_t ( )

Member Function Documentation

◆ operator=()

filter_t& MHAFilter::filter_t::operator= ( const MHAFilter::filter_t )
delete

Assignment operator is not implemented.

Use copy constructor instead.

◆ filter() [1/3]

void MHAFilter::filter_t::filter ( mha_wave_t out,
const mha_wave_t in 
)

Filter all channels in a waveform structure.

Parameters
outOutput signal
inInput signal

◆ filter() [2/3]

void MHAFilter::filter_t::filter ( mha_real_t dest,
const mha_real_t src,
unsigned int  dframes,
unsigned int  frame_dist,
unsigned int  channel_dist,
unsigned int  channel_begin,
unsigned int  channel_end 
)

Filter parts of a waveform structure.

Parameters
destOutput signal.
srcInput signal.
dframesNumber of frames to be filtered.
frame_distIndex distance between frames of one channel
channel_distIndex distance between audio channels
channel_beginNumber of first channel to be processed
channel_endNumber of last channel to be processed

◆ filter() [3/3]

mha_real_t MHAFilter::filter_t::filter ( mha_real_t  x,
unsigned int  ch 
)

Filter one sample.

Parameters
xInput value
chChannel number to use in filter state

◆ get_len_A()

unsigned int MHAFilter::filter_t::get_len_A ( ) const
inline

Return length of recursive coefficients.

◆ get_len_B()

unsigned int MHAFilter::filter_t::get_len_B ( ) const
inline

Return length of non-recursive coefficients.

Member Data Documentation

◆ A

double* MHAFilter::filter_t::A

Pointer to recursive coefficients.

◆ B

double* MHAFilter::filter_t::B

Pointer to non-recursive coefficients.

◆ len_A

unsigned int MHAFilter::filter_t::len_A
private

◆ len_B

unsigned int MHAFilter::filter_t::len_B
private

◆ len

unsigned int MHAFilter::filter_t::len
private

◆ channels

unsigned int MHAFilter::filter_t::channels
private

◆ state

double* MHAFilter::filter_t::state
private

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