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

Gain table class. More...

Public Member Functions

 gaintable_t (const std::vector< mha_real_t > &LInput, const std::vector< mha_real_t > &FCenter, unsigned int channels)
 Constructor. More...
 
 ~gaintable_t ()
 
void update (std::vector< std::vector< std::vector< mha_real_t > > > newGain)
 Update gains from an external table. More...
 
mha_real_t get_gain (mha_real_t Lin, mha_real_t Fin, unsigned int channel)
 Read Gain from gain table. More...
 
mha_real_t get_gain (mha_real_t Lin, unsigned int band, unsigned int channel)
 Read Gain from gain table. More...
 
void get_gain (const mha_wave_t &Lin, mha_wave_t &Gain)
 Read Gains from gain table. More...
 
unsigned int nbands () const
 Return number of frequency bands. More...
 
unsigned int nchannels () const
 Return number of audio channels. More...
 
std::vector< std::vector< mha_real_t > > get_iofun () const
 Return current input-output function. More...
 
std::vector< mha_real_tget_vL () const
 
std::vector< mha_real_tget_vF () const
 

Private Attributes

unsigned int num_L
 
unsigned int num_F
 
unsigned int num_channels
 
std::vector< mha_real_tvL
 
std::vector< mha_real_tvF
 
std::vector< mha_real_tvFlog
 
std::vector< std::vector< std::vector< mha_real_t > > > data
 

Detailed Description

Gain table class.

This gain table is intended to efficient table lookup, i.e, interpolation of levels, and optional interpolation of frequencies. Sample input levels and sample frequencies are given in the constructor. The gain entries can be updated with the update() member function via a gain prescription rule from an auditory profile.

Constructor & Destructor Documentation

◆ gaintable_t()

gaintable_t::gaintable_t ( const std::vector< mha_real_t > &  LInput,
const std::vector< mha_real_t > &  FCenter,
unsigned int  channels 
)

Constructor.

Parameters
LInputInput level samples, in equivalent LTASS_combined dB SPL.
FCenterFrequency samples in Hz (e.g., center frequencies of filterbank).
channelsNumber of audio channels (typically 2).

◆ ~gaintable_t()

gaintable_t::~gaintable_t ( )

Member Function Documentation

◆ update()

void gaintable_t::update ( std::vector< std::vector< std::vector< mha_real_t > > >  newGain)

Update gains from an external table.

Parameters
newGainNew gain table entries.

Dimension change is not allowed. The number of entries are checked.

◆ get_gain() [1/3]

mha_real_t gaintable_t::get_gain ( mha_real_t  Lin,
mha_real_t  Fin,
unsigned int  channel 
)

Read Gain from gain table.

Parameters
LinInput level
FinInput frequency (no match required)
channelAudio channel

◆ get_gain() [2/3]

mha_real_t gaintable_t::get_gain ( mha_real_t  Lin,
unsigned int  band,
unsigned int  channel 
)

Read Gain from gain table.

Parameters
LinInput level
bandInput frequency band
channelAudio channel

◆ get_gain() [3/3]

void gaintable_t::get_gain ( const mha_wave_t Lin,
mha_wave_t Gain 
)

Read Gains from gain table.

Parameters
LinInput levels.
GainOutput gain.

The number of channels in Lin and Gain must match the number of bands times number of channels in the gaintable.

◆ nbands()

unsigned int DynComp::gaintable_t::nbands ( ) const
inline

Return number of frequency bands.

◆ nchannels()

unsigned int DynComp::gaintable_t::nchannels ( ) const
inline

Return number of audio channels.

◆ get_iofun()

std::vector< std::vector< mha_real_t > > gaintable_t::get_iofun ( ) const

Return current input-output function.

◆ get_vL()

std::vector<mha_real_t> DynComp::gaintable_t::get_vL ( ) const
inline

◆ get_vF()

std::vector<mha_real_t> DynComp::gaintable_t::get_vF ( ) const
inline

Member Data Documentation

◆ num_L

unsigned int DynComp::gaintable_t::num_L
private

◆ num_F

unsigned int DynComp::gaintable_t::num_F
private

◆ num_channels

unsigned int DynComp::gaintable_t::num_channels
private

◆ vL

std::vector<mha_real_t> DynComp::gaintable_t::vL
private

◆ vF

std::vector<mha_real_t> DynComp::gaintable_t::vF
private

◆ vFlog

std::vector<mha_real_t> DynComp::gaintable_t::vFlog
private

◆ data

std::vector<std::vector<std::vector<mha_real_t> > > DynComp::gaintable_t::data
private

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