X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Flogmeter.h;h=9ff60db0c58439b7b01685daf4a56e9485451436;hb=81211a91b1e6ffd77dd31676ffe65c4456aafdd7;hp=c7b18ea6b95acb8eabf8cf578a3e04bff48c9510;hpb=708edd586611c6b1132e4f25be4c2c0865ba4738;p=ardour.git diff --git a/gtk2_ardour/logmeter.h b/gtk2_ardour/logmeter.h index c7b18ea6b9..9ff60db0c5 100644 --- a/gtk2_ardour/logmeter.h +++ b/gtk2_ardour/logmeter.h @@ -20,6 +20,8 @@ #ifndef __ardour_gtk_log_meter_h__ #define __ardour_gtk_log_meter_h__ +#include "ardour/dB.h" + #if 1 static inline float _log_meter (float power, double lower_db, double upper_db, double non_linearity) @@ -35,16 +37,16 @@ alt_log_meter (float power) #endif /* prototypes - avoid compiler warning */ -inline float log_meter (float db); -inline float meter_deflect_ppm (float); -inline float meter_deflect_din (float); -inline float meter_deflect_nordic (float); -inline float meter_deflect_vu (float); -inline float meter_deflect_k (float, float); +static inline float log_meter (float db); +static inline float meter_deflect_ppm (float); +static inline float meter_deflect_din (float); +static inline float meter_deflect_nordic (float); +static inline float meter_deflect_vu (float); +static inline float meter_deflect_k (float, float); -inline float +static inline float log_meter (float db) { gfloat def = 0.0f; /* Meter deflection %age */ @@ -75,7 +77,32 @@ log_meter (float db) return def/115.0f; } -inline float +static inline float +log_meter0dB (float db) +{ + gfloat def = 0.0f; /* Meter deflection %age */ + + if (db < -70.0f) { + def = 0.0f; + } else if (db < -60.0f) { + def = (db + 70.0f) * 0.25f; + } else if (db < -50.0f) { + def = (db + 60.0f) * 0.5f + 2.5f; + } else if (db < -40.0f) { + def = (db + 50.0f) * 0.75f + 7.5f; + } else if (db < -30.0f) { + def = (db + 40.0f) * 1.5f + 15.0f; + } else if (db < -20.0f) { + def = (db + 30.0f) * 2.0f + 30.0f; + } else if (db < 0.0f) { + def = (db + 20.0f) * 2.5f + 50.0f; + } else { + def = 100.0f; + } + return def/100.0f; +} + +static inline float meter_deflect_ppm (float db) { if (db < -30) { @@ -91,7 +118,7 @@ meter_deflect_ppm (float db) } } -inline float +static inline float meter_deflect_din (float db) { float rv = dB_to_coefficient(db); @@ -103,7 +130,7 @@ meter_deflect_din (float db) } } -inline float +static inline float meter_deflect_nordic (float db) { if (db < -60) { @@ -118,7 +145,7 @@ meter_deflect_nordic (float db) } } -inline float +static inline float meter_deflect_vu (float db) { const float rv = 6.77165f * dB_to_coefficient(db); @@ -126,7 +153,7 @@ meter_deflect_vu (float db) return rv; } -inline float +static inline float meter_deflect_k (float db, float krange) { db+=krange;