summaryrefslogtreecommitdiff
path: root/libs/ardour/meter.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-07 14:18:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-07 14:18:06 +0000
commit8dab33c609bdf588aa33cd4e34019f7319f078d6 (patch)
tree0ecf90dda51d0947085ba78206f9188f43e2f2cc /libs/ardour/meter.cc
parent1a447016437727452fdf00e7c762f339c796f736 (diff)
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
Diffstat (limited to 'libs/ardour/meter.cc')
-rw-r--r--libs/ardour/meter.cc31
1 files changed, 22 insertions, 9 deletions
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) {