From 8dab33c609bdf588aa33cd4e34019f7319f078d6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 7 Dec 2009 14:18:06 +0000 Subject: Route::set_meter_point() is now conceptually RT safe, although it still takes a write lock on the processor list. this allows it to be called when setting rec-enable status on a route. not thoroughly tested, and still incomplete - single route rec-enables should probably use this pathway, and there is still no cross-thread cleanup from an RT route op request git-svn-id: svn://localhost/ardour2/branches/3.0@6320 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/meter.cc | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'libs/ardour/meter.cc') diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 0d3e8e228a..4566ed7e02 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -65,6 +65,12 @@ Metering::update_meters() Meter(); /* EMIT SIGNAL */ } +PeakMeter::PeakMeter (Session& s, const XMLNode& node) + : Processor (s, node) +{ + current_meters = 0; +} + /** Get peaks from @a bufs * Input acceptance is lenient - the first n buffers from @a bufs will * be metered, where n was set by the last call to setup(), excess meters will @@ -115,11 +121,6 @@ PeakMeter::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_fram _active = _pending_active; } -PeakMeter::PeakMeter (Session& s, const XMLNode& node) - : Processor (s, node) -{ -} - void PeakMeter::reset () { @@ -150,7 +151,21 @@ PeakMeter::configure_io (ChanCount in, ChanCount out) return false; } - uint32_t limit = in.n_total(); + current_meters = in.n_total (); + + return Processor::configure_io (in, out); +} + +void +PeakMeter::reflect_inputs (const ChanCount& in) +{ + current_meters = in.n_total (); +} + +void +PeakMeter::reset_max_channels (const ChanCount& chn) +{ + uint32_t limit = chn.n_total(); while (_peak_power.size() > limit) { _peak_power.pop_back(); @@ -167,8 +182,6 @@ PeakMeter::configure_io (ChanCount in, ChanCount out) assert(_peak_power.size() == limit); assert(_visible_peak_power.size() == limit); assert(_max_peak_power.size() == limit); - - return Processor::configure_io (in, out); } /** To be driven by the Meter signal from IO. @@ -185,7 +198,7 @@ PeakMeter::meter () assert(_visible_peak_power.size() == _peak_power.size()); - const size_t limit = _peak_power.size(); + const size_t limit = min (_peak_power.size(), (size_t) current_meters); for (size_t n = 0; n < limit; ++n) { -- cgit v1.2.3