From 8ebd4f916122a0d1e019597feb5d78f3b0c36117 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Thu, 20 Oct 2016 10:08:00 +0200 Subject: [PATCH] Cleanup & init'd thru. --- src/MIDI.h | 30 +++++++++++++----------------- src/MIDI.hpp | 7 +++++++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/MIDI.h b/src/MIDI.h index ebedba4..cb3fa83 100644 --- a/src/MIDI.h +++ b/src/MIDI.h @@ -152,8 +152,7 @@ public: public: static inline MidiType getTypeFromStatusByte(byte inStatus); static inline Channel getChannelFromStatusByte(byte inStatus); - static inline bool isChannelMessage(MidiType inType); - + static inline bool isChannelMessage(MidiType inType); // ------------------------------------------------------------------------- // Input Callbacks @@ -222,10 +221,6 @@ private: inline bool inputFilter(Channel inChannel); inline void resetInput(); -private: - bool mThruActivated : 1; - MidiFilterMode mThruFilterMode : 7; - private: typedef Message MidiMessage; @@ -233,15 +228,18 @@ private: SerialPort& mSerial; private: - Channel mInputChannel; - StatusByte mRunningStatus_RX; - StatusByte mRunningStatus_TX; - byte mPendingMessage[3]; - unsigned mPendingMessageExpectedLenght; - unsigned mPendingMessageIndex; - unsigned mCurrentRpnNumber; - unsigned mCurrentNrpnNumber; - MidiMessage mMessage; + Channel mInputChannel; + StatusByte mRunningStatus_RX; + StatusByte mRunningStatus_TX; + byte mPendingMessage[3]; + unsigned mPendingMessageExpectedLenght; + unsigned mPendingMessageIndex; + unsigned mCurrentRpnNumber; + unsigned mCurrentNrpnNumber; + bool mThruActivated : 1; + MidiFilterMode mThruFilterMode : 7; + MidiMessage mMessage; + private: inline StatusByte getStatus(MidiType inType, @@ -255,6 +253,4 @@ unsigned decodeSysEx(const byte* inSysEx, byte* outData, unsigned inLenght); END_MIDI_NAMESPACE -// ----------------------------------------------------------------------------- - #include "MIDI.hpp" diff --git a/src/MIDI.hpp b/src/MIDI.hpp index 7e0b7db..4fc2655 100644 --- a/src/MIDI.hpp +++ b/src/MIDI.hpp @@ -41,6 +41,8 @@ inline MidiInterface::MidiInterface(SerialPort& inSerial) , mPendingMessageIndex(0) , mCurrentRpnNumber(0xffff) , mCurrentNrpnNumber(0xffff) + , mThruActivated(true) + , mThruFilterMode(Full) { mNoteOffCallback = 0; mNoteOnCallback = 0; @@ -781,9 +783,14 @@ bool MidiInterface::parse() // Save data2 only if applicable if (mPendingMessageExpectedLenght == 3) + { + // todo: This code seems unreacheable, to clean up. mMessage.data2 = mPendingMessage[2]; + } else + { mMessage.data2 = 0; + } mPendingMessageIndex = 0; mPendingMessageExpectedLenght = 0;