13
0

List I/O Plugins in DSP-load window

This commit is contained in:
Robin Gareus 2022-05-06 04:40:26 +02:00
parent a97e910b70
commit d4c15aab3f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 37 additions and 9 deletions

View File

@ -20,8 +20,8 @@
#include <gtkmm/label.h> #include <gtkmm/label.h>
#include <gtkmm/viewport.h> #include <gtkmm/viewport.h>
#include "ardour/io_plug.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/plugin_insert.h"
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
@ -110,6 +110,9 @@ PluginDSPLoadWindow::clear_all_stats ()
for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) { for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) {
(*i)->foreach_processor (sigc::mem_fun (*this, &PluginDSPLoadWindow::clear_processor_stats)); (*i)->foreach_processor (sigc::mem_fun (*this, &PluginDSPLoadWindow::clear_processor_stats));
} }
for (auto const& iop : *_session->io_plugs ()) {
clear_pluginsert_stats (iop);
}
} }
struct DSPLoadSorter struct DSPLoadSorter
@ -185,6 +188,14 @@ PluginDSPLoadWindow::refill_processors ()
); );
} }
_session->IOPluginsChanged.connect (
_route_connections, invalidator (*this), boost::bind (&PluginDSPLoadWindow::refill_processors, this), gui_context()
);
for (auto const& iop : *_session->io_plugs ()) {
add_pluginsert_to_display (iop, iop->is_pre () ? _("I/O Pre") : _("I/O Post"));
}
if (_box.get_children().size() == 0) { if (_box.get_children().size() == 0) {
_box.add (*Gtk::manage (new Gtk::Label (_("No Plugins")))); _box.add (*Gtk::manage (new Gtk::Label (_("No Plugins"))));
_box.show_all (); _box.show_all ();
@ -198,14 +209,22 @@ void
PluginDSPLoadWindow::add_processor_to_display (boost::weak_ptr<Processor> w, std::string const& route_name) PluginDSPLoadWindow::add_processor_to_display (boost::weak_ptr<Processor> w, std::string const& route_name)
{ {
boost::shared_ptr<Processor> p = w.lock (); boost::shared_ptr<Processor> p = w.lock ();
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (p); boost::shared_ptr<PlugInsertBase> pib = boost::dynamic_pointer_cast<PlugInsertBase> (p);
if (!pi || !pi->provides_stats ()) { if (pib) {
add_pluginsert_to_display (pib, route_name);
}
}
void
PluginDSPLoadWindow::add_pluginsert_to_display (boost::shared_ptr<PlugInsertBase> p, std::string const& route_name)
{
if (!p->provides_stats ()) {
return; return;
} }
p->DropReferences.connect (_processor_connections, MISSING_INVALIDATOR, boost::bind (&PluginDSPLoadWindow::refill_processors, this), gui_context()); p->DropReferences.connect (_processor_connections, MISSING_INVALIDATOR, boost::bind (&PluginDSPLoadWindow::refill_processors, this), gui_context());
PluginLoadStatsGui* plsg = new PluginLoadStatsGui (pi); PluginLoadStatsGui* plsg = new PluginLoadStatsGui (p);
std::string name = route_name + " - " + pi->name(); std::string name = route_name + " - " + p->plugin ()->name ();
Gtk::Frame* frame = new Gtk::Frame (name.c_str()); Gtk::Frame* frame = new Gtk::Frame (name.c_str());
frame->add (*Gtk::manage (plsg)); frame->add (*Gtk::manage (plsg));
_box.pack_start (*frame, Gtk::PACK_SHRINK, 2); _box.pack_start (*frame, Gtk::PACK_SHRINK, 2);
@ -218,8 +237,14 @@ void
PluginDSPLoadWindow::clear_processor_stats (boost::weak_ptr<Processor> w) PluginDSPLoadWindow::clear_processor_stats (boost::weak_ptr<Processor> w)
{ {
boost::shared_ptr<Processor> p = w.lock (); boost::shared_ptr<Processor> p = w.lock ();
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (p); boost::shared_ptr<PlugInsertBase> pib = boost::dynamic_pointer_cast<PlugInsertBase> (p);
if (pi) { if (pib) {
pi->clear_stats (); clear_pluginsert_stats (pib);
} }
} }
void
PluginDSPLoadWindow::clear_pluginsert_stats (boost::shared_ptr<PlugInsertBase> pib)
{
pib->clear_stats ();
}

View File

@ -31,6 +31,7 @@
namespace ARDOUR { namespace ARDOUR {
class Processor; class Processor;
class PlugInsertBase;
} }
class PluginLoadStatsGui; class PluginLoadStatsGui;
@ -55,7 +56,9 @@ private:
void clear_all_stats (); void clear_all_stats ();
void sort_by_stats (bool); void sort_by_stats (bool);
void add_processor_to_display (boost::weak_ptr<ARDOUR::Processor>, std::string const&); void add_processor_to_display (boost::weak_ptr<ARDOUR::Processor>, std::string const&);
void add_pluginsert_to_display (boost::shared_ptr<ARDOUR::PlugInsertBase>, std::string const&);
void clear_processor_stats (boost::weak_ptr<ARDOUR::Processor>); void clear_processor_stats (boost::weak_ptr<ARDOUR::Processor>);
void clear_pluginsert_stats (boost::shared_ptr<ARDOUR::PlugInsertBase>);
Gtk::ScrolledWindow _scroller; Gtk::ScrolledWindow _scroller;
Gtk::VBox _box; Gtk::VBox _box;