notify LV2 GUIs about port-changes when loading presets
[ardour.git] / gtk2_ardour / lv2_plugin_ui.cc
index 572cdfb6716888731a220787d7e1530f8f2a8c25..20f59b5e8361624f3454c9533e58d9b486453705 100644 (file)
@@ -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<PluginInsert> 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