From 4ff4c69ff0d22e88b8799f36f277de263232de4f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 24 Feb 2013 01:46:15 +0000 Subject: Don't send port values to UI for audio ports (fix Calf crash). Don't set ingen:value property for non-control ports. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5081 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/NodeModule.cpp | 27 ++++++++++++++++++++++----- src/gui/NodeModule.hpp | 1 + 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index e0509c51..a03c1693 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -170,12 +170,29 @@ NodeModule::port_activity(uint32_t index, const Atom& value) return; } + if (_block->get_port(index)->is_a(Raul::URI(LV2_ATOM__AtomPort))) { + _plugin_ui->port_event(index, + lv2_atom_total_size(value.atom()), + uris.atom_eventTransfer, + value.atom()); + } +} + +void +NodeModule::port_value_changed(uint32_t index, const Atom& value) +{ + const URIs& uris = app().uris(); + if (!_plugin_ui) { + return; + } + if (value.type() == uris.atom_Float) { _plugin_ui->port_event(index, sizeof(float), 0, value.ptr()); } else { - const LV2_Atom* const atom = value.atom(); - _plugin_ui->port_event( - index, lv2_atom_total_size(atom), uris.atom_eventTransfer, atom); + _plugin_ui->port_event(index, + lv2_atom_total_size(value.atom()), + uris.atom_eventTransfer, + value.atom()); } } @@ -249,7 +266,7 @@ NodeModule::new_port_view(SPtr port) app().world()->conf().option("human-names").get()); port->signal_value_changed().connect( - sigc::bind<0>(sigc::mem_fun(this, &NodeModule::port_activity), + sigc::bind<0>(sigc::mem_fun(this, &NodeModule::port_value_changed), port->index())); port->signal_activity().connect( @@ -336,7 +353,7 @@ NodeModule::set_control_values() uint32_t index = 0; for (const auto& p : _block->ports()) { if (app().can_control(p.get())) { - port_activity(index, p->value()); + port_value_changed(index, p->value()); } ++index; } diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index 1092cdf3..e38859ef 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -83,6 +83,7 @@ protected: void new_port_view(SPtr port); void port_activity(uint32_t index, const Atom& value); + void port_value_changed(uint32_t index, const Atom& value); void plugin_changed(); void set_control_values(); -- cgit v1.2.1