From 6797047a5b210e1a35cf173c33d3c357d4d82665 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 17 Jul 2011 11:04:40 +0100 Subject: [PATCH] MIDI Input support --- .../src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp b/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp index 43d3e4c..21fb884 100644 --- a/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp +++ b/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp @@ -140,7 +140,7 @@ public: #if JucePlugin_WantsMidiInput if (port == index) { - port_min = data_location; + port_min = (LV2_Event_Buffer*)data_location; return; } index += 1; @@ -148,7 +148,7 @@ public: #if JucePlugin_ProducesMidiOutput if (port == index) { - port_mout = data_location; + port_mout = (LV2_Event_Buffer*)data_location; return; } index += 1; @@ -292,7 +292,16 @@ public: channels[i] = chan; } - // TODO - MIDI Input + // LV2 MIDI Input + LV2_Event_Iterator iter; + lv2_event_begin(&iter, port_min); + + for (uint32_t i=0; i < iter.buf->event_count; ++i) { + uint8_t* data; + LV2_Event* ev = lv2_event_get(&iter, &data); + midiEvents.addEvent(data, ev->size, ev->frames); + lv2_event_increment(&iter); + } for (; i < numIn; ++i) channels[i] = ports_ain[i]; @@ -350,8 +359,8 @@ private: uint16_t midi_uri_id; uint32_t port_count; - void* port_min; - void* port_mout; + LV2_Event_Buffer* port_min; + LV2_Event_Buffer* port_mout; float* ports_ain[JucePlugin_MaxNumInputChannels]; float* ports_aout[JucePlugin_MaxNumOutputChannels]; Array ports_ctrl; -- 2.11.4.GIT