diff --git a/gtk2_ardour/ardour_gauge.cc b/gtk2_ardour/ardour_gauge.cc index 7387b86b38..f4877c5f7a 100644 --- a/gtk2_ardour/ardour_gauge.cc +++ b/gtk2_ardour/ardour_gauge.cc @@ -43,7 +43,7 @@ ArdourGauge::on_size_request (Gtk::Requisition* req) int w, h; _layout->get_pixel_size (w, h); - req->width = std::max (req->width, 80 /*std::max (20, w + PADDING) */); + req->width = std::max (req->width, 100 /*std::max (20, w + PADDING) */); req->height = std::max (req->height, std::max (12, h + PADDING)); } diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index c1ebaac229..5a37dc1d85 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1739,22 +1739,10 @@ ARDOUR_UI::update_buffer_load () /* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::resize_text_widgets should also be changed. */ - - if (_session) { - snprintf ( - buf, sizeof (buf), - _("Buffers: p:%" PRIu32 "%% " - "c:%" PRIu32 "%%"), - playback <= 5 ? X_("red") : X_("green"), - playback, - capture <= 5 ? X_("red") : X_("green"), - capture - ); - - buffer_load_label.set_markup (buf); - } else { - buffer_load_label.set_text (""); - } + + uint32_t max_load = std::min ( playback, capture ); + + disk_io_indicator.set_disk_io(max_load); } void diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index a0f6d5f783..12fa270e17 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -76,6 +76,7 @@ #include "ardour_window.h" #include "dsp_load_indicator.h" #include "disk_space_indicator.h" +#include "disk_io_indicator.h" #include "editing.h" #include "enums.h" #include "mini_timeline.h" @@ -491,6 +492,7 @@ private: MiniTimeline mini_timeline; TimeInfoBox* time_info_box; DspLoadIndicator dsp_load_indicator; + DiskIoIndicator disk_io_indicator; DiskSpaceIndicator disk_space_indicator; ArdourWidgets::ArdourVSpacer meterbox_spacer; diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 55d01f3c0c..8f3fed3e93 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -714,7 +714,7 @@ ARDOUR_UI::build_menu_bar () #if 0 hbox->pack_end (cpu_load_label, false, false, 4); #endif - hbox->pack_end (buffer_load_label, false, false, 4); + hbox->pack_end (disk_io_indicator, false, false, 4); hbox->pack_end (sample_rate_label, false, false, 4); hbox->pack_end (timecode_format_label, false, false, 4); hbox->pack_end (format_label, false, false, 4); @@ -733,7 +733,7 @@ ARDOUR_UI::build_menu_bar () _status_bar_visibility.add (&dsp_load_indicator, X_("DSP"), _("DSP"), true); _status_bar_visibility.add (&xrun_label, X_("XRun"), _("X-run"), false); _status_bar_visibility.add (&peak_thread_work_label,X_("Peakfile"), _("Active Peak-file Work"), false); - _status_bar_visibility.add (&buffer_load_label, X_("Buffers"), _("Buffers"), true); + _status_bar_visibility.add (&disk_io_indicator, X_("Buffers"), _("Buffers"), true); _status_bar_visibility.add (&sample_rate_label, X_("Audio"), _("Audio"), true); _status_bar_visibility.add (&timecode_format_label, X_("TCFormat"), _("Timecode Format"), true); _status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), true); diff --git a/gtk2_ardour/disk_io_indicator.cc b/gtk2_ardour/disk_io_indicator.cc new file mode 100644 index 0000000000..3b8c6161a5 --- /dev/null +++ b/gtk2_ardour/disk_io_indicator.cc @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2017 Robin Gareus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "ardour_ui.h" +#include "disk_io_indicator.h" + +#include "ardour/audioengine.h" + +#include "pbd/i18n.h" + +#define PADDING 3 + +DiskIoIndicator::DiskIoIndicator () + : ArdourGauge ("00.0%") + , _disk_io (0) +{ +} + +void +DiskIoIndicator::set_disk_io (const double load) +{ + if (load == _disk_io) { + return; + } + _disk_io = load; + + char buf[64]; + snprintf (buf, sizeof (buf), "Dsk: %.1f%%", _disk_io); + update (std::string (buf)); +} + +float +DiskIoIndicator::level () const { + return (_disk_io / 100.f); +} + +bool +DiskIoIndicator::alert () const +{ + return false; +} + +ArdourGauge::Status +DiskIoIndicator::indicator () const +{ + if (_disk_io < 50) { + return ArdourGauge::Level_CRIT; + } else if (_disk_io < 75) { + return ArdourGauge::Level_WARN; + } else { + return ArdourGauge::Level_OK; + } +} + +std::string +DiskIoIndicator::tooltip_text () +{ + char buf[64]; + + snprintf (buf, sizeof (buf), _("Disk I/O cache: %.1f"), _disk_io); + + return buf; +} diff --git a/gtk2_ardour/disk_io_indicator.h b/gtk2_ardour/disk_io_indicator.h new file mode 100644 index 0000000000..f2b10cd90a --- /dev/null +++ b/gtk2_ardour/disk_io_indicator.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2017 Robin Gareus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __gtkardour_disk_io_indicator_h__ +#define __gtkardour_disk_io_indicator_h__ + +#include + +#include "ardour_gauge.h" + +class DiskIoIndicator : public ArdourGauge +{ +public: + DiskIoIndicator (); + + void set_disk_io (const double load); + +protected: + bool alert () const; + ArdourGauge::Status indicator () const; + float level () const; + std::string tooltip_text (); + +private: + + float _disk_io; +}; + +#endif diff --git a/gtk2_ardour/disk_space_indicator.cc b/gtk2_ardour/disk_space_indicator.cc index 2bc31babce..acdfa56d74 100644 --- a/gtk2_ardour/disk_space_indicator.cc +++ b/gtk2_ardour/disk_space_indicator.cc @@ -44,14 +44,14 @@ DiskSpaceIndicator::set_available_disk_sec (float sec) char buf[64]; if (_sec > 86400) { - update (_(">24h")); + update (_("Rec: >24h")); return; } else if (_sec > 32400 /* 9 hours */) { - snprintf (buf, sizeof (buf), "%.0fh", _sec / 3600.f); + snprintf (buf, sizeof (buf), "Rec: %.0fh", _sec / 3600.f); } else if (_sec > 5940 /* 99 mins */) { - snprintf (buf, sizeof (buf), "%.1fh", _sec / 3600.f); + snprintf (buf, sizeof (buf), "Rec: %.1fh", _sec / 3600.f); } else { - snprintf (buf, sizeof (buf), "%.0fm", _sec / 60.f); + snprintf (buf, sizeof (buf), "Rec: %.0fm", _sec / 60.f); } update (std::string (buf)); } diff --git a/gtk2_ardour/dsp_load_indicator.cc b/gtk2_ardour/dsp_load_indicator.cc index 1149c7d6a5..1def589eee 100644 --- a/gtk2_ardour/dsp_load_indicator.cc +++ b/gtk2_ardour/dsp_load_indicator.cc @@ -52,7 +52,11 @@ DspLoadIndicator::set_dsp_load (const double load) _dsp_load = load; char buf[64]; - snprintf (buf, sizeof (buf), "DSP %.1f%%", _dsp_load); + if (_xrun_count > 0) { + snprintf (buf, sizeof (buf), "DSP: %.1f%% (%d)", _dsp_load, _xrun_count); + } else { + snprintf (buf, sizeof (buf), "DSP: %.1f%%", _dsp_load); + } update (std::string (buf)); } @@ -94,11 +98,11 @@ DspLoadIndicator::tooltip_text () //xruns if (_xrun_count == UINT_MAX) { - snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: ?"), _dsp_load); + snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: ?\nClick to clear xruns."), _dsp_load); } else if (_xrun_count > 9999) { - snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: >10k"), _dsp_load); + snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: >10k\nClick to clear xruns."), _dsp_load); } else { - snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: %u"), _dsp_load, _xrun_count); + snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: %u\nClick to clear xruns."), _dsp_load, _xrun_count); } return buf; diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index a564c3c109..4857ebd89e 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -67,6 +67,7 @@ gtk2_ardour_sources = [ 'debug.cc', 'disk_space_indicator.cc', 'duplicate_routes_dialog.cc', + 'disk_io_indicator.cc', 'dsp_load_indicator.cc', 'edit_note_dialog.cc', 'editing.cc',