summaryrefslogtreecommitdiffstats
path: root/src/libs/client/PluginUI.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-07-28 21:56:03 +0000
committerDavid Robillard <d@drobilla.net>2008-07-28 21:56:03 +0000
commita6fb6a0289ea47692d87f3e0200532a426f8e60d (patch)
tree0e497255eb8a263ff9cca87b2ed125b71144cacb /src/libs/client/PluginUI.cpp
parent8e2ba26101828dcf310e0a43ace7aa68dafd3b16 (diff)
downloadingen-a6fb6a0289ea47692d87f3e0200532a426f8e60d.tar.gz
ingen-a6fb6a0289ea47692d87f3e0200532a426f8e60d.tar.bz2
ingen-a6fb6a0289ea47692d87f3e0200532a426f8e60d.zip
Simply global memory management crap by using shared_ptr in the World struct (it's not C anyway, might as well).
Properly support LV2 events from plugin UIs over OSC and directly (w/ monolithic UI/engine). Fix crashes on node destruction with monolithic UI/engine. Resolves ticket #177. git-svn-id: http://svn.drobilla.net/lad/ingen@1293 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client/PluginUI.cpp')
-rw-r--r--src/libs/client/PluginUI.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/libs/client/PluginUI.cpp b/src/libs/client/PluginUI.cpp
index c7c3ffc5..b341bb0f 100644
--- a/src/libs/client/PluginUI.cpp
+++ b/src/libs/client/PluginUI.cpp
@@ -25,6 +25,7 @@
using namespace std;
using Ingen::Shared::EngineInterface;
using Ingen::Shared::LV2URIMap;
+using Ingen::Shared::LV2Features;
namespace Ingen {
namespace Client {
@@ -53,7 +54,8 @@ lv2_ui_write(LV2UI_Controller controller,
SharedPtr<PortModel> port = ui->node()->ports()[port_index];
- LV2URIMap* map = (LV2URIMap*)ui->world()->lv2_features->feature(LV2_URI_MAP_URI);
+ const LV2Features::Feature* f = ui->world()->lv2_features->feature(LV2_URI_MAP_URI);
+ LV2URIMap* map = (LV2URIMap*)f->controller;
assert(map);
// float (special case, always 0)
@@ -66,25 +68,31 @@ lv2_ui_write(LV2UI_Controller controller,
port->type().uri(),
buffer_size, buffer);
- // FIXME: assumes event
- } else {
+ // FIXME: slow, need to cache ID
+ } else if (format == map->uri_to_id(NULL, "http://lv2plug.in/ns/extensions/ui#Events")) {
+ uint32_t midi_event_type = map->uri_to_id(NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent");
LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer;
LV2_Event_Iterator iter;
uint8_t* data;
lv2_event_begin(&iter, buf);
while (lv2_event_is_valid(&iter)) {
LV2_Event* const ev = lv2_event_get(&iter, &data);
-
- // FIXME: bundle multiple events
- ui->world()->engine->set_port_value_immediate(port->path(),
- port->type().uri(),
- ev->size, data);
+ if (ev->type == midi_event_type) {
+ // FIXME: bundle multiple events by writing an entire buffer here
+ ui->world()->engine->set_port_value_immediate(port->path(),
+ "lv2_midi:MidiEvent", ev->size, data);
+ } else {
+ cerr << "WARNING: Unable to send event type " << ev->type <<
+ " over OSC, ignoring event" << endl;
+ }
lv2_event_increment(&iter);
}
+ } else {
+ cerr << "WARNING: Unknown value format " << format
+ << ", either plugin " << ui->node()->plugin()->uri() << " is broken"
+ << " or this is an Ingen bug" << endl;
}
-
-
}