summaryrefslogtreecommitdiff
path: root/gtk2_ardour/lv2_plugin_ui.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-01-14 15:31:41 +0000
committerDavid Robillard <d@drobilla.net>2009-01-14 15:31:41 +0000
commit7e456076abb8ec0757aa0bee6054303a52e1007a (patch)
treefd5d6fa9a3d9945f16660fd06895e318035cbee9 /gtk2_ardour/lv2_plugin_ui.cc
parenta7c6a2c01faeaa37cbc25d5c78d4eb3af5d61405 (diff)
Apply LV2 GUI parameter update patch from kfoltman.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4406 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/lv2_plugin_ui.cc')
-rw-r--r--gtk2_ardour/lv2_plugin_ui.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc
index 07599a85bb..26a7074386 100644
--- a/gtk2_ardour/lv2_plugin_ui.cc
+++ b/gtk2_ardour/lv2_plugin_ui.cc
@@ -44,14 +44,20 @@ void
LV2PluginUI::parameter_changed (uint32_t port_index, float val)
{
if (val != _values[port_index]) {
- const LV2UI_Descriptor* ui_desc = slv2_ui_instance_get_descriptor(_inst);
- LV2UI_Handle ui_handle = slv2_ui_instance_get_handle(_inst);
- if (ui_desc->port_event)
- ui_desc->port_event(ui_handle, port_index, 4, 0, &val);
- _values[port_index] = val;
+ parameter_update(port_index, val);
}
}
+void
+LV2PluginUI::parameter_update (uint32_t port_index, float val)
+{
+ const LV2UI_Descriptor* ui_desc = slv2_ui_instance_get_descriptor(_inst);
+ LV2UI_Handle ui_handle = slv2_ui_instance_get_handle(_inst);
+ if (ui_desc->port_event)
+ ui_desc->port_event(ui_handle, port_index, 4, 0, &val);
+ _values[port_index] = val;
+}
+
bool
LV2PluginUI::start_updating(GdkEventAny* event)
{
@@ -107,9 +113,13 @@ LV2PluginUI::LV2PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<
_values = new float[num_ports];
for (uint32_t i = 0; i < num_ports; ++i) {
bool ok;
- _values[i] = lv2p->nth_parameter(i, ok);
- if (ok)
- lv2_ui_write(this, i, 4, /* FIXME: format */0, &_values[i]);
+ uint32_t port = lv2p->nth_parameter(i, ok);
+ if (ok) {
+ _values[port] = lv2p->get_parameter(port);
+ if (lv2p->parameter_is_control(port) && lv2p->parameter_is_input(port)) {
+ parameter_update(port, _values[port]);
+ }
+ }
}
_lv2->ParameterChanged.connect(mem_fun(*this, &LV2PluginUI::parameter_changed));