From 9680cb0fd0fae53cfa93b8524cd25b551a07d25d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 1 Jun 2012 04:13:44 +0000 Subject: Functioning MIDI input and internals when running as an LV2. Ingen can now be used to build working LV2 synthesizers. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4491 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/ingen_lv2.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/server/ingen_lv2.cpp') diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index c9c6907e..a4cd4247 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -101,9 +101,17 @@ public: AudioBuffer* patch_buf = (AudioBuffer*)_patch_port->buffer(0).get(); patch_buf->copy((Sample*)_buffer, 0, context.nframes() - 1); } else { - LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_buffer; - bool enqueued = false; + LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_buffer; + bool enqueued = false; + Buffer* patch_buf = _patch_port->buffer(0).get(); + patch_buf->prepare_write(context); LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { + if (!patch_buf->append_event( + ev->time.frames, ev->body.size, ev->body.type, + (const uint8_t*)LV2_ATOM_BODY(&ev->body))) { + Raul::warn("Failed to write to MIDI buffer, events lost!\n"); + } + // TODO: Only enqueue appropriate atoms enqueue_message(context, _driver, &ev->body); enqueued = true; -- cgit v1.2.1