From 0bf3e5c096504bdfd08c109fb91e10e28fac51c9 Mon Sep 17 00:00:00 2001 From: Christoph Hart Date: Sun, 8 Dec 2024 21:16:36 +0100 Subject: [PATCH] - fix MIDI messages being ignored around Ableton sequencer loop points --- hi_core/hi_core/MainControllerHelpers.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hi_core/hi_core/MainControllerHelpers.cpp b/hi_core/hi_core/MainControllerHelpers.cpp index 53cd37cd01..a8ac0aebf7 100644 --- a/hi_core/hi_core/MainControllerHelpers.cpp +++ b/hi_core/hi_core/MainControllerHelpers.cpp @@ -1501,6 +1501,27 @@ void DelayedRenderer::processWrapped(AudioSampleBuffer& buffer, MidiBuffer& midi } else { + if(!shortBuffer.isEmpty()) + { + MidiBuffer::Iterator it(midiMessages); + + delayedMidiBuffer.clear(); + + MidiMessage m; + int pos; + + for (auto& e : shortBuffer) + delayedMidiBuffer.addEvent(e.toMidiMesage(), e.getTimeStamp()); + + while (it.getNextEvent(m, pos)) + delayedMidiBuffer.addEvent(m, jmin(pos + lastBlockSizeForShortBuffer, buffer.getNumSamples())); + + delayedMidiBuffer.swapWith(midiMessages); + + shortBuffer.clear(); + lastBlockSizeForShortBuffer = 0; + } + mc->processBlockCommon(buffer, midiMessages); } }