diff --git a/gtk2_ardour/level_meter.cc b/gtk2_ardour/level_meter.cc index 0035785b61..1a5edc8472 100644 --- a/gtk2_ardour/level_meter.cc +++ b/gtk2_ardour/level_meter.cc @@ -113,7 +113,11 @@ LevelMeter::update_meters () if (n < nmidi) { (*i).meter->set (peak); } else { - (*i).meter->set (log_meter (peak), log_meter(_meter->meter_level(n, MeterPeak))); + if (meter_type == MeterPeak) { + (*i).meter->set (log_meter (peak)); + } else { + (*i).meter->set (log_meter (peak), log_meter(_meter->meter_level(n, MeterPeak))); + } } } } diff --git a/gtk2_ardour/meter_strip.cc b/gtk2_ardour/meter_strip.cc index 53ece6745a..759bdef16a 100644 --- a/gtk2_ardour/meter_strip.cc +++ b/gtk2_ardour/meter_strip.cc @@ -454,7 +454,7 @@ MeterStrip::popup_level_meter_menu (GdkEventButton* ev) _suspend_menu_callbacks = true; add_level_meter_item (items, group, _("Peak"), MeterPeak); - add_level_meter_item (items, group, _("RMS"), MeterKrms); + add_level_meter_item (items, group, _("RMS + Peak"), MeterKrms); m->popup (ev->button, ev->time); _suspend_menu_callbacks = false; diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 50522564d0..3afa68be79 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -2136,7 +2136,7 @@ MixerStrip::popup_level_meter_menu (GdkEventButton* ev) items.push_back (SeparatorElem()); add_level_meter_item_type (items, tgroup, _("Peak"), MeterPeak); - add_level_meter_item_type (items, tgroup, _("RMS"), MeterKrms); + add_level_meter_item_type (items, tgroup, _("RMS + Peak"), MeterKrms); m->popup (ev->button, ev->time); _suspend_menu_callbacks = false; diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc index 4dbb4cd590..4819609878 100644 --- a/libs/gtkmm2ext/fastmeter.cc +++ b/libs/gtkmm2ext/fastmeter.cc @@ -55,6 +55,7 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o, int len, hold_cnt = hold; resized = true; hold_state = 0; + bright_hold = false; current_peak = 0; current_level = 0; last_peak_rect.width = 0; @@ -378,7 +379,6 @@ FastMeter::vertical_expose (GdkEventExpose* ev) //cairo_fill (cr); //resized = false; } - cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height); cairo_clip (cr); @@ -413,11 +413,19 @@ FastMeter::vertical_expose (GdkEventExpose* ev) if (hold_state) { last_peak_rect.x = 1; last_peak_rect.width = pixwidth; - last_peak_rect.y = 1 + pixheight - (gint) floor (pixheight * current_peak); - last_peak_rect.height = min(2, pixheight - last_peak_rect.y); + last_peak_rect.y = max(1, 1 + pixheight - (gint) floor (pixheight * current_peak)); + if (bright_hold) { + last_peak_rect.height = max(0, min(4, pixheight - last_peak_rect.y -1 )); + } else { + last_peak_rect.height = max(0, min(2, pixheight - last_peak_rect.y -1 )); + } cairo_set_source (cr, fgpattern->cobj()); cairo_rectangle (cr, 1, last_peak_rect.y, pixwidth, last_peak_rect.height); + if (bright_hold) { + cairo_fill_preserve (cr); + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.3); + } cairo_fill (cr); } else { @@ -435,25 +443,27 @@ FastMeter::set (float lvl, float peak) { float old_level = current_level; float old_peak = current_peak; - float peak_lvl = peak; - if (peak_lvl == -1) { - peak_lvl = lvl; + if (peak == -1) { + if (lvl >= current_peak) { + current_peak = lvl; + hold_state = hold_cnt; + } + + if (hold_state > 0) { + if (--hold_state == 0) { + current_peak = lvl; + } + } + bright_hold = false; + } else { + current_peak = peak; + hold_state = 1; + bright_hold = true; } current_level = lvl; - if (peak_lvl >= current_peak) { - current_peak = peak_lvl; - hold_state = hold_cnt; - } - - if (hold_state > 0) { - if (--hold_state == 0) { - current_peak = peak_lvl; - } - } - if (current_level == old_level && current_peak == old_peak && hold_state == 0) { return; } @@ -522,6 +532,22 @@ FastMeter::queue_vertical_redraw (const Glib::RefPtr& win, float ol gdk_region_union_with_rect (region, &last_peak_rect); } + if (hold_state && current_peak > 0) { + if (!queue) { + region = gdk_region_new (); + queue = true; + } + rect.x = 1; + rect.y = max(1, 1 + pixheight - (gint) floor (pixheight * current_peak)); + if (bright_hold) { + rect.height = max(0, min(4, pixheight - last_peak_rect.y -1 )); + } else { + rect.height = max(0, min(2, pixheight - last_peak_rect.y -1 )); + } + rect.width = pixwidth; + gdk_region_union_with_rect (region, &rect); + } + if (queue) { gdk_window_invalidate_region (win->gobj(), region, true); } diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h index e16112d557..debe6c1cc7 100644 --- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h +++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h @@ -87,6 +87,7 @@ private: gint request_height; unsigned long hold_cnt; unsigned long hold_state; + bool bright_hold; float current_level; float current_peak; float current_user_level;