X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Flogmeter.h;h=d86150908002bcc60e060ab031cbbe3c084b91b8;hb=25eb9f406960aa8e36ccd90e2cd4397f372bd0fa;hp=f7ed1dd2be2fc3f2580f34af9395712dd59fbee8;hpb=209d967b1bb80a9735d690d8f4f0455ecb9970ca;p=ardour.git diff --git a/gtk2_ardour/logmeter.h b/gtk2_ardour/logmeter.h index f7ed1dd2be..d861509080 100644 --- a/gtk2_ardour/logmeter.h +++ b/gtk2_ardour/logmeter.h @@ -1,15 +1,34 @@ +/* + Copyright (C) 2000-2007 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + #ifndef __ardour_gtk_log_meter_h__ #define __ardour_gtk_log_meter_h__ -#if 0 -inline float +#if 1 +static inline float _log_meter (float power, double lower_db, double upper_db, double non_linearity) { return (power < lower_db ? 0.0 : pow((power-lower_db)/(upper_db-lower_db), non_linearity)); } -inline float -log_meter (float power) +static inline float +alt_log_meter (float power) { return _log_meter (power, -192.0, 0.0, 8.0); } @@ -19,7 +38,7 @@ inline float log_meter (float db) { gfloat def = 0.0f; /* Meter deflection %age */ - + if (db < -70.0f) { def = 0.0f; } else if (db < -60.0f) { @@ -37,8 +56,8 @@ log_meter (float db) } else { def = 115.0f; } - - /* 115 is the deflection %age that would be + + /* 115 is the deflection %age that would be when db=6.0. this is an arbitrary endpoint for our scaling. */