The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research

a signal processing class for spectral data (based on mha_spec_t) More...

Inheritance diagram for MHASignal::spectrum_t:
Inheritance graph

Public Member Functions

 spectrum_t (const unsigned int &frames, const unsigned int &channels)
 constructor of spectrum class More...
 
 spectrum_t (const mha_spec_t &)
 Copy constructor. More...
 
 spectrum_t (const MHASignal::spectrum_t &)
 Copy constructor. More...
 
 spectrum_t (const std::vector< mha_complex_t > &)
 
virtual ~spectrum_t (void)
 
mha_complex_toperator() (unsigned int f, unsigned int ch)
 Access to element. More...
 
mha_complex_toperator[] (unsigned int k)
 Access to a single element, direct index into data buffer. More...
 
mha_complex_tvalue (unsigned int f, unsigned int ch)
 Access to element. More...
 
void copy (const mha_spec_t &)
 copy all elements from a spectrum More...
 
void copy_channel (const mha_spec_t &s, unsigned sch, unsigned dch)
 Copy one channel of a given spectrum signal to a target channel. More...
 
void export_to (mha_spec_t &)
 copy elements to spectrum structure More...
 
void scale (const unsigned int &, const unsigned int &, const unsigned int &, const mha_real_t &)
 scale section [a,b) in channel "ch" by "val" More...
 
void scale_channel (const unsigned int &, const mha_real_t &)
 scale all elements in one channel More...
 

Additional Inherited Members

- Public Attributes inherited from mha_spec_t
mha_complex_tbuf
 signal buffer More...
 
unsigned int num_channels
 number of channels More...
 
unsigned int num_frames
 number of frames in each channel More...
 
mha_channel_info_tchannel_info
 detailed channel description More...
 

Detailed Description

a signal processing class for spectral data (based on mha_spec_t)

Constructor & Destructor Documentation

◆ spectrum_t() [1/4]

spectrum_t::spectrum_t ( const unsigned int &  frames,
const unsigned int &  channels 
)

constructor of spectrum class

Allocates buffers and initializes memory to zeros.

Parameters
framesnumber of frames (fft bins) in one channel. Number of Frames is usually fftlen / 2 + 1
channelsnumber of channels

◆ spectrum_t() [2/4]

spectrum_t::spectrum_t ( const mha_spec_t src)
explicit

Copy constructor.

◆ spectrum_t() [3/4]

spectrum_t::spectrum_t ( const MHASignal::spectrum_t src)

Copy constructor.

◆ spectrum_t() [4/4]

spectrum_t::spectrum_t ( const std::vector< mha_complex_t > &  src)

◆ ~spectrum_t()

spectrum_t::~spectrum_t ( void  )
virtual

Reimplemented in MHA_AC::spectrum_t.

Member Function Documentation

◆ operator()()

mha_complex_t& MHASignal::spectrum_t::operator() ( unsigned int  f,
unsigned int  ch 
)
inline

Access to element.

Parameters
fBin number
chChannel number
Returns
Reference to element

◆ operator[]()

mha_complex_t& MHASignal::spectrum_t::operator[] ( unsigned int  k)
inline

Access to a single element, direct index into data buffer.

Parameters
kBuffer index
Returns
Reference to element

◆ value()

mha_complex_t& MHASignal::spectrum_t::value ( unsigned int  f,
unsigned int  ch 
)
inline

Access to element.

Parameters
fBin number
chChannel number
Returns
Reference to element

◆ copy()

void spectrum_t::copy ( const mha_spec_t src)

copy all elements from a spectrum

Parameters
srcinput spectrum

◆ copy_channel()

void spectrum_t::copy_channel ( const mha_spec_t s,
unsigned  sch,
unsigned  dch 
)

Copy one channel of a given spectrum signal to a target channel.

Parameters
sInput spectrum signal
schChannel index in source signal
dchChannel index in destination (this) signal

◆ export_to()

void spectrum_t::export_to ( mha_spec_t dest)

copy elements to spectrum structure

Parameters
destdestination spectrum structure

◆ scale()

void spectrum_t::scale ( const unsigned int &  a,
const unsigned int &  b,
const unsigned int &  ch,
const mha_real_t val 
)

scale section [a,b) in channel "ch" by "val"

Parameters
astarting frame
bend frame (excluded)
chchannel number
valscale factor

◆ scale_channel()

void spectrum_t::scale_channel ( const unsigned int &  ch,
const mha_real_t src 
)

scale all elements in one channel

Parameters
chchannel number
srcscale factor

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