From f905cba68cb397ccaa694530d5592347b8d65be0 Mon Sep 17 00:00:00 2001 From: Lukas Schwabe Date: Mon, 25 Nov 2019 03:46:10 +0100 Subject: [PATCH 1/3] Update MIDI.hpp --- src/MIDI.hpp | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/MIDI.hpp b/src/MIDI.hpp index 99e348a4..fda386f8 100644 --- a/src/MIDI.hpp +++ b/src/MIDI.hpp @@ -911,24 +911,33 @@ bool MidiInterface::parse() mMessage.valid = true; // Activate running status (if enabled for the received type) - switch (mMessage.type) - { - case NoteOff: - case NoteOn: - case AfterTouchPoly: - case ControlChange: - case ProgramChange: - case AfterTouchChannel: - case PitchBend: - // Running status enabled: store it from received message - mRunningStatus_RX = mPendingMessage[0]; - break; + if (Settings::UseRunningStatus) { - default: + switch (mMessage.type) + { + case NoteOff: + case NoteOn: + case AfterTouchPoly: + case ControlChange: + case ProgramChange: + case AfterTouchChannel: + case PitchBend: + // Running status enabled: store it from received message + mRunningStatus_RX = mPendingMessage[0]; + break; + + default: // No running status - mRunningStatus_RX = InvalidType; - break; + mRunningStatus_RX = InvalidType; + break; + } } + + else { + + mRunningStatus_RX = InvalidType; + } + return true; } else From de8e227af0683853eb3ea5b19aeb74c0cc107e14 Mon Sep 17 00:00:00 2001 From: Lukas Schwabe Date: Mon, 25 Nov 2019 03:51:33 +0100 Subject: [PATCH 2/3] Update MIDI.hpp - added if statement asking for "useRunningStatus", as it caused a bug with a certain midi device, causing the arduino to resolve the same midi data multiple times. I think it was forgotten here, as the comment also suggests that this section is only for "if enabled..." --- src/MIDI.hpp | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/MIDI.hpp b/src/MIDI.hpp index 99e348a4..fda386f8 100644 --- a/src/MIDI.hpp +++ b/src/MIDI.hpp @@ -911,24 +911,33 @@ bool MidiInterface::parse() mMessage.valid = true; // Activate running status (if enabled for the received type) - switch (mMessage.type) - { - case NoteOff: - case NoteOn: - case AfterTouchPoly: - case ControlChange: - case ProgramChange: - case AfterTouchChannel: - case PitchBend: - // Running status enabled: store it from received message - mRunningStatus_RX = mPendingMessage[0]; - break; + if (Settings::UseRunningStatus) { - default: + switch (mMessage.type) + { + case NoteOff: + case NoteOn: + case AfterTouchPoly: + case ControlChange: + case ProgramChange: + case AfterTouchChannel: + case PitchBend: + // Running status enabled: store it from received message + mRunningStatus_RX = mPendingMessage[0]; + break; + + default: // No running status - mRunningStatus_RX = InvalidType; - break; + mRunningStatus_RX = InvalidType; + break; + } } + + else { + + mRunningStatus_RX = InvalidType; + } + return true; } else From 894409953bae9ace0cee41d38d9576e818e4c014 Mon Sep 17 00:00:00 2001 From: Lukas Schwabe Date: Mon, 25 Nov 2019 03:55:13 +0100 Subject: [PATCH 3/3] aligned code --- src/MIDI.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/MIDI.hpp b/src/MIDI.hpp index fda386f8..64c00ca8 100644 --- a/src/MIDI.hpp +++ b/src/MIDI.hpp @@ -915,13 +915,13 @@ bool MidiInterface::parse() switch (mMessage.type) { - case NoteOff: - case NoteOn: - case AfterTouchPoly: - case ControlChange: - case ProgramChange: - case AfterTouchChannel: - case PitchBend: + case NoteOff: + case NoteOn: + case AfterTouchPoly: + case ControlChange: + case ProgramChange: + case AfterTouchChannel: + case PitchBend: // Running status enabled: store it from received message mRunningStatus_RX = mPendingMessage[0]; break;