X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2FdB.h;h=1a4ed983abd3e5e1014ea6a0f6e5794b6a313657;hb=a373e4cfc80cfc1dc712ecdf8013c18286ce2a6b;hp=abacdfcd29582565cf586a866d6db448cdf1653e;hpb=24727e65befc310f24196d11a56ec7b269977c16;p=ardour.git diff --git a/libs/ardour/ardour/dB.h b/libs/ardour/ardour/dB.h index abacdfcd29..1a4ed983ab 100644 --- a/libs/ardour/ardour/dB.h +++ b/libs/ardour/ardour/dB.h @@ -20,8 +20,13 @@ #ifndef __ardour_dB_h__ #define __ardour_dB_h__ +#include #include "pbd/fastlog.h" +#define GAIN_COEFF_ZERO 0.f +#define GAIN_COEFF_SMALL 0.0000001f //-140dB +#define GAIN_COEFF_UNITY 1.f + static inline float dB_to_coefficient (float dB) { return dB > -318.8f ? pow (10.0f, dB * 0.05f) : 0.0f; } @@ -31,6 +36,7 @@ static inline float fast_coefficient_to_dB (float coeff) { } static inline float accurate_coefficient_to_dB (float coeff) { + if (coeff < 1e-15) return -std::numeric_limits::infinity(); return 20.0f * log10f (coeff); }