Browse Source

Implement single message per step for all midi modules and Fix quad midi reset bug

pull/1639/head
ben 6 years ago
parent
commit
9c58316f84
5 changed files with 8 additions and 15 deletions
  1. +2
    -2
      src/core/MidiCCToCV.cpp
  2. +1
    -2
      src/core/MidiClockToCV.cpp
  3. +1
    -2
      src/core/MidiToCV.cpp
  4. +1
    -2
      src/core/MidiTriggerToCV.cpp
  5. +3
    -7
      src/core/QuadMidiToCV.cpp

+ 2
- 2
src/core/MidiCCToCV.cpp View File

@@ -91,11 +91,11 @@ void MIDICCToCVInterface::step() {
if (isPortOpen()) {
std::vector<unsigned char> 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);
}
}



+ 1
- 2
src/core/MidiClockToCV.cpp View File

@@ -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);
}
}



+ 1
- 2
src/core/MidiToCV.cpp View File

@@ -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);
}
}



+ 1
- 2
src/core/MidiTriggerToCV.cpp View File

@@ -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);
}
}



+ 3
- 7
src/core/QuadMidiToCV.cpp View File

@@ -98,16 +98,11 @@ void QuadMIDIToCVInterface::resetMidi() {
void QuadMIDIToCVInterface::step() {
if (isPortOpen()) {
std::vector<unsigned char> 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<unsigned char> 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<unsigned char> 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);


Loading…
Cancel
Save