From d3561e8cf1d5a289ff2ce4a26e4a970437a812d5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 29 Nov 2020 16:55:25 +0100 Subject: Remove flaky DSP load meter This never worked particularly well, and the underlying API is more or less useless with Jack 2. So, just replace it with a dropout counter. --- src/Patchage.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/Patchage.cpp') diff --git a/src/Patchage.cpp b/src/Patchage.cpp index 01eda37..7ce1f07 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -154,7 +154,7 @@ Patchage::Patchage(Options options) , INIT_WIDGET(_menu_normal_font_size) , INIT_WIDGET(_toolbar) , INIT_WIDGET(_clear_load_but) - , INIT_WIDGET(_xrun_progress) + , INIT_WIDGET(_dropouts_label) , INIT_WIDGET(_buf_size_combo) , INIT_WIDGET(_latency_label) , INIT_WIDGET(_legend_alignment) @@ -430,10 +430,16 @@ Patchage::update_load() { #if defined(PATCHAGE_LIBJACK) || defined(HAVE_JACK_DBUS) if (_jack_driver->is_attached()) { - char buf[8]; - snprintf(buf, sizeof(buf), "%u", _jack_driver->get_xruns()); - _xrun_progress->set_text(std::string(buf) + " Dropouts"); - _xrun_progress->set_fraction(_jack_driver->get_max_dsp_load()); + const auto xruns = _jack_driver->get_xruns(); + if (xruns > 0u) { + _dropouts_label->set_text(fmt::format(" Dropouts: {}", xruns)); + _dropouts_label->show(); + _clear_load_but->show(); + } else { + _dropouts_label->set_text(" Dropouts: 0"); + _dropouts_label->hide(); + _clear_load_but->hide(); + } } #endif @@ -549,9 +555,10 @@ void Patchage::clear_load() { #if defined(PATCHAGE_LIBJACK) || defined(HAVE_JACK_DBUS) - _xrun_progress->set_fraction(0.0); + _dropouts_label->set_text(" Dropouts: 0"); + _dropouts_label->hide(); + _clear_load_but->hide(); _jack_driver->reset_xruns(); - _jack_driver->reset_max_dsp_load(); #endif } -- cgit v1.2.1