diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2014-04-27 23:27:13 +0200 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2014-04-27 23:55:08 +0200 |
commit | af0270272d60fb469f13e5c065279221f9295b32 (patch) | |
tree | 390a1b7325adb306700de8d50c7ea61938564197 /src/util | |
parent | bce030e4960a22895563d9960f49b3ba3723bb58 (diff) |
added ratio2db() and db2ratio()
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/math.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/math.h b/src/util/math.h index 3c2f38f33d..eda1f24883 100644 --- a/src/util/math.h +++ b/src/util/math.h @@ -69,4 +69,14 @@ inline int round(double x){ } #endif +template <typename T> +inline const T ratio2db(const T a) { + return log10(a) * 20; +} + +template <typename T> +inline const T db2ratio(const T a) { + return pow(10, a / 20); +} + #endif /* MATH_H */ |