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

Functions

bool is_multiple_of (const unsigned big, const unsigned small)
 
bool is_power_of_two (const unsigned n)
 
bool is_multiple_of_by_power_of_two (const unsigned big, const unsigned small)
 
std::string strip (const std::string &line)
 
std::string remove (const std::string &str_, char c)
 
bool is_denormal (mha_real_t x)
 Get the normal-ness of a mha_real_t. More...
 
bool is_denormal (const mha_complex_t &x)
 Get the normal-ness of a complex number. More...
 
bool is_denormal (const std::complex< mha_real_t > &x)
 Get the normal-ness of a complex number. More...
 
mha_real_t spl2hl (mha_real_t f)
 Get the offset of between dB(SPL) and dB(HL) for a given frequency according to ISO 389-7:2005 (freefield); e.g. More...
 

Function Documentation

◆ is_multiple_of()

bool MHAUtils::is_multiple_of ( const unsigned  big,
const unsigned  small 
)
inline

◆ is_power_of_two()

bool MHAUtils::is_power_of_two ( const unsigned  n)
inline

◆ is_multiple_of_by_power_of_two()

bool MHAUtils::is_multiple_of_by_power_of_two ( const unsigned  big,
const unsigned  small 
)
inline

◆ strip()

std::string MHAUtils::strip ( const std::string &  line)
inline

◆ remove()

std::string MHAUtils::remove ( const std::string &  str_,
char  c 
)
inline

◆ is_denormal() [1/3]

bool MHAUtils::is_denormal ( mha_real_t  x)
inline

Get the normal-ness of a mha_real_t.

Returns true iff x is not equal to zero and the absolute value of x is smaller than the minimum positive normalized value of mha_real_t.

Parameters
xA mha_real_t floating point number
Returns
True if x is denormal, false otherwise

◆ is_denormal() [2/3]

bool MHAUtils::is_denormal ( const mha_complex_t x)
inline

Get the normal-ness of a complex number.

Overload for mha_complex_t. Returns true iff one or both of real and imaginary part are denormal

Parameters
x[in] A mha_complex_t number
Returns
True if at least one component of x is denormal, false otherwise

◆ is_denormal() [3/3]

bool MHAUtils::is_denormal ( const std::complex< mha_real_t > &  x)
inline

Get the normal-ness of a complex number.

Overload for std::complex Returns true iff one or both of real and imaginary part are denormal.

Parameters
x[in] A mha_complex_t number
Returns
True if at least one component of x is denormal, false otherwise

◆ spl2hl()

mha_real_t MHAUtils::spl2hl ( mha_real_t  f)

Get the offset of between dB(SPL) and dB(HL) for a given frequency according to ISO 389-7:2005 (freefield); e.g.

an intensity of 22.1 dB(SPL) at 125 Hz is equivalent to 0 dB(HL), so spl2hl(125)=-22.1. Interpolation between mesh points is linear. The correction values for frequencies above 16 kHz are extrapolated."

Parameters
[in]fThe frequency in Hz for which the offset shall be returned
Returns
The offet between dB(SPL) and dB(HL) at frequency f
Exceptions
MHA_Errorif f<0