13
0

Blink disk+dsp gauges on major errors ( disk out of space or xrun-while-recording )

This commit is contained in:
Ben Loftis 2018-02-14 10:26:23 -06:00
parent df9bb50155
commit f50c839ea8
5 changed files with 36 additions and 2 deletions

View 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);

View 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

View 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);
}

View 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;
}

View 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