From 6ae2018e81e7e81e4906e62dc6224ad34298d9c2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 14 Nov 2009 20:44:40 +0000 Subject: Object extension. Port resize extension. Sensible extension(s) implementation design for Ingen. Replace string port extension support in Ingen with Object port extension. Implement port resize extension in Ingen. Some test plugins for this stuff. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2260 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginUI.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/client/PluginUI.cpp') diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 3007e723..bb10b3a6 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -17,9 +17,10 @@ #include #include "event.lv2/event-helpers.h" -#include "string-port.lv2/string-port.h" +#include "object.lv2/object.h" #include "shared/LV2Features.hpp" #include "shared/LV2URIMap.hpp" +#include "shared/LV2Object.hpp" #include "PluginUI.hpp" #include "NodeModel.hpp" #include "PortModel.hpp" @@ -56,9 +57,8 @@ lv2_ui_write(LV2UI_Controller controller, SharedPtr port = ui->node()->ports()[port_index]; - const LV2Features::Feature* f = ui->world()->lv2_features->feature(LV2_URI_MAP_URI); - LV2URIMap* map = (LV2URIMap*)f->controller; - assert(map); + SharedPtr map = PtrCast( + ui->world()->lv2_features->feature(LV2_URI_MAP_URI)); // float (special case, always 0) if (format == 0) { @@ -68,16 +68,14 @@ lv2_ui_write(LV2UI_Controller controller, ui->world()->engine->set_port_value(port->path(), Atom(*(float*)buffer)); - // FIXME: this is slow, 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; + } else if (format == map->ui_format_events) { + LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer; LV2_Event_Iterator iter; - uint8_t* data; + uint8_t* data; lv2_event_begin(&iter, buf); while (lv2_event_is_valid(&iter)) { LV2_Event* const ev = lv2_event_get(&iter, &data); - if (ev->type == midi_event_type) { + if (ev->type == map->midi_event) { // FIXME: bundle multiple events by writing an entire buffer here ui->world()->engine->set_port_value(port->path(), Atom("lv2midi:MidiEvent", ev->size, data)); @@ -89,10 +87,11 @@ lv2_ui_write(LV2UI_Controller controller, lv2_event_increment(&iter); } - // FIXME: this is slow, cache ID - } else if (format == map->uri_to_id(NULL, "http://lv2plug.in/ns/dev/string-port#StringTransfer")) { - LV2_String_Data* buf = (LV2_String_Data*)buffer; - ui->world()->engine->set_port_value(port->path(), buf->data); + } else if (format == map->object_transfer) { + LV2_Object* buf = (LV2_Object*)buffer; + Raul::Atom val; + Shared::LV2Object::to_atom(ui->world(), buf, val); + ui->world()->engine->set_port_value(port->path(), val); } else { cerr << "WARNING: Unknown value format " << format @@ -145,8 +144,9 @@ PluginUI::create(Ingen::Shared::World* world, if (ui) { cout << "Found GTK Plugin UI: " << slv2_ui_get_uri(ui) << endl; ret = SharedPtr(new PluginUI(world, node)); + ret->_features = world->lv2_features->lv2_features(node.get()); SLV2UIInstance inst = slv2_ui_instantiate( - plugin, ui, lv2_ui_write, ret.get(), world->lv2_features->lv2_features()); + plugin, ui, lv2_ui_write, ret.get(), ret->_features->array()); if (inst) { ret->set_instance(inst); -- cgit v1.2.1