nicer ration to db20

parent 13249b91
......@@ -132,9 +132,15 @@ double db20_to_ratio(double db) {
return (db == DECIBEL_MINUS_INFINITY ? 0 : pow(10, db/20.0));
}
double ratio_to_db20(double r) {
if (r < 0) ITA_EXCEPT0(INVALID_PARAMETER);
return (r == 0 ? DECIBEL_MINUS_INFINITY : 20*log10(r));
double ratio_to_db20( double r )
{
if( r < 0.0f )
ITA_EXCEPT1( INVALID_PARAMETER, "Conversion to decibel not possible for negative values" );
if( r == 0.0f )
return DECIBEL_MINUS_INFINITY;
else
return 20.0f * log10( r );
}
/* +------------------------------------+
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment