dB calculator: add floor value (default -100.0dB) when argument is 0

This commit is contained in:
f4exb 2016-12-15 21:27:13 +01:00
parent 330db19163
commit 5571e01a65
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@
#include "util/db.h" #include "util/db.h"
#include <cmath> #include <cmath>
Real CalcDb::dbPower(Real magsq) Real CalcDb::dbPower(Real magsq, Real floordB)
{ {
if (magsq > 0) if (magsq > 0)
{ {
@ -25,6 +25,6 @@ Real CalcDb::dbPower(Real magsq)
} }
else else
{ {
return 0; return floordB;
} }
} }

View File

@ -22,7 +22,7 @@
class CalcDb class CalcDb
{ {
public: public:
static Real dbPower(Real magsq); static Real dbPower(Real magsq, Real floordB = -100.0f);
}; };
#endif /* INCLUDE_UTIL_DB_H_ */ #endif /* INCLUDE_UTIL_DB_H_ */