From: Paul Davis Date: Tue, 20 Oct 2015 15:28:53 +0000 (-0400) Subject: also update LV2 output port displays as part of periodic updates X-Git-Tag: 4.5~613 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=8533b8244f2d96814b6c0ccc6d1315edc89e7de9;p=ardour.git also update LV2 output port displays as part of periodic updates --- diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc index e2c446ef20..33fa2c746d 100644 --- a/gtk2_ardour/lv2_plugin_ui.cc +++ b/gtk2_ardour/lv2_plugin_ui.cc @@ -180,14 +180,26 @@ LV2PluginUI::output_update() } } - if (_inst) { - for (Updates::iterator i = _updates.begin(); i != _updates.end(); ++i) { - float val = _lv2->get_parameter (*i); - /* push current value to the GUI */ - suil_instance_port_event ((SuilInstance*)_inst, (*i), 4, 0, &val); - } - _updates.clear (); + if (!_inst) { + return; } + + /* output ports (values set by DSP) need propagating to GUI */ + + uint32_t nports = _output_ports.size(); + for (uint32_t i = 0; i < nports; ++i) { + uint32_t index = _output_ports[i]; + float val = _lv2->get_parameter(index); + suil_instance_port_event ((SuilInstance*)_inst, index, 4, 0, &val); + } + + for (Updates::iterator i = _updates.begin(); i != _updates.end(); ++i) { + float val = _lv2->get_parameter (*i); + /* push current value to the GUI */ + suil_instance_port_event ((SuilInstance*)_inst, (*i), 4, 0, &val); + } + + _updates.clear (); } LV2PluginUI::LV2PluginUI(boost::shared_ptr pi, @@ -359,9 +371,10 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) _controllables[port] = boost::dynamic_pointer_cast ( insert->control(Evoral::Parameter(PluginAutomation, 0, port))); - /* FIXME only works with control output ports (which is all we support now anyway) */ - if (_controllables[port] && _lv2->parameter_is_control(port) && _lv2->parameter_is_input(port)) { - _controllables[port]->Changed.connect (control_connections, invalidator (*this), boost::bind (&LV2PluginUI::control_changed, this, port), gui_context()); + if (_lv2->parameter_is_control(port) && _lv2->parameter_is_input(port)) { + if (_controllables[port]) { + _controllables[port]->Changed.connect (control_connections, invalidator (*this), boost::bind (&LV2PluginUI::control_changed, this, port), gui_context()); + } /* queue for first update ("push") to GUI */ _updates.insert (port); }