From 78738ec5a10686c30d3cb12ece2fff03957274f0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 11 Jun 2021 18:55:16 -0600 Subject: [PATCH] skeleton for DSP stats GUI --- gtk2_ardour/dsp_stats_ui.cc | 68 +++++++++++++++++++++++++++++++++++++ gtk2_ardour/dsp_stats_ui.h | 45 ++++++++++++++++++++++++ gtk2_ardour/wscript | 1 + 3 files changed, 114 insertions(+) create mode 100644 gtk2_ardour/dsp_stats_ui.cc create mode 100644 gtk2_ardour/dsp_stats_ui.h diff --git a/gtk2_ardour/dsp_stats_ui.cc b/gtk2_ardour/dsp_stats_ui.cc new file mode 100644 index 0000000000..6757f09e85 --- /dev/null +++ b/gtk2_ardour/dsp_stats_ui.cc @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2018 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 "gtkmm2ext/utils.h" + +#include "ardour/session.h" +#include "ardour/audioengine.h" +#include "ardour/audio_backend.h" + +#include "dsp_stats_ui.h" +#include "timers.h" + +#include "pbd/i18n.h" + +using namespace ARDOUR; +using namespace Gtkmm2ext; +using namespace Gtk; + +DspStatisticsGUI::DspStatisticsGUI (Session* s) + : SessionHandlePtr (s) +{ + const size_t nlabels = Session::NTT + AudioEngine::NTT + AudioBackend::NTT; + + labels = new Label*[nlabels]; + for (size_t n = 0; n < nlabels; ++n) { + labels[n] = new Label ("", ALIGN_RIGHT, ALIGN_CENTER); + set_size_request_to_display_given_text (*labels[n], string_compose (_("%1 [ms]"), 99.123), 0, 0); + } + + // attach (*manage (new Gtk::Label (_("Minimum"), ALIGN_RIGHT, ALIGN_CENTER)), + // 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 0); + //attach (_lbl_min, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 0); +} + +void +DspStatisticsGUI::start_updating () +{ + update (); + update_connection = Timers::second_connect (sigc::mem_fun(*this, &DspStatisticsGUI::update)); +} + +void +DspStatisticsGUI::stop_updating () +{ + update_connection.disconnect (); +} + + +void +DspStatisticsGUI::update () +{ +} + diff --git a/gtk2_ardour/dsp_stats_ui.h b/gtk2_ardour/dsp_stats_ui.h new file mode 100644 index 0000000000..8fdf9b901e --- /dev/null +++ b/gtk2_ardour/dsp_stats_ui.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 Paul Davis + * + * 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_dspstats_ui_h_ +#define _gtkardour_dspstats_ui_h_ + +#include +#include +#include + +#include "ardour/session_handle.h" + +class DspStatisticsGUI : public Gtk::Table, public ARDOUR::SessionHandlePtr +{ +public: + DspStatisticsGUI (ARDOUR::Session* s); + + void start_updating (); + void stop_updating (); + +private: + void update (); + + sigc::connection update_connection; + + Gtk::Label** labels; + +}; + +#endif diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 07543ac7ba..0f431d31ed 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -72,6 +72,7 @@ gtk2_ardour_sources = [ 'cursor_context.cc', 'curvetest.cc', 'debug.cc', + 'dsp_stats_ui.cc', 'duplicate_routes_dialog.cc', 'edit_note_dialog.cc', 'editing.cc',