From 6bd13dfa606f758212a20634f0f073596f42101f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 18 Jul 2012 02:45:35 +0000 Subject: Working bi-directional UI <=> plugin messaging. Rewrite notification system to support variably sized notifications. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4548 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/NodeModule.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/gui/NodeModule.cpp') diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 5ee75584..1d3f6801 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -19,6 +19,8 @@ #include +#include "lv2/lv2plug.in/ns/ext/atom/util.h" + #include "ingen/Interface.hpp" #include "ingen/client/NodeModel.hpp" #include "ingen/client/PatchModel.hpp" @@ -181,6 +183,24 @@ NodeModule::value_changed(uint32_t index, const Atom& value) } } +void +NodeModule::port_activity(uint32_t index, const Atom& value) +{ + if (!_plugin_ui) + return; + + const URIs& uris = app().uris(); + + // FIXME: Well, this sucks... + LV2_Atom* atom = (LV2_Atom*)malloc(sizeof(LV2_Atom) + value.size()); + atom->type = value.type(); + atom->size = value.type(); + memcpy(LV2_ATOM_BODY(atom), value.get_body(), value.size()); + _plugin_ui->port_event( + index, lv2_atom_total_size(atom), uris.atom_eventTransfer, atom); + free(atom); +} + void NodeModule::plugin_changed() { @@ -252,6 +272,10 @@ NodeModule::new_port_view(SharedPtr port) port->signal_value_changed().connect( sigc::bind<0>(sigc::mem_fun(this, &NodeModule::value_changed), port->index())); + + port->signal_activity().connect( + sigc::bind<0>(sigc::mem_fun(this, &NodeModule::port_activity), + port->index())); } Port* -- cgit v1.2.1