diff options
author | Robin Gareus <robin@gareus.org> | 2016-07-22 12:56:55 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-07-22 12:57:24 +0200 |
commit | 87c38e1a269e09b40e8e8866961498c36ce95fbb (patch) | |
tree | 44a7e0a16dbe1980681680b3f168927e24bfeba5 /libs/ardour/meter.cc | |
parent | d53d0faf931314ec180f4236db2dffda21e69071 (diff) |
properly handle meter channel count changes
* reset peak when switching type (audio/midi) or total count
* clamp to +40dBFS to prevent endless falloff for HUGE signals
Diffstat (limited to 'libs/ardour/meter.cc')
-rw-r--r-- | libs/ardour/meter.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index bb6e3eb29c..430306c91a 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -137,11 +137,12 @@ PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_fr // Meter audio in to the rest of the peaks for (uint32_t i = 0; i < n_audio; ++i, ++n) { if (bufs.get_audio(i).silent()) { - ; + _peak_buffer[n] = 0; } else { _peak_buffer[n] = compute_peak (bufs.get_audio(i).data(), nframes, _peak_buffer[n]); + _peak_buffer[n] = std::min (_peak_buffer[n], 100.f); // cut off at +40dBFS for falloff. _max_peak_signal[n] = std::max(_peak_buffer[n], _max_peak_signal[n]); // todo sync reset - _combined_peak =std::max(_peak_buffer[n], _combined_peak); + _combined_peak = std::max(_peak_buffer[n], _combined_peak); } if (do_reset_max) { @@ -236,14 +237,23 @@ PeakMeter::can_support_io_configuration (const ChanCount& in, ChanCount& out) bool PeakMeter::configure_io (ChanCount in, ChanCount out) { + bool changed = false; if (out != in) { // always 1:1 return false; } + if (current_meters != in) { + changed = true; + } + current_meters = in; set_max_channels (in); + if (changed) { + reset_max(); + } + return Processor::configure_io (in, out); } |