From 56b36b843389f6e52dcdb31878ea6262cca56b42 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Apr 2008 18:07:44 +0000 Subject: LV2 event/MIDI fixed for Ingen from larsl. git-svn-id: http://svn.drobilla.net/lad/ingen@1180 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/EventBuffer.cpp | 5 ++--- src/libs/engine/JackMidiDriver.cpp | 5 +++-- src/libs/engine/LV2Info.cpp | 6 ++++++ src/libs/gui/WindowFactory.hpp | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/libs/engine/EventBuffer.cpp b/src/libs/engine/EventBuffer.cpp index a9a6c938..2173551a 100644 --- a/src/libs/engine/EventBuffer.cpp +++ b/src/libs/engine/EventBuffer.cpp @@ -49,6 +49,7 @@ EventBuffer::EventBuffer(size_t capacity) _local_buf->event_count = 0; _local_buf->capacity = (uint32_t)capacity; _local_buf->size = 0; + _local_buf->data = reinterpret_cast(_local_buf + 1); _buf = _local_buf; reset(0); @@ -165,9 +166,7 @@ EventBuffer::append(uint32_t frames, || (last_event->frames == frames && last_event->subframes <= subframes)); #endif - bool ret = lv2_event_is_valid(&_iter); - if (ret) - ret = lv2_event_write(&_iter, frames, subframes, type, size, data); + bool ret = lv2_event_write(&_iter, frames, subframes, type, size, data); if (!ret) cerr << "ERROR: Failed to write event." << endl; diff --git a/src/libs/engine/JackMidiDriver.cpp b/src/libs/engine/JackMidiDriver.cpp index 8d9853f2..2cdd2489 100644 --- a/src/libs/engine/JackMidiDriver.cpp +++ b/src/libs/engine/JackMidiDriver.cpp @@ -86,8 +86,9 @@ JackMidiPort::pre_process(ProcessContext& context) jack_midi_event_t ev; jack_midi_event_get(&ev, jack_buffer, i); - // FIXME: type - const bool success = patch_buf->append(ev.time, 0, 0, ev.size, ev.buffer); + // FIXME: type is hardcoded for now, we should get it from + // the type map instead + const bool success = patch_buf->append(ev.time, 0, 1, ev.size, ev.buffer); if (!success) cerr << "WARNING: Failed to write MIDI to port buffer, event(s) lost!" << endl; } diff --git a/src/libs/engine/LV2Info.cpp b/src/libs/engine/LV2Info.cpp index 23f2ede6..d1af757f 100644 --- a/src/libs/engine/LV2Info.cpp +++ b/src/libs/engine/LV2Info.cpp @@ -41,6 +41,12 @@ LV2Info::LV2Info(SLV2World world) lv2_features[0] = &uri_map_feature; lv2_features[1] = NULL; + + /* this is needed so we get a fixed type ID for MIDI, it would + probably be better to make the type map accessible from any + JackMidiPort. */ + next_uri_id++; + uri_map.insert(make_pair(string("http://lv2plug.in/ns/ext/midi#MidiEvent"), 1)); } diff --git a/src/libs/gui/WindowFactory.hpp b/src/libs/gui/WindowFactory.hpp index 06f2f637..618b027c 100644 --- a/src/libs/gui/WindowFactory.hpp +++ b/src/libs/gui/WindowFactory.hpp @@ -58,9 +58,9 @@ public: PatchWindow* patch_window(SharedPtr patch); NodeControlWindow* control_window(SharedPtr node); - void present_patch(SharedPtr patch, + void present_patch(SharedPtr model, PatchWindow* preferred = NULL, - SharedPtr patch = SharedPtr()); + SharedPtr view = SharedPtr()); void present_controls(SharedPtr node); -- cgit v1.2.1