33template<
class Transport,
class Settings,
class Platform>
58template<
class Transport,
class Settings,
class Platform>
71template<
class Transport,
class Settings,
class Platform>
117template<
class Transport,
class Settings,
class Platform>
120 if (!inMessage.
valid)
159template<
class Transport,
class Settings,
class Platform>
182 if (Settings::UseRunningStatus)
225template<
class Transport,
class Settings,
class Platform>
230 send(
NoteOn, inNoteNumber, inVelocity, inChannel);
244template<
class Transport,
class Settings,
class Platform>
249 send(
NoteOff, inNoteNumber, inVelocity, inChannel);
256template<
class Transport,
class Settings,
class Platform>
269template<
class Transport,
class Settings,
class Platform>
284template<
class Transport,
class Settings,
class Platform>
296template<
class Transport,
class Settings,
class Platform>
309template<
class Transport,
class Settings,
class Platform>
323template<
class Transport,
class Settings,
class Platform>
328 send(
PitchBend, (bend & 0x7f), (bend >> 7) & 0x7f, inChannel);
338template<
class Transport,
class Settings,
class Platform>
343 const int value = int(inPitchValue *
double(
scale));
356template<
class Transport,
class Settings,
class Platform>
359 bool inArrayContainsBoundaries)
361 const bool writeBeginEndBytes = !inArrayContainsBoundaries;
365 if (writeBeginEndBytes)
368 for (
unsigned i = 0; i < inLength; ++i)
371 if (writeBeginEndBytes)
378 if (Settings::UseRunningStatus)
387template<
class Transport,
class Settings,
class Platform>
399template<
class Transport,
class Settings,
class Platform>
403 const byte data =
byte((((inTypeNibble & 0x07) << 4) | (inValuesNibble & 0x0f)));
413template<
class Transport,
class Settings,
class Platform>
422template<
class Transport,
class Settings,
class Platform>
429template<
class Transport,
class Settings,
class Platform>
442template<
class Transport,
class Settings,
class Platform>
481 if (Settings::UseRunningStatus)
491template<
class Transport,
class Settings,
class Platform>
522template<
class Transport,
class Settings,
class Platform>
528 const byte numMsb = 0x7f & (inNumber >> 7);
529 const byte numLsb = 0x7f & inNumber;
540template<
class Transport,
class Settings,
class Platform>
544 const byte valMsb = 0x7f & (inValue >> 7);
545 const byte valLsb = 0x7f & inValue;
555template<
class Transport,
class Settings,
class Platform>
567template<
class Transport,
class Settings,
class Platform>
577template<
class Transport,
class Settings,
class Platform>
588template<
class Transport,
class Settings,
class Platform>
602template<
class Transport,
class Settings,
class Platform>
608 const byte numMsb = 0x7f & (inNumber >> 7);
609 const byte numLsb = 0x7f & inNumber;
620template<
class Transport,
class Settings,
class Platform>
624 const byte valMsb = 0x7f & (inValue >> 7);
625 const byte valLsb = 0x7f & inValue;
635template<
class Transport,
class Settings,
class Platform>
647template<
class Transport,
class Settings,
class Platform>
657template<
class Transport,
class Settings,
class Platform>
668template<
class Transport,
class Settings,
class Platform>
680template<
class Transport,
class Settings,
class Platform>
684 return StatusByte(((
byte)inType | ((inChannel - 1) & 0x0f)));
703template<
class Transport,
class Settings,
class Platform>
711template<
class Transport,
class Settings,
class Platform>
714 #ifndef RegionActiveSending
745 #ifndef RegionActiveSending
782template<
class Transport,
class Settings,
class Platform>
804 return (Settings::Use1ByteParsing) ? false :
parse();
818 if (extracted < 0x80)
881 mMessage.sysexArray[0] = pendingType;
917 return (Settings::Use1ByteParsing) ? false :
parse();
922 if (extracted >= 0x80)
1007 auto lastByte =
mMessage.sysexArray[Settings::SysExMaxSize - 1];
1012 mMessage.data1 = Settings::SysExMaxSize & 0xff;
1015 mMessage.length = Settings::SysExMaxSize;
1073 return (Settings::Use1ByteParsing) ? false :
parse();
1079template<
class Transport,
class Settings,
class Platform>
1082 if (Settings::HandleNullVelocityNoteOnAsNoteOff &&
1090template<
class Transport,
class Settings,
class Platform>
1100 if ((
mMessage.channel == inChannel) ||
1119template<
class Transport,
class Settings,
class Platform>
1133template<
class Transport,
class Settings,
class Platform>
1144template<
class Transport,
class Settings,
class Platform>
1151template<
class Transport,
class Settings,
class Platform>
1158template<
class Transport,
class Settings,
class Platform>
1168template<
class Transport,
class Settings,
class Platform>
1179template<
class Transport,
class Settings,
class Platform>
1186template<
class Transport,
class Settings,
class Platform>
1194template<
class Transport,
class Settings,
class Platform>
1204template<
class Transport,
class Settings,
class Platform>
1217template<
class Transport,
class Settings,
class Platform>
1220 if ((inStatus < 0x80) ||
1226 if (inStatus < 0xf0)
1235template<
class Transport,
class Settings,
class Platform>
1238 return Channel((inStatus & 0x0f) + 1);
1241template<
class Transport,
class Settings,
class Platform>
1261template<
class Transport,
class Settings,
class Platform>
1293template<
class Transport,
class Settings,
class Platform>
1351template<
class Transport,
class Settings,
class Platform>
1358template<
class Transport,
class Settings,
class Platform>
1364template<
class Transport,
class Settings,
class Platform>
1370template<
class Transport,
class Settings,
class Platform>
1377template<
class Transport,
class Settings,
class Platform>
1384template<
class Transport,
class Settings,
class Platform>
1399template<
class Transport,
class Settings,
class Platform>
1409 const bool filter_condition = ((
mMessage.channel == inChannel) ||
1423 if (filter_condition)
1433 if (!filter_condition)
UISlider scale("Scale", 4,.1, 4,.1)
StatusByte mRunningStatus_RX
~MidiInterface()
Destructor for MidiInterface.
ContinueCallback mContinueCallback
AfterTouchPolyCallback mAfterTouchPolyCallback
unsigned long mLastMessageReceivedTime
Message< Settings::SysExMaxSize > MidiMessage
ActiveSensingCallback mActiveSensingCallback
StatusByte getStatus(MidiType inType, Channel inChannel) const
TimeCodeQuarterFrameCallback mTimeCodeQuarterFrameCallback
ControlChangeCallback mControlChangeCallback
void(* mMessageCallback)(const MidiMessage &message)
TickCallback mTickCallback
ErrorCallback mErrorCallback
unsigned mPendingMessageExpectedLength
TuneRequestCallback mTuneRequestCallback
ClockCallback mClockCallback
SongSelectCallback mSongSelectCallback
StopCallback mStopCallback
bool mReceiverActiveSensingActivated
NoteOnCallback mNoteOnCallback
void thruFilter(byte inChannel)
unsigned mCurrentNrpnNumber
unsigned long mLastMessageSentTime
MidiInterface(Transport &)
Constructor for MidiInterface.
SongPositionCallback mSongPositionCallback
AfterTouchChannelCallback mAfterTouchChannelCallback
SystemResetCallback mSystemResetCallback
StartCallback mStartCallback
unsigned mPendingMessageIndex
Thru::Mode mThruFilterMode
SystemExclusiveCallback mSystemExclusiveCallback
ProgramChangeCallback mProgramChangeCallback
unsigned long mSenderActiveSensingPeriodicity
void begin(Channel inChannel=1)
Call the begin method in the setup() function of the Arduino.
StatusByte mRunningStatus_TX
PitchBendCallback mPitchBendCallback
unsigned mCurrentRpnNumber
NoteOffCallback mNoteOffCallback
void sendNrpnIncrement(byte inAmount, Channel inChannel)
void sendRpnIncrement(byte inAmount, Channel inChannel)
void sendAfterTouch(DataByte inPressure, Channel inChannel)
Send a MonoPhonic AfterTouch message (applies to all notes)
void sendNrpnDecrement(byte inAmount, Channel inChannel)
void endRpn(Channel inChannel)
Terminate an RPN frame. This will send a Null Function to deselect the currently selected RPN.
void sendPitchBend(int inPitchValue, Channel inChannel)
Send a Pitch Bend message using a signed integer value.
void sendTimeCodeQuarterFrame(DataByte inTypeNibble, DataByte inValuesNibble)
Send a MIDI Time Code Quarter Frame.
void endNrpn(Channel inChannel)
Terminate an NRPN frame. This will send a Null Function to deselect the currently selected NRPN.
void sendNoteOn(DataByte inNoteNumber, DataByte inVelocity, Channel inChannel)
Send a Note On message.
void sendTuneRequest()
Send a Tune Request message.
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
void send(const MidiMessage &)
Send a MIDI message.
void sendProgramChange(DataByte inProgramNumber, Channel inChannel)
Send a Program Change message.
void beginNrpn(unsigned inNumber, Channel inChannel)
Start a Non-Registered Parameter Number frame.
void beginRpn(unsigned inNumber, Channel inChannel)
Start a Registered Parameter Number frame.
void sendSongPosition(unsigned inBeats)
Send a Song Position Pointer message.
void sendPolyPressure(DataByte inNoteNumber, DataByte inPressure, Channel inChannel)
Send a Polyphonic AfterTouch message (applies to a specified note)
void sendSongSelect(DataByte inSongNumber)
Send a Song Select message.
void sendCommon(MidiType inType, unsigned=0)
Send a Common message. Common messages reset the running status.
void sendRpnDecrement(byte inAmount, Channel inChannel)
void sendRpnValue(unsigned inValue, Channel inChannel)
Send a 14-bit value for the currently selected RPN number.
void sendRealTime(MidiType inType)
Send a Real Time (one byte) message.
void sendSysEx(unsigned inLength, const byte *inArray, bool inArrayContainsBoundaries=false)
Generate and send a System Exclusive frame.
void sendNoteOff(DataByte inNoteNumber, DataByte inVelocity, Channel inChannel)
Send a Note Off message.
void sendNrpnValue(unsigned inValue, Channel inChannel)
Send a 14-bit value for the currently selected NRPN number.
void turnThruOn(Thru::Mode inThruFilterMode=Thru::Full)
Thru::Mode getFilterMode() const
void UpdateLastSentTime()
bool getThruState() const
void setThruFilterMode(Thru::Mode inThruFilterMode)
Set the filter for thru mirroring.
#define MIDI_PITCHBEND_MAX
static const uint8_t ErrorParse
@ RPNLSB
Registered Parameter Number (LSB)
@ RPNMSB
Registered Parameter Number (MSB)
@ NRPNLSB
Non-Registered Parameter Number (LSB)
@ NRPNMSB
Non-Registered Parameter Number (MSB)
#define MIDI_PITCHBEND_MIN
@ AfterTouchChannel
Channel Message - Channel (monophonic) AfterTouch.
@ ProgramChange
Channel Message - Program Change.
@ SystemExclusiveStart
System Exclusive Start.
@ Continue
System Real Time - Continue.
@ Clock
System Real Time - Timing Clock.
@ ActiveSensing
System Real Time - Active Sensing.
@ SystemReset
System Real Time - System Reset.
@ SystemExclusive
System Exclusive.
@ InvalidType
For notifying errors.
@ SongPosition
System Common - Song Position Pointer.
@ Tick
System Real Time - Timing Tick (1 tick = 10 milliseconds)
@ TuneRequest
System Common - Tune Request.
@ Start
System Real Time - Start.
@ ControlChange
Channel Message - Control Change / Channel Mode.
@ PitchBend
Channel Message - Pitch Bend.
@ NoteOff
Channel Message - Note Off.
@ SongSelect
System Common - Song Select.
@ SystemExclusiveEnd
System Exclusive End.
@ AfterTouchPoly
Channel Message - Polyphonic AfterTouch.
@ Stop
System Real Time - Stop.
@ TimeCodeQuarterFrame
System Common - MIDI Time Code Quarter Frame.
@ NoteOn
Channel Message - Note On.
#define MIDI_CHANNEL_OMNI
static const uint8_t ErrorActiveSensingTimeout
static const uint16_t ActiveSensingTimeout
#define END_MIDI_NAMESPACE
#define BEGIN_MIDI_NAMESPACE
static const unsigned sSysExMaxSize
DataByte sysexArray[sSysExMaxSize]
unsigned getSysExSize() const
@ DifferentChannel
All the messages but the ones on the Input Channel will be sent back.
@ Full
Fully enabled Thru (every incoming message is sent back).
@ Off
Thru disabled (nothing passes through).
@ SameChannel
Only the messages on the Input Channel will be sent back.