Make Soundcloud upload applicable to any export format.
[ardour.git] / libs / ardour / monitor_processor.cc
index 1125dedc6421d555b4bcb0c1c4106072e8a64803..ed0664786034059ed8c417590d78dc2645f41cdf 100644 (file)
@@ -1,9 +1,28 @@
+/*
+    Copyright (C) 2010 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.
+
+*/
+
 #include "pbd/convert.h"
 #include "pbd/error.h"
+#include "pbd/locale_guard.h"
 #include "pbd/xml++.h"
 
 #include "ardour/amp.h"
-#include "ardour/dB.h"
 #include "ardour/debug.h"
 #include "ardour/audio_buffer.h"
 #include "ardour/monitor_processor.h"
@@ -34,11 +53,14 @@ MonitorProcessor::MonitorProcessor (Session& s)
         , _dim_all_ptr (new MPControl<bool> (false, _("monitor dim"), Controllable::Toggle))
         , _cut_all_ptr (new MPControl<bool> (false, _("monitor cut"), Controllable::Toggle))
         , _mono_ptr (new MPControl<bool> (false, _("monitor mono"), Controllable::Toggle))
-        , _dim_level_ptr (new MPControl<volatile gain_t> /* units in dB */
-                          (-12.0, _("monitor dim level"), Controllable::Flag (0), -20.0f, 0.0f))
-        , _solo_boost_level_ptr (new MPControl<volatile gain_t> /* units in dB */
-                                 (0.0, _("monitor solo boost level"), Controllable::Flag (0), 0.0, 20.0))
-         
+        , _dim_level_ptr (new MPControl<volatile gain_t> 
+                         /* default is -12dB, range is -20dB to 0dB */
+                          (dB_to_coefficient(-12.0), _("monitor dim level"), Controllable::Flag (0), 
+                          dB_to_coefficient(-20.0), dB_to_coefficient (0.0)))
+        , _solo_boost_level_ptr (new MPControl<volatile gain_t> 
+                                /* default is 0dB, range is 0dB to +20dB */
+                                 (dB_to_coefficient(0.0), _("monitor solo boost level"), Controllable::Flag (0), 
+                                 dB_to_coefficient(0.0), dB_to_coefficient(10.0)))
         , _dim_all_control (_dim_all_ptr)
         , _cut_all_control (_cut_all_ptr)
         , _mono_control (_mono_ptr)
@@ -202,6 +224,7 @@ MonitorProcessor::set_state (const XMLNode& node, int version)
 XMLNode&
 MonitorProcessor::state (bool full)
 {
+       LocaleGuard lg (X_("POSIX"));
         XMLNode& node (Processor::state (full));
         char buf[64];
 
@@ -251,12 +274,11 @@ MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /
         gain_t target_gain;
         gain_t dim_level_this_time = _dim_level;
         gain_t global_cut = (_cut_all ? 0.0f : 1.0f);
-        gain_t global_dim = (_dim_all ? dim_level_this_time : 1.0f);
+        gain_t global_dim = (_dim_all ? dim_level_this_time : 1.0);
         gain_t solo_boost;
 
         if (_session.listening() || _session.soloing()) {
-               /* solo boost controller is in dB */
-                solo_boost = dB_to_coefficient (_solo_boost_level);
+                solo_boost = _solo_boost_level;
         } else {
                 solo_boost = 1.0;
         }
@@ -266,11 +288,7 @@ MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /
                 /* don't double-scale by both track dim and global dim coefficients */
 
                 gain_t dim_level = (global_dim == 1.0 ? (_channels[chn]->dim ? dim_level_this_time : 1.0) : 1.0);
-
-               /* dim level is in dB */
-
-               dim_level = dB_to_coefficient (dim_level);
-
+               
                 if (_channels[chn]->soloed) {
                         target_gain = _channels[chn]->polarity * _channels[chn]->cut * dim_level * global_cut * global_dim * solo_boost;
                 } else {
@@ -337,7 +355,7 @@ MonitorProcessor::configure_io (ChanCount in, ChanCount out)
 }
 
 bool
-MonitorProcessor::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
+MonitorProcessor::can_support_io_configuration (const ChanCount& in, ChanCount& out)
 {
        out = in;
        return true;
@@ -493,7 +511,7 @@ MonitorProcessor::ChannelRecord::ChannelRecord (uint32_t chn)
        : current_gain (1.0)
        , cut_ptr (new MPControl<gain_t> (1.0, string_compose (_("cut control %1"), chn), PBD::Controllable::GainLike))
        , dim_ptr (new MPControl<bool> (false, string_compose (_("dim control"), chn), PBD::Controllable::Toggle))
-       , polarity_ptr (new MPControl<gain_t> (1.0, string_compose (_("polarity control"), chn), PBD::Controllable::Toggle))
+       , polarity_ptr (new MPControl<gain_t> (1.0, string_compose (_("polarity control"), chn), PBD::Controllable::Toggle, -1, 1))
        , soloed_ptr (new MPControl<bool> (false, string_compose (_("solo control"), chn), PBD::Controllable::Toggle))
 
        , cut_control (cut_ptr)