interpolation.cc/.h: Spline-Bugfixes: Crash bug at tempos close to 0, wrong calculati...
[ardour.git] / libs / ardour / meter.cc
index ed50479c743de4aadb753a981e591ece8b1c6860..c8546c8ffa20b66ff1d2d8a228d85c5ab8d573d6 100644 (file)
@@ -71,8 +71,12 @@ Metering::update_meters()
  * be set to 0.
  */
 void
-PeakMeter::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+PeakMeter::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes)
 {
+       if (!_active && !_pending_active) {
+               return;
+       }
+
        const uint32_t n_audio = min(_configured_input.n_audio(), bufs.count().n_audio());
        const uint32_t n_midi  = min(_configured_input.n_midi(), bufs.count().n_midi());
        
@@ -107,6 +111,13 @@ PeakMeter::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_f
        for (uint32_t i = n; i < _peak_power.size(); ++i) {
                _peak_power[i] = 0.0f;
        }
+
+       _active = _pending_active;
+}
+
+PeakMeter::PeakMeter (Session& s, const XMLNode& node)
+       : Processor (s, node)
+{
 }
 
 void
@@ -168,6 +179,10 @@ PeakMeter::configure_io (ChanCount in, ChanCount out)
 void
 PeakMeter::meter ()
 {
+       if (!_active) {
+               return;
+       }
+
        assert(_visible_peak_power.size() == _peak_power.size());
 
        const size_t limit = _peak_power.size();
@@ -178,7 +193,7 @@ PeakMeter::meter ()
 
                float new_peak = _peak_power[n]; /* XXX we should use atomic exchange from here ... */
                _peak_power[n] = 0;              /* ... to here */
-               
+
                /* compute new visible value using falloff */
 
                if (new_peak > 0.0) {
@@ -209,3 +224,9 @@ PeakMeter::state (bool full_state)
        return node;
 }
 
+
+bool
+PeakMeter::visible() const
+{
+       return true;
+}