From: Paul Davis Date: Tue, 20 Oct 2015 15:39:56 +0000 (-0400) Subject: do not update LV2 output port displays unless the value has changed X-Git-Tag: 4.5~611 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=47bbffc5d825c51f87955fde8ff9ca00d38d35f0;p=ardour.git do not update LV2 output port displays unless the value has changed --- diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc index 153f4efdd9..9634a05d0a 100644 --- a/gtk2_ardour/lv2_plugin_ui.cc +++ b/gtk2_ardour/lv2_plugin_ui.cc @@ -189,8 +189,14 @@ LV2PluginUI::output_update() 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); + float val = _lv2->get_parameter (index); + + if (val != _values[index]) { + /* Send to GUI */ + suil_instance_port_event ((SuilInstance*)_inst, index, 4, 0, &val); + /* Cache current value */ + _values[index] = val; + } } /* Input ports marked for update because the control value changed @@ -368,10 +374,16 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) _values = new float[num_ports]; _controllables.resize(num_ports); + for (uint32_t i = 0; i < num_ports; ++i) { bool ok; uint32_t port = _lv2->nth_parameter(i, ok); if (ok) { + /* Cache initial value of the parameter, regardless of + whether it is input or output + */ + + _values[port] = _lv2->get_parameter(port); _controllables[port] = boost::dynamic_pointer_cast ( insert->control(Evoral::Parameter(PluginAutomation, 0, port))); @@ -379,9 +391,10 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) 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); } + + /* queue for first update ("push") to GUI */ + _updates.insert (port); } }