diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-09-27 06:52:27 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-09-27 06:52:27 +0000 |
commit | ce693248dc297f1e1129da6b0e9b3ef627c72da1 (patch) | |
tree | 4056a568bfe9e80d0c86a225f89c4ccab297d65a /libs/ardour/meter.cc | |
parent | a09bc7ef137dd4851d4276a4ebd1cda4172a98f8 (diff) |
minor optimization tweak for metering
git-svn-id: svn://localhost/ardour2/branches/3.0@3814 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/meter.cc')
-rw-r--r-- | libs/ardour/meter.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 5dee1d9845..b718241333 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -35,12 +35,12 @@ namespace ARDOUR { void PeakMeter::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { - size_t meterable = std::min((size_t)bufs.count().n_total(), _peak_power.size()); - size_t n = 0; + size_t meterable = std::min((size_t)bufs.count().n_total(), _peak_power.size()); + size_t limit = std::min (meterable, bufs.count().n_midi()); // Meter what we have (midi) - for ( ; n < meterable && n < bufs.count().n_midi(); ++n) { + for ( ; n < limit; ++n) { float val = 0; @@ -64,8 +64,10 @@ PeakMeter::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_f } + limit = std::min (meterable, bufs.count().n_audio()); + // Meter what we have (audio) - for ( ; n < meterable && n < bufs.count().n_audio(); ++n) { + for ( ; n < limit; ++n) { _peak_power[n] = compute_peak (bufs.get_audio(n).data(nframes, offset), nframes, _peak_power[n]); } |