move "logmeter.h" from gtk2_ardour into libs/ardour
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 25 Sep 2016 20:02:16 +0000 (15:02 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Sep 2016 19:59:32 +0000 (14:59 -0500)
gtk2_ardour/export_report.cc
gtk2_ardour/gain_meter.cc
gtk2_ardour/level_meter.cc
gtk2_ardour/logmeter.h [deleted file]
gtk2_ardour/meter_patterns.cc
gtk2_ardour/meter_strip.cc
gtk2_ardour/strip_silence_dialog.cc

index 942e1ddd4229c8986268217cc7765c78520a17ba..67e2f61e7d6700e624a1bcfdfe6a5c7808365ae1 100644 (file)
@@ -36,6 +36,7 @@
 #include "ardour/audioregion.h"
 #include "ardour/auditioner.h"
 #include "ardour/dB.h"
+#include "ardour/logmeter.h"
 #include "ardour/region_factory.h"
 #include "ardour/session.h"
 #include "ardour/smf_source.h"
@@ -44,7 +45,6 @@
 
 #include "audio_clock.h"
 #include "export_report.h"
-#include "logmeter.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
index 55bdf4ce2f7d9daa6f304e3811864eff534971f1..5f0a854e69b1c09599f8dfc57bdfa560973e88e5 100644 (file)
@@ -20,6 +20,7 @@
 #include <limits.h>
 
 #include "ardour/amp.h"
+#include "ardour/logmeter.h"
 #include "ardour/route_group.h"
 #include "ardour/session_route.h"
 #include "ardour/dB.h"
@@ -35,7 +36,6 @@
 #include "pbd/stacktrace.h"
 
 #include "gain_meter.h"
-#include "logmeter.h"
 #include "gui_thread.h"
 #include "keyboard.h"
 #include "public_editor.h"
index 6dd8d0b2d526046bdb07c668212b1fbaad1cc0e9..70e922bdb30625fcd82cf1658e8587026453770c 100644 (file)
 #include <limits.h>
 
 #include "ardour/meter.h"
+#include "ardour/logmeter.h"
 
 #include <gtkmm2ext/utils.h>
 #include "pbd/fastlog.h"
 
 #include "level_meter.h"
 #include "utils.h"
-#include "logmeter.h"
 #include "gui_thread.h"
 #include "keyboard.h"
 #include "public_editor.h"
diff --git a/gtk2_ardour/logmeter.h b/gtk2_ardour/logmeter.h
deleted file mode 100644 (file)
index 9ff60db..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-    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__
-
-#include "ardour/dB.h"
-
-#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));
-}
-
-static inline float
-alt_log_meter (float power)
-{
-       return _log_meter (power, -192.0, 0.0, 8.0);
-}
-#endif
-
-/* prototypes - avoid compiler warning */
-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);
-
-
-
-static 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) {
-                 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 < 6.0f) {
-                 def = (db + 20.0f) * 2.5f + 50.0f;
-         } else {
-                def = 115.0f;
-        }
-
-        /* 115 is the deflection %age that would be
-           when db=6.0. this is an arbitrary
-           endpoint for our scaling.
-        */
-
-         return def/115.0f;
-}
-
-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) {
-               // 2.258 == ((-30 + 32.0)/ 28.0) / 10^(-30 / 20);
-               return (dB_to_coefficient(db) * 2.258769757f);
-       } else {
-               const float rv = (db + 32.0f) / 28.0f;
-               if (rv < 1.0) {
-                       return rv;
-               } else {
-                       return 1.0;
-               }
-       }
-}
-
-static inline float
-meter_deflect_din (float db)
-{
-       float rv = dB_to_coefficient(db);
-       rv = sqrtf (sqrtf (2.3676f * rv)) - 0.1803f;
-       if (rv >= 1.0) {
-               return 1.0;
-       } else {
-               return (rv > 0 ? rv : 0.0);
-       }
-}
-
-static inline float
-meter_deflect_nordic (float db)
-{
-       if (db < -60) {
-               return 0.0;
-       } else {
-               const float rv = (db + 60.0f) / 54.0f;
-               if (rv < 1.0) {
-                       return rv;
-               } else {
-                       return 1.0;
-               }
-       }
-}
-
-static inline float
-meter_deflect_vu (float db)
-{
-       const float rv = 6.77165f * dB_to_coefficient(db);
-       if (rv > 1.0) return 1.0;
-       return rv;
-}
-
-static inline float
-meter_deflect_k (float db, float krange)
-{
-       db+=krange;
-       if (db < -40.0f) {
-               return (dB_to_coefficient(db) * 500.0f / (krange + 45.0f));
-       } else {
-               const float rv = (db + 45.0f) / (krange + 45.0f);
-               if (rv < 1.0) {
-                       return rv;
-               } else {
-                       return 1.0;
-               }
-       }
-}
-
-#endif /* __ardour_gtk_log_meter_h__ */
index ab6b9446d3dd82e10481a4b53d876f21194719d0..5db4482adc1e3cc708e9da3c05d59558c1fe588f 100644 (file)
 #include <gtkmm2ext/utils.h>
 #include <gtkmm2ext/rgb_macros.h>
 
+#include "ardour/logmeter.h"
 #include <ardour/rc_configuration.h>
+
 #include "utils.h"
-#include "logmeter.h"
 #include "meter_patterns.h"
 #include "ui_config.h"
 
index db96a3cb7f7fcc7799e52efcf827d6a922b81f57..a497851fb07fc9bd304491b5a4fb121ed193eede 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <sigc++/bind.h>
 
+#include "ardour/logmeter.h"
 #include "ardour/session.h"
 #include "ardour/route.h"
 #include "ardour/route_group.h"
@@ -34,7 +35,6 @@
 #include <gtkmm2ext/utils.h>
 #include <gtkmm2ext/rgb_macros.h>
 
-#include "logmeter.h"
 #include "gui_thread.h"
 #include "ardour_window.h"
 #include "tooltips.h"
index 823138eb0a0d5f33740bf23826d82b17cd032001..5fa115d69265d9655ddc1d8978a4d09d5f733971 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "ardour/audioregion.h"
 #include "ardour/dB.h"
+#include "ardour/logmeter.h"
 #include "ardour_ui.h"
 
 #include "audio_clock.h"
@@ -33,7 +34,6 @@
 #include "region_view.h"
 #include "rgb_macros.h"
 #include "pbd/i18n.h"
-#include "logmeter.h"
 
 using namespace ARDOUR;
 using namespace std;