diff options
-rw-r--r-- | src/jalv.c | 17 | ||||
-rw-r--r-- | src/lv2_evbuf.c | 14 |
2 files changed, 25 insertions, 6 deletions
@@ -430,6 +430,21 @@ jack_process_cb(jack_nframes_t nframes, void* data) lv2_evbuf_get(i, &frames, &subframes, &type, &size, &data); jack_midi_event_write(buf, frames, data, size); + + /* TODO: Be more disciminate about what to send */ + if (!port->old_api) { + char buf[sizeof(ControlChange) + sizeof(LV2_Atom)]; + ControlChange* ev = (ControlChange*)buf; + ev->index = p; + ev->protocol = host->atom_prot_id; + ev->size = sizeof(LV2_Atom) + size; + LV2_Atom* atom = (LV2_Atom*)ev->body; + atom->type = type; + atom->size = size; + jack_ringbuffer_write(host->plugin_events, buf, sizeof(buf)); + /* TODO: race, ensure reader handles this correctly */ + jack_ringbuffer_write(host->plugin_events, (void*)data, size); + } } } else if (send_ui_updates && port->flow != FLOW_INPUT @@ -572,7 +587,7 @@ main(int argc, char** argv) host.midi_event_id = uri_to_id(&host, "http://lv2plug.in/ns/ext/event", NS_MIDI "MidiEvent"); - host.atom_prot_id = symap_map(host.symap, NS_ATOM "atomTransfer"); + host.atom_prot_id = symap_map(host.symap, NS_ATOM "eventTransfer"); char* template = jalv_strdup("/tmp/jalv-XXXXXX"); host.temp_dir = jalv_strjoin(mkdtemp(template), "/"); diff --git a/src/lv2_evbuf.c b/src/lv2_evbuf.c index f273934..96c077f 100644 --- a/src/lv2_evbuf.c +++ b/src/lv2_evbuf.c @@ -53,7 +53,7 @@ lv2_evbuf_new(uint32_t capacity, LV2_Evbuf_Type type) evbuf->buf.atom.data = (LV2_Atom*)((uint8_t*)evbuf + sizeof(LV2_Evbuf)); evbuf->buf.atom.size = sizeof(LV2_Atom_Port_Buffer); evbuf->buf.atom.capacity = capacity - sizeof(LV2_Atom); - // FIXME: set type + evbuf->buf.atom.data->type = 0; // FIXME: set type to atom:Sequence evbuf->buf.atom.data->size = 0; break; } @@ -169,11 +169,14 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter, return false; } - LV2_Event* ev; - LV2_Atom_Event* aev; + LV2_Event_Buffer* ebuf; + LV2_Event* ev; + LV2_Atom_Port_Buffer* abuf; + LV2_Atom_Event* aev; switch (iter.evbuf->type) { case LV2_EVBUF_EVENT: - ev = (LV2_Event*)(iter.evbuf->buf.event.data + iter.offset); + ebuf = &iter.evbuf->buf.event; + ev = (LV2_Event*)ebuf->data + iter.offset; *frames = ev->frames; *subframes = ev->subframes; *type = ev->type; @@ -181,8 +184,9 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter, *data = (uint8_t*)ev + sizeof(LV2_Event); break; case LV2_EVBUF_ATOM: + abuf = &iter.evbuf->buf.atom; aev = (LV2_Atom_Event*)( - (char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, iter.evbuf->buf.atom.data) + (char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, abuf->data) + iter.offset); *frames = aev->time.audio.frames; *subframes = aev->time.audio.subframes; |