switch Evoral::Sequence debugging to use DEBUG_TRACE(); Sequence uses multiset<....
[ardour.git] / libs / ardour / meter.cc
index 4566ed7e0255a23bdfd182c98b1be76a8802312b..98c46067c7dfcfb6a5b67de50966ebfc44162937 100644 (file)
@@ -31,45 +31,7 @@ using namespace std;
 
 using namespace ARDOUR;
 
-sigc::signal<void> Metering::Meter;
-Glib::StaticMutex  Metering::m_meter_signal_lock;
-
-sigc::connection
-Metering::connect (sigc::slot<void> the_slot)
-{
-       // SignalProcessor::Meter is emitted from another thread so the
-       // Meter signal must be protected.
-       Glib::Mutex::Lock guard (m_meter_signal_lock);
-       return Meter.connect (the_slot);
-}
-
-void
-Metering::disconnect (sigc::connection& c)
-{
-       Glib::Mutex::Lock guard (m_meter_signal_lock);
-       c.disconnect ();
-}
-
-/**
-    Update the meters.
-
-    The meter signal lock is taken to prevent modification of the
-    Meter signal while updating the meters, taking the meter signal
-    lock prior to taking the io_lock ensures that all IO will remain
-    valid while metering.
-*/
-void
-Metering::update_meters()
-{
-       Glib::Mutex::Lock guard (m_meter_signal_lock);
-       Meter(); /* EMIT SIGNAL */
-}
-
-PeakMeter::PeakMeter (Session& s, const XMLNode& node)
-       : Processor (s, node)
-{
-       current_meters = 0;
-}
+PBD::Signal0<void> Metering::Meter;
 
 /** Get peaks from @a bufs
  * Input acceptance is lenient - the first n buffers from @a bufs will
@@ -151,7 +113,9 @@ PeakMeter::configure_io (ChanCount in, ChanCount out)
                return false;
        }
 
-       current_meters = in.n_total ();
+       current_meters = in;
+
+        reset_max_channels (in);
 
        return Processor::configure_io (in, out);
 }
@@ -159,7 +123,7 @@ PeakMeter::configure_io (ChanCount in, ChanCount out)
 void
 PeakMeter::reflect_inputs (const ChanCount& in)
 {
-       current_meters = in.n_total ();
+       current_meters = in;
 }
 
 void
@@ -198,7 +162,7 @@ PeakMeter::meter ()
 
        assert(_visible_peak_power.size() == _peak_power.size());
 
-       const size_t limit = min (_peak_power.size(), (size_t) current_meters);
+       const size_t limit = min (_peak_power.size(), (size_t) current_meters.n_total ());
 
        for (size_t n = 0; n < limit; ++n) {