Reverted Thru changes on branch release/4.0 (breaking thread/merge-safety).

This commit is contained in:
Francois Best 2013-07-07 15:10:13 +02:00
parent cc9927fd50
commit 601ddb3773
3 changed files with 464 additions and 411 deletions

View File

@ -68,7 +68,7 @@ public:
inline void sendAfterTouch(DataByte inPressure, inline void sendAfterTouch(DataByte inPressure,
Channel inChannel); Channel inChannel);
inline void sendSysEx(unsigned inLength, inline void sendSysEx(unsigned int inLength,
const byte* inArray, const byte* inArray,
bool inArrayContainsBoundaries = false); bool inArrayContainsBoundaries = false);
@ -76,7 +76,7 @@ public:
DataByte inValuesNibble); DataByte inValuesNibble);
inline void sendTimeCodeQuarterFrame(DataByte inData); inline void sendTimeCodeQuarterFrame(DataByte inData);
inline void sendSongPosition(unsigned inBeats); inline void sendSongPosition(unsigned int inBeats);
inline void sendSongSelect(DataByte inSongNumber); inline void sendSongSelect(DataByte inSongNumber);
inline void sendTuneRequest(); inline void sendTuneRequest();
inline void sendRealTime(MidiType inType); inline void sendRealTime(MidiType inType);
@ -109,7 +109,7 @@ public:
inline DataByte getData1() const; inline DataByte getData1() const;
inline DataByte getData2() const; inline DataByte getData2() const;
inline const byte* getSysExArray() const; inline const byte* getSysExArray() const;
inline unsigned getSysExArrayLength() const; inline unsigned int getSysExArrayLength() const;
inline bool check() const; inline bool check() const;
public: public:
@ -117,12 +117,9 @@ public:
inline void setInputChannel(Channel inChannel); inline void setInputChannel(Channel inChannel);
public: public:
static inline MidiType getTypeFromStatusByte(StatusByte inStatus); static inline MidiType getTypeFromStatusByte(byte inStatus);
static inline byte getMessageLength(StatusByte inStatus);
static inline bool isChannelMessage(MidiType inType); static inline bool isChannelMessage(MidiType inType);
static inline bool isSystemRealtimeMessage(MidiType inType);
static inline bool isSystemCommonMessage(MidiType inType);
private: private:
bool inputFilter(Channel inChannel); bool inputFilter(Channel inChannel);
bool parse(); bool parse();
@ -133,8 +130,8 @@ private:
Channel mInputChannel; Channel mInputChannel;
byte mPendingMessage[3]; // SysEx are dumped into mMessage directly. byte mPendingMessage[3]; // SysEx are dumped into mMessage directly.
unsigned mPendingMessageExpectedLenght; unsigned int mPendingMessageExpectedLenght;
unsigned mPendingMessageIndex; // Extended to unsigned for larger SysEx payloads. unsigned int mPendingMessageIndex; // Extended to unsigned int for larger SysEx payloads.
Message mMessage; Message mMessage;
@ -153,7 +150,7 @@ public:
inline void setHandlePitchBend(void (*fptr)(byte channel, int bend)); inline void setHandlePitchBend(void (*fptr)(byte channel, int bend));
inline void setHandleSystemExclusive(void (*fptr)(byte * array, byte size)); inline void setHandleSystemExclusive(void (*fptr)(byte * array, byte size));
inline void setHandleTimeCodeQuarterFrame(void (*fptr)(byte data)); inline void setHandleTimeCodeQuarterFrame(void (*fptr)(byte data));
inline void setHandleSongPosition(void (*fptr)(unsigned beats)); inline void setHandleSongPosition(void (*fptr)(unsigned int beats));
inline void setHandleSongSelect(void (*fptr)(byte songnumber)); inline void setHandleSongSelect(void (*fptr)(byte songnumber));
inline void setHandleTuneRequest(void (*fptr)(void)); inline void setHandleTuneRequest(void (*fptr)(void));
inline void setHandleClock(void (*fptr)(void)); inline void setHandleClock(void (*fptr)(void));
@ -178,7 +175,7 @@ private:
void (*mPitchBendCallback)(byte channel, int); void (*mPitchBendCallback)(byte channel, int);
void (*mSystemExclusiveCallback)(byte * array, byte size); void (*mSystemExclusiveCallback)(byte * array, byte size);
void (*mTimeCodeQuarterFrameCallback)(byte data); void (*mTimeCodeQuarterFrameCallback)(byte data);
void (*mSongPositionCallback)(unsigned beats); void (*mSongPositionCallback)(unsigned int beats);
void (*mSongSelectCallback)(byte songnumber); void (*mSongSelectCallback)(byte songnumber);
void (*mTuneRequestCallback)(void); void (*mTuneRequestCallback)(void);
void (*mClockCallback)(void); void (*mClockCallback)(void);
@ -199,19 +196,20 @@ private:
#if MIDI_BUILD_THRU #if MIDI_BUILD_THRU
public: public:
inline void turnThruOn(ThruFlags inThruFlags = ThruFilterFlags::all); inline MidiFilterMode getFilterMode() const;
inline bool getThruState() const;
inline void turnThruOn(MidiFilterMode inThruFilterMode = Full);
inline void turnThruOff(); inline void turnThruOff();
inline void setThruFilterMode(MidiFilterMode inThruFilterMode);
inline void setThruFilterMode(ThruFlags inFlags);
inline ThruFlags getThruFilterMode() const;
inline bool isThruOn() const;
inline bool hasThruFlag(byte inFlag) const;
private: private:
inline bool shouldMessageBeForwarded(StatusByte inStatus) const; void thruFilter(byte inChannel);
private: private:
ThruFlags mThruFlags; bool mThruActivated : 1;
MidiFilterMode mThruFilterMode : 7;
#endif // MIDI_BUILD_THRU #endif // MIDI_BUILD_THRU

File diff suppressed because it is too large Load Diff

View File

@ -61,31 +61,15 @@ enum MidiType
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! Enumeration of Thru filter modes /*! Enumeration of Thru filter modes */
@see setThruFilterMode enum MidiFilterMode
*/
struct ThruFilterFlags
{ {
enum Off = 0, ///< Thru disabled (nothing passes through).
{ Full = 1, ///< Fully enabled Thru (every incoming message is sent back).
off = 0 ///< Thru disabled (nothing passes through). SameChannel = 2, ///< Only the messages on the Input Channel will be sent back.
DifferentChannel = 3, ///< All the messages but the ones on the Input Channel will be sent back.
, channelSame = (1 << 0) ///< Only the messages on the Input Channel will be sent back.
, channelDifferent = (1 << 1) ///< All the messages but the ones on the Input Channel will be sent back.
, channel = channelSame | channelDifferent
, systemExclusive = (1 << 2)
, systemCommon = (1 << 3)
, systemRealtime = (1 << 4)
, system = systemExclusive | systemCommon | systemRealtime
, junk = (1 << 7) ///< Send mis-formated data back (unadvisable)
/// Fully enabled Thru (every incoming message is sent back).
, all = channel | systemExclusive | systemCommon | systemRealtime
};
}; };
typedef byte ThruFlags;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! \brief Enumeration of Control Change command numbers. /*! \brief Enumeration of Control Change command numbers.