The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
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_t > | get_vL () const |
std::vector< mha_real_t > | get_vF () const |
Private Attributes | |
unsigned int | num_L |
unsigned int | num_F |
unsigned int | num_channels |
std::vector< mha_real_t > | vL |
std::vector< mha_real_t > | vF |
std::vector< mha_real_t > | vFlog |
std::vector< std::vector< std::vector< mha_real_t > > > | data |
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.
gaintable_t::gaintable_t | ( | const std::vector< mha_real_t > & | LInput, |
const std::vector< mha_real_t > & | FCenter, | ||
unsigned int | channels | ||
) |
Constructor.
LInput | Input level samples, in equivalent LTASS_combined dB SPL. |
FCenter | Frequency samples in Hz (e.g., center frequencies of filterbank). |
channels | Number of audio channels (typically 2). |
gaintable_t::~gaintable_t | ( | ) |
void gaintable_t::update | ( | std::vector< std::vector< std::vector< mha_real_t > > > | newGain | ) |
Update gains from an external table.
newGain | New gain table entries. |
Dimension change is not allowed. The number of entries are checked.
mha_real_t gaintable_t::get_gain | ( | mha_real_t | Lin, |
mha_real_t | Fin, | ||
unsigned int | channel | ||
) |
Read Gain from gain table.
Lin | Input level |
Fin | Input frequency (no match required) |
channel | Audio channel |
mha_real_t gaintable_t::get_gain | ( | mha_real_t | Lin, |
unsigned int | band, | ||
unsigned int | channel | ||
) |
Read Gain from gain table.
Lin | Input level |
band | Input frequency band |
channel | Audio channel |
void gaintable_t::get_gain | ( | const mha_wave_t & | Lin, |
mha_wave_t & | Gain | ||
) |
Read Gains from gain table.
Lin | Input levels. |
Gain | Output gain. |
The number of channels in Lin and Gain must match the number of bands times number of channels in the gaintable.
|
inline |
Return number of frequency bands.
|
inline |
Return number of audio channels.
std::vector< std::vector< mha_real_t > > gaintable_t::get_iofun | ( | ) | const |
Return current input-output function.
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |