From 3e6c580c197929c126613fcfc546308abdc18c09 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 19 Jun 2011 21:16:32 +0000 Subject: Add a real URI map implementation. git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3406 a436a847-0d15-0410-975c-d299462d15a1 --- src/jalv.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/jalv.c') diff --git a/src/jalv.c b/src/jalv.c index de50521..e13a858 100644 --- a/src/jalv.c +++ b/src/jalv.c @@ -64,18 +64,16 @@ struct Port { bool is_input; }; -/** URI map feature, for event types (we use only MIDI) */ -#define MIDI_EVENT_ID 1 +/** + Map function for URI map extension. +*/ uint32_t uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* map, const char* uri) { - /* Note a non-trivial host needs to use an actual dictionary here */ - if (!strcmp(map, LV2_EVENT_URI) && !strcmp(uri, LILV_URI_MIDI_EVENT)) - return MIDI_EVENT_ID; - else - return 0; /* Refuse to map ID */ + Jalv* host = (Jalv*)callback_data; + return symap_map(host->symap, uri); } #define NS_EXT "http://lv2plug.in/ns/ext/" @@ -210,7 +208,8 @@ jack_process_cb(jack_nframes_t nframes, void* data) jack_midi_event_get(&ev, buf, i); lv2_event_write(&iter, ev.time, 0, - MIDI_EVENT_ID, ev.size, ev.buffer); + host->midi_event_id, + ev.size, ev.buffer); } } } @@ -312,6 +311,12 @@ main(int argc, char** argv) host.num_ports = 0; host.ports = NULL; + host.symap = symap_new(); + uri_map.callback_data = &host; + host.midi_event_id = uri_to_id(&host, + "http://lv2plug.in/ns/ext/event", + "http://lv2plug.in/ns/ext/midi#MidiEvent"); + host.events = jack_ringbuffer_create(4096); jack_ringbuffer_mlock(host.events); @@ -502,6 +507,7 @@ main(int argc, char** argv) lilv_node_free(host.event_class); lilv_node_free(host.midi_class); lilv_node_free(host.optional); + symap_free(host.symap); suil_instance_free(ui_instance); suil_host_free(ui_host); lilv_world_free(world); -- cgit v1.2.1