Blink disk+dsp gauges on major errors ( disk out of space or xrun-while-recording )
authorBen Loftis <ben@harrisonconsoles.com>
Wed, 14 Feb 2018 16:26:23 +0000 (10:26 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Wed, 14 Feb 2018 16:26:23 +0000 (10:26 -0600)
gtk2_ardour/ardour_gauge.cc
gtk2_ardour/ardour_gauge.h
gtk2_ardour/ardour_ui.cc
gtk2_ardour/dsp_load_indicator.cc
gtk2_ardour/dsp_load_indicator.h

index db9728662e4281ff9e78a6cbe1474d79e6153d88..809ed7856dab761c7195c6fe883076e9e52d12e5 100644 (file)
@@ -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<Cairo::Context> const& ctx, cairo_rectangle_t*)
 {
@@ -75,7 +82,7 @@ ArdourGauge::render (Cairo::RefPtr<Cairo::Context> 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);
index 7f707d3ae06b520fc41d2fe96f21004fbc26dd43..2a12ee8ce06d816b2d859b70e94405880ff2f4cc 100644 (file)
@@ -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<Cairo::Context> const&, cairo_rectangle_t*);
 
        Glib::RefPtr<Pango::Layout> _layout;
+
+       bool _blink;
 };
 
 #endif
index 37474b498fde13e37451109bbb7715db1277419d..c1ebaac229049773173e781b08ec9d17f8515d0b 100644 (file)
@@ -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);
        }
index 7179c11369e53b40f1c37d721307a400af7be271..d39b610c4a1773438c4cc089300dfb8a6ceef609 100644 (file)
@@ -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;
 }
index bbdc4001508086394dcd204be9b97966dc808b2f..d350d5680df6098ca81bdfb2a61b1931dbc72fba 100644 (file)
@@ -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