From 5dd5bf0f706e5912383bf38fcd7635b42fc6ec4a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 28 Oct 2015 04:06:14 +0100 Subject: [PATCH] notify LV2 GUIs about port-changes when loading presets --- gtk2_ardour/lv2_plugin_ui.cc | 15 +++++++++++++++ gtk2_ardour/lv2_plugin_ui.h | 1 + 2 files changed, 16 insertions(+) diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc index 572cdfb671..20f59b5e83 100644 --- a/gtk2_ardour/lv2_plugin_ui.cc +++ b/gtk2_ardour/lv2_plugin_ui.cc @@ -159,6 +159,19 @@ LV2PluginUI::stop_updating(GdkEventAny*) return false; } +void +LV2PluginUI::queue_port_update() +{ + const uint32_t num_ports = _lv2->num_ports(); + for (uint32_t i = 0; i < num_ports; ++i) { + bool ok; + uint32_t port = _lv2->nth_parameter(i, ok); + if (ok) { + _updates.insert (port); + } + } +} + void LV2PluginUI::output_update() { @@ -233,6 +246,8 @@ LV2PluginUI::LV2PluginUI(boost::shared_ptr pi, _ardour_buttons_box.pack_end (add_button, false, false); _ardour_buttons_box.pack_end (_preset_combo, false, false); _ardour_buttons_box.pack_end (_preset_modified, false, false); + + plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&LV2PluginUI::queue_port_update, this), gui_context ()); } void diff --git a/gtk2_ardour/lv2_plugin_ui.h b/gtk2_ardour/lv2_plugin_ui.h index f7f2d99641..da6ffca957 100644 --- a/gtk2_ardour/lv2_plugin_ui.h +++ b/gtk2_ardour/lv2_plugin_ui.h @@ -118,6 +118,7 @@ class LV2PluginUI : public PlugUIBase, public Gtk::VBox bool configure_handler (GdkEventConfigure*); void save_plugin_setting (); void output_update(); + void queue_port_update(); bool is_update_wanted(uint32_t index); virtual bool on_window_show(const std::string& title);