13
0

invalidate meter-color cache when midi channel count changes

This fixes a bug of midi-colors being used for audio-meters or
vice versa when when the total channel count remained identical
This commit is contained in:
Robin Gareus 2016-07-22 12:57:14 +02:00
parent 87c38e1a26
commit 43bdfa7197
2 changed files with 6 additions and 2 deletions

View File

@ -51,6 +51,7 @@ LevelMeterBase::LevelMeterBase (Session* s, PBD::EventLoop::InvalidationRecord*
, max_peak (minus_infinity())
, meter_type (MeterPeak)
, visible_meter_type (MeterType(0))
, midi_count (0)
, meter_count (0)
, max_visible_meters (0)
, color_changed (false)
@ -254,7 +255,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
return; /* do it later or never */
}
int32_t nmidi = _meter->input_streams().n_midi();
uint32_t nmidi = _meter->input_streams().n_midi();
uint32_t nmeters = _meter->input_streams().n_total();
regular_meter_width = initial_width;
thin_meter_width = thin_width;
@ -276,6 +277,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
width = rint (width * UIConfiguration::instance().get_ui_scale());
if ( meters.size() > 0
&& nmidi == midi_count
&& nmeters == meter_count
&& meters[0].width == width
&& meters[0].length == len
@ -450,7 +452,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
}
}
}
if (meters[n].width != width || meters[n].length != len || color_changed || meter_type != visible_meter_type) {
if (meters[n].width != width || meters[n].length != len || color_changed || meter_type != visible_meter_type || nmidi != midi_count) {
bool hl = meters[n].meter ? meters[n].meter->get_highlight() : false;
meters[n].packed = false;
delete meters[n].meter;
@ -481,6 +483,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
//show();
color_changed = false;
visible_meter_type = meter_type;
midi_count = nmidi;
meter_count = nmeters;
}

View File

@ -109,6 +109,7 @@ class LevelMeterBase : public ARDOUR::SessionHandlePtr, virtual public sigc::tra
float max_peak;
ARDOUR::MeterType meter_type;
ARDOUR::MeterType visible_meter_type;
uint32_t midi_count;
uint32_t meter_count;
uint32_t max_visible_meters;