Working on thru.
This commit is contained in:
parent
d8e0631399
commit
8c9d289216
35
src/MIDI.h
35
src/MIDI.h
|
|
@ -68,7 +68,7 @@ public:
|
||||||
inline void sendAfterTouch(DataByte inPressure,
|
inline void sendAfterTouch(DataByte inPressure,
|
||||||
Channel inChannel);
|
Channel inChannel);
|
||||||
|
|
||||||
inline void sendSysEx(unsigned int inLength,
|
inline void sendSysEx(unsigned 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 int inBeats);
|
inline void sendSongPosition(unsigned 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 int getSysExArrayLength() const;
|
inline unsigned getSysExArrayLength() const;
|
||||||
inline bool check() const;
|
inline bool check() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -119,6 +119,7 @@ public:
|
||||||
public:
|
public:
|
||||||
static inline MidiType getTypeFromStatusByte(byte inStatus);
|
static inline MidiType getTypeFromStatusByte(byte inStatus);
|
||||||
static inline bool isChannelMessage(MidiType inType);
|
static inline bool isChannelMessage(MidiType inType);
|
||||||
|
static inline bool isRealtimeMessage(MidiType inType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool inputFilter(Channel inChannel);
|
bool inputFilter(Channel inChannel);
|
||||||
|
|
@ -130,8 +131,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 int mPendingMessageExpectedLenght;
|
unsigned mPendingMessageExpectedLenght;
|
||||||
unsigned int mPendingMessageIndex; // Extended to unsigned int for larger SysEx payloads.
|
unsigned mPendingMessageIndex; // Extended to unsigned for larger SysEx payloads.
|
||||||
Message mMessage;
|
Message mMessage;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -150,7 +151,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 int beats));
|
inline void setHandleSongPosition(void (*fptr)(unsigned 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));
|
||||||
|
|
@ -175,7 +176,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 int beats);
|
void (*mSongPositionCallback)(unsigned beats);
|
||||||
void (*mSongSelectCallback)(byte songnumber);
|
void (*mSongSelectCallback)(byte songnumber);
|
||||||
void (*mTuneRequestCallback)(void);
|
void (*mTuneRequestCallback)(void);
|
||||||
void (*mClockCallback)(void);
|
void (*mClockCallback)(void);
|
||||||
|
|
@ -196,20 +197,20 @@ private:
|
||||||
#if MIDI_BUILD_THRU
|
#if MIDI_BUILD_THRU
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline MidiFilterMode getFilterMode() const;
|
inline void turnThruOn(ThruFlags inThruFlags = ThruFilterFlags::all);
|
||||||
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:
|
||||||
void thruFilter(byte inChannel);
|
inline bool shouldMessageBeForwarded(StatusByte inStatus) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mThruActivated : 1;
|
ThruFlags mThruFlags;
|
||||||
MidiFilterMode mThruFilterMode : 7;
|
bool mForwardCurrentMessage;
|
||||||
|
|
||||||
#endif // MIDI_BUILD_THRU
|
#endif // MIDI_BUILD_THRU
|
||||||
|
|
||||||
|
|
|
||||||
538
src/MIDI.hpp
538
src/MIDI.hpp
File diff suppressed because it is too large
Load Diff
|
|
@ -62,7 +62,7 @@ enum MidiType
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
/*! Enumeration of Thru filter modes */
|
/*! Enumeration of Thru filter modes */
|
||||||
enum MidiFilterMode
|
enum MidiFilterMode
|
||||||
{
|
{
|
||||||
Off = 0, ///< Thru disabled (nothing passes through).
|
Off = 0, ///< Thru disabled (nothing passes through).
|
||||||
Full = 1, ///< Fully enabled Thru (every incoming message is sent back).
|
Full = 1, ///< Fully enabled Thru (every incoming message is sent back).
|
||||||
|
|
@ -70,6 +70,23 @@ enum MidiFilterMode
|
||||||
DifferentChannel = 3, ///< All the messages but the ones on the Input Channel will be sent back.
|
DifferentChannel = 3, ///< All the messages but the ones on the Input Channel will be sent back.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ThruFilterFlags
|
||||||
|
{
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
off = 0
|
||||||
|
|
||||||
|
, channelSame = 1
|
||||||
|
, channelDifferent = 2
|
||||||
|
, channel = channelSame | channelDifferent
|
||||||
|
, system = 4
|
||||||
|
, realtime = 8
|
||||||
|
, all = channel | system | realtime
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef byte ThruFlags;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
/*! \brief Enumeration of Control Change command numbers.
|
/*! \brief Enumeration of Control Change command numbers.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue