aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-18 01:15:43 +0000
committerDavid Robillard <d@drobilla.net>2012-02-18 01:15:43 +0000
commit719c973b349724657c71b545f4f3d4498d633b23 (patch)
treef3c6e65aecb0b01ee5d6fb6a5fdbfb2cb87f1c76
parent21f5ce9b56bc0e0b3a38ee84bdd7e0992485c133 (diff)
downloadjalv-719c973b349724657c71b545f4f3d4498d633b23.tar.gz
jalv-719c973b349724657c71b545f4f3d4498d633b23.tar.bz2
jalv-719c973b349724657c71b545f4f3d4498d633b23.zip
Implement/fix atom event port UI notifications.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3985 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/jalv.c17
-rw-r--r--src/lv2_evbuf.c14
2 files changed, 25 insertions, 6 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 8018c13..ab81162 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -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;