From: Ben Loftis Date: Wed, 14 Feb 2018 16:26:23 +0000 (-0600) Subject: Blink disk+dsp gauges on major errors ( disk out of space or xrun-while-recording ) X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=f50c839ea82308632a51535594859eae3107a01d Blink disk+dsp gauges on major errors ( disk out of space or xrun-while-recording ) --- diff --git a/gtk2_ardour/ardour_gauge.cc b/gtk2_ardour/ardour_gauge.cc index db9728662e..809ed7856d 100644 --- a/gtk2_ardour/ardour_gauge.cc +++ b/gtk2_ardour/ardour_gauge.cc @@ -61,6 +61,13 @@ ArdourGauge::update (std::string const& txt) update (); } +void +ArdourGauge::blink (bool onoff) +{ + _blink = onoff; + queue_draw (); +} + void ArdourGauge::render (Cairo::RefPtr const& ctx, cairo_rectangle_t*) { @@ -75,7 +82,7 @@ ArdourGauge::render (Cairo::RefPtr const& ctx, cairo_rectangle_t Gtkmm2ext::set_source_rgba (cr, base); cairo_fill (cr); - if (alert ()) { + if (alert () && _blink) { Gtkmm2ext::rounded_rectangle (cr, 1, 1, width - 2, height - 2, PADDING + 1); cairo_set_source_rgba (cr, 0.5, 0, 0, 1.0); cairo_fill (cr); diff --git a/gtk2_ardour/ardour_gauge.h b/gtk2_ardour/ardour_gauge.h index 7f707d3ae0..2a12ee8ce0 100644 --- a/gtk2_ardour/ardour_gauge.h +++ b/gtk2_ardour/ardour_gauge.h @@ -29,6 +29,8 @@ public: ArdourGauge (std::string const& max_text = "00.0%"); virtual ~ArdourGauge (); + void blink (bool onoff); + protected: enum Status { @@ -54,6 +56,8 @@ private: void render (Cairo::RefPtr const&, cairo_rectangle_t*); Glib::RefPtr _layout; + + bool _blink; }; #endif diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 37474b498f..c1ebaac229 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2640,6 +2640,9 @@ ARDOUR_UI::blink_handler (bool blink_on) solo_blink (blink_on); audition_blink (blink_on); feedback_blink (blink_on); + + dsp_load_indicator.blink(blink_on); + disk_space_indicator.blink(blink_on); } void @@ -4927,6 +4930,10 @@ ARDOUR_UI::xrun_handler (samplepos_t where) ENSURE_GUI_THREAD (*this, &ARDOUR_UI::xrun_handler, where) + if (_session && _session->actively_recording()) { + dsp_load_indicator.set_xrun_while_recording(); + } + if (_session && Config->get_create_xrun_marker() && _session->actively_recording()) { create_xrun_marker(where); } diff --git a/gtk2_ardour/dsp_load_indicator.cc b/gtk2_ardour/dsp_load_indicator.cc index 7179c11369..d39b610c4a 100644 --- a/gtk2_ardour/dsp_load_indicator.cc +++ b/gtk2_ardour/dsp_load_indicator.cc @@ -19,6 +19,8 @@ #include "ardour_ui.h" #include "dsp_load_indicator.h" +#include "ardour/audioengine.h" + #include "pbd/i18n.h" #define PADDING 3 @@ -27,6 +29,7 @@ DspLoadIndicator::DspLoadIndicator () : ArdourGauge ("00.0%") , _dsp_load (0) , _xrun_count (0) + , _xrun_while_recording (false) { } @@ -61,7 +64,13 @@ DspLoadIndicator::level () const { bool DspLoadIndicator::alert () const { - return _xrun_count > 0; + bool ret = false; + + //xrun while recording + ret |= _xrun_while_recording; + + //engine OFF + ret |= !ARDOUR::AudioEngine::instance()->running(); } ArdourGauge::Status @@ -80,6 +89,8 @@ std::string DspLoadIndicator::tooltip_text () { char buf[64]; + + //xruns if (_xrun_count == UINT_MAX) { snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: ?"), _dsp_load); } else if (_xrun_count > 9999) { @@ -87,6 +98,7 @@ DspLoadIndicator::tooltip_text () } else { snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: %u"), _dsp_load, _xrun_count); } + return buf; } @@ -96,6 +108,7 @@ DspLoadIndicator::on_button_release_event (GdkEventButton *ev) ARDOUR::Session* s = ARDOUR_UI::instance ()->the_session (); if (s) { s->reset_xrun_count (); + _xrun_while_recording = false; } return true; } diff --git a/gtk2_ardour/dsp_load_indicator.h b/gtk2_ardour/dsp_load_indicator.h index bbdc400150..d350d5680d 100644 --- a/gtk2_ardour/dsp_load_indicator.h +++ b/gtk2_ardour/dsp_load_indicator.h @@ -31,6 +31,8 @@ public: void set_xrun_count (const unsigned int xruns); void set_dsp_load (const double load); + void set_xrun_while_recording () {_xrun_while_recording = true;} + protected: bool alert () const; ArdourGauge::Status indicator () const; @@ -42,6 +44,7 @@ private: float _dsp_load; unsigned int _xrun_count; + bool _xrun_while_recording; }; #endif