diff --git a/src/core/MidiCCToCV.cpp b/src/core/MidiCCToCV.cpp index de651a1b..6e60e5f3 100644 --- a/src/core/MidiCCToCV.cpp +++ b/src/core/MidiCCToCV.cpp @@ -91,11 +91,11 @@ void MIDICCToCVInterface::step() { if (isPortOpen()) { std::vector message; + // midiIn->getMessage returns empty vector if there are no messages in the queue getMessage(&message); - while (message.size() > 0) { + if (message.size() > 0) { processMidi(message); - getMessage(&message); } } diff --git a/src/core/MidiClockToCV.cpp b/src/core/MidiClockToCV.cpp index 0fa146af..1b5186c7 100644 --- a/src/core/MidiClockToCV.cpp +++ b/src/core/MidiClockToCV.cpp @@ -101,9 +101,8 @@ void MIDIClockToCVInterface::step() { // midiIn->getMessage returns empty vector if there are no messages in the queue getMessage(&message); - while (message.size() > 0) { + if (message.size() > 0) { processMidi(message); - getMessage(&message); } } diff --git a/src/core/MidiToCV.cpp b/src/core/MidiToCV.cpp index 783a78ce..df8accd9 100644 --- a/src/core/MidiToCV.cpp +++ b/src/core/MidiToCV.cpp @@ -100,9 +100,8 @@ void MIDIToCVInterface::step() { // midiIn->getMessage returns empty vector if there are no messages in the queue getMessage(&message); - while (message.size() > 0) { + if (message.size() > 0) { processMidi(message); - getMessage(&message); } } diff --git a/src/core/MidiTriggerToCV.cpp b/src/core/MidiTriggerToCV.cpp index 376dccf3..3fb0f1c1 100644 --- a/src/core/MidiTriggerToCV.cpp +++ b/src/core/MidiTriggerToCV.cpp @@ -75,9 +75,8 @@ void MIDITriggerToCVInterface::step() { // midiIn->getMessage returns empty vector if there are no messages in the queue getMessage(&message); - while (message.size() > 0) { + if (message.size() > 0) { processMidi(message); - getMessage(&message); } } diff --git a/src/core/QuadMidiToCV.cpp b/src/core/QuadMidiToCV.cpp index 99009699..d6b865c7 100644 --- a/src/core/QuadMidiToCV.cpp +++ b/src/core/QuadMidiToCV.cpp @@ -98,16 +98,11 @@ void QuadMIDIToCVInterface::resetMidi() { void QuadMIDIToCVInterface::step() { if (isPortOpen()) { std::vector message; - int msgsProcessed = 0; // midiIn->getMessage returns empty vector if there are no messages in the queue - // NOTE: For the quadmidi we will process max 4 midi messages per step to avoid - // problems with parallel input. getMessage(&message); - while (msgsProcessed < 4 && message.size() > 0) { + if (message.size() > 0) { processMidi(message); - getMessage(&message); - msgsProcessed++; } } @@ -183,7 +178,7 @@ void QuadMIDIToCVInterface::processMidi(std::vector msg) { if (!gate) { for (int i = 0; i < 4; i++) { - if (activeKeys[i].pitch == data1) { + if (activeKeys[i].pitch == data1 && activeKeys[i].gate) { activeKeys[i].gate = false; activeKeys[i].vel = data2; if (std::find(open.begin(), open.end(), i) != open.end()) { @@ -210,6 +205,7 @@ void QuadMIDIToCVInterface::processMidi(std::vector msg) { switch (mode) { case RESET: if (open.size() >= 4) { + open.clear(); for (int i = 0; i < 4; i++) { activeKeys[i].gate = false; open.push_back(i);