summaryrefslogtreecommitdiffstats
path: root/src/util/math.h
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2017-10-08 21:26:08 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2017-10-08 22:35:00 +0200
commite890e97d91901e107a6b7d32c722236ebdc6edf4 (patch)
treecd92f2831d4d846b2be8e6b7be6900c5c9cb66d7 /src/util/math.h
parent290324f73c7d6e25d448c7537d8e6b2a8027d856 (diff)
Removed fixed -6 db send gain offset, make default send and feedback -3 db instead for a netural default echo
Diffstat (limited to 'src/util/math.h')
-rw-r--r--src/util/math.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util/math.h b/src/util/math.h
index 792209b4f0..29e2bfe7af 100644
--- a/src/util/math.h
+++ b/src/util/math.h
@@ -18,6 +18,7 @@
// after our fpclassify hack
#include <algorithm>
+#include <type_traits>
#include "util/assert.h"
#include "util/fpclassify.h"
@@ -74,11 +75,19 @@ inline double roundToFraction(double value, int denominator) {
template <typename T>
inline const T ratio2db(const T a) {
+ static_assert(std::is_same<float, T>::value ||
+ std::is_same<double, T>::value ||
+ std::is_same<long double, T>::value,
+ "ratio2db works only for floating point types");
return log10(a) * 20;
}
template <typename T>
inline const T db2ratio(const T a) {
+ static_assert(std::is_same<float, T>::value ||
+ std::is_same<double, T>::value ||
+ std::is_same<long double, T>::value,
+ "db2ratio works only for floating point types");
return pow(10, a / 20);
}