diff options
author | Carl Hetherington <carl@carlh.net> | 2009-08-22 10:21:39 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-08-22 10:21:39 +0000 |
commit | 970a3a7292287098ab36203d967ea1b1d0ca6117 (patch) | |
tree | ace4afdc4ea8505bdb210d603e6d19c102a9514f /libs | |
parent | 4f3bddf7ef163c3106ba973123cbc657ebaf4b74 (diff) |
Introduce an accurate version of coefficient_to_dB and use it in non speed-critical
code. Fixes mantis 2833.
git-svn-id: svn://localhost/ardour2/branches/3.0@5565 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/dB.h | 6 | ||||
-rw-r--r-- | libs/ardour/meter.cc | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/libs/ardour/ardour/dB.h b/libs/ardour/ardour/dB.h index 6ee6279b12..1b5bb03d1f 100644 --- a/libs/ardour/ardour/dB.h +++ b/libs/ardour/ardour/dB.h @@ -26,8 +26,12 @@ static inline float dB_to_coefficient (float dB) { return dB > -318.8f ? pow (10.0f, dB * 0.05f) : 0.0f; } -static inline float coefficient_to_dB (float coeff) { +static inline float fast_coefficient_to_dB (float coeff) { return 20.0f * fast_log10 (coeff); } +static inline float accurate_coefficient_to_dB (float coeff) { + return 20.0f * log10 (coeff); +} + #endif /* __ardour_dB_h__ */ diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index c8546c8ffa..76d2be262c 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -197,7 +197,7 @@ PeakMeter::meter () /* compute new visible value using falloff */ if (new_peak > 0.0) { - new_peak = coefficient_to_dB (new_peak); + new_peak = fast_coefficient_to_dB (new_peak); } else { new_peak = minus_infinity(); } |