Arduino MIDI Library
Version 5.0.1
|
Go to the documentation of this file.
41 #define MIDI_LIBRARY_VERSION 0x050000
42 #define MIDI_LIBRARY_VERSION_MAJOR 5
43 #define MIDI_LIBRARY_VERSION_MINOR 0
44 #define MIDI_LIBRARY_VERSION_PATCH 0
52 template<
class Transport,
class _Settings = DefaultSettings,
class _Platform = DefaultPlatform>
91 Channel inChannel) __attribute__ ((deprecated));
101 bool inArrayContainsBoundaries =
false);
123 inline void beginRpn(
unsigned inNumber,
171 inline bool check()
const;
211 void launchCallback();
213 void (*mMessageCallback)(
const MidiMessage& message) =
nullptr;
247 void thruFilter(
byte inChannel);
254 inline void handleNullVelocityNoteOnAsNoteOff();
255 inline bool inputFilter(
Channel inChannel);
256 inline void resetInput();
257 inline void UpdateLastSentTime();
266 Transport& mTransport;
275 byte mPendingMessage[3];
276 unsigned mPendingMessageExpectedLength;
277 unsigned mPendingMessageIndex;
278 unsigned mCurrentRpnNumber;
279 unsigned mCurrentNrpnNumber;
280 bool mThruActivated : 1;
283 unsigned long mLastMessageSentTime;
284 unsigned long mLastMessageReceivedTime;
285 unsigned long mSenderActiveSensingPeriodicity;
286 bool mReceiverActiveSensingActivated;
299 bool inFlipHeaderBits =
false);
303 bool inFlipHeaderBits =
false);
void setInputChannel(Channel inChannel)
Set the value for the input MIDI channel.
~MidiInterface()
Destructor for MidiInterface.
void sendNrpnDecrement(byte inAmount, Channel inChannel)
@ Clock
System Real Time - Timing Clock.
void(*)(byte songnumber) SongSelectCallback
void setHandleNoteOn(NoteOnCallback fptr)
void turnThruOn(Thru::Mode inThruFilterMode=Thru::Full)
@ SystemReset
System Real Time - System Reset.
DataByte getData1() const
Get the first data byte of the last received message.
MIDI Library for the Arduino - Definitions.
void(*)(Channel channel, byte note, byte velocity) NoteOnCallback
DataByte getData2() const
Get the second data byte of the last received message.
void(*)(Channel channel, int) PitchBendCallback
void(*)(Channel channel, byte) ProgramChangeCallback
bool check() const
Check if a valid message is stored in the structure.
void sendRpnDecrement(byte inAmount, Channel inChannel)
void(*)(void) StartCallback
void setHandleTimeCodeQuarterFrame(TimeCodeQuarterFrameCallback fptr)
MidiInterface(Transport &)
Constructor for MidiInterface.
void setHandleStop(StopCallback fptr)
void beginRpn(unsigned inNumber, Channel inChannel)
Start a Registered Parameter Number frame.
MIDI Library for the Arduino - Platform @license MIT - Copyright (c) 2015 Francois Best.
void sendSongSelect(DataByte inSongNumber)
Send a Song Select message.
void setHandleSongSelect(SongSelectCallback fptr)
void(*)(unsigned beats) SongPositionCallback
unsigned decodeSysEx(const byte *inSysEx, byte *outData, unsigned inLength, bool inFlipHeaderBits=false)
Decode System Exclusive messages. SysEx messages are encoded to guarantee transmission of data bytes ...
#define END_MIDI_NAMESPACE
@ Start
System Real Time - Start.
void(*)(Channel channel, byte note, byte velocity) AfterTouchPolyCallback
void sendSongPosition(unsigned inBeats)
Send a Song Position Pointer message.
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
void endNrpn(Channel inChannel)
Terminate an NRPN frame. This will send a Null Function to deselect the currently selected NRPN.
void sendCommon(MidiType inType, unsigned=0)
Send a Common message. Common messages reset the running status.
void setHandleTuneRequest(TuneRequestCallback fptr)
void sendNoteOn(DataByte inNoteNumber, DataByte inVelocity, Channel inChannel)
Send a Note On message.
void sendNrpnValue(unsigned inValue, Channel inChannel)
Send a 14-bit value for the currently selected NRPN number.
Thru::Mode getFilterMode() const
void setHandleActiveSensing(ActiveSensingCallback fptr)
MIDI Library for the Arduino - Message struct definition.
void(*)(int8_t) ErrorCallback
Transport * getTransport()
void sendRealTime(MidiType inType)
Send a Real Time (one byte) message.
void sendTimeCodeQuarterFrame(DataByte inTypeNibble, DataByte inValuesNibble)
Send a MIDI Time Code Quarter Frame.
void sendRpnValue(unsigned inValue, Channel inChannel)
Send a 14-bit value for the currently selected RPN number.
void setHandleTick(TickCallback fptr)
void send(const MidiMessage &)
Send a MIDI message.
MIDI Library for the Arduino - Inline implementations.
void(*)(void) ActiveSensingCallback
void beginNrpn(unsigned inNumber, Channel inChannel)
Start a Non-Registered Parameter Number frame.
void setHandleProgramChange(ProgramChangeCallback fptr)
void sendProgramChange(DataByte inProgramNumber, Channel inChannel)
Send a Program Change message.
unsigned encodeSysEx(const byte *inData, byte *outSysEx, unsigned inLength, bool inFlipHeaderBits=false)
Encode System Exclusive messages. SysEx messages are encoded to guarantee transmission of data bytes ...
void sendNoteOff(DataByte inNoteNumber, DataByte inVelocity, Channel inChannel)
Send a Note Off message.
static bool isChannelMessage(MidiType inType)
static MidiType getTypeFromStatusByte(byte inStatus)
Extract an enumerated MIDI type from a status byte.
void(*)(void) TuneRequestCallback
void(*)(byte data) TimeCodeQuarterFrameCallback
void setHandleSystemReset(SystemResetCallback fptr)
void(*)(Channel channel, byte) AfterTouchChannelCallback
bool getThruState() const
The main class for MIDI handling. It is templated over the type of serial port to provide abstraction...
void sendAfterTouch(DataByte inPressure, Channel inChannel)
Send a MonoPhonic AfterTouch message (applies to all notes)
const byte * getSysExArray() const
Get the System Exclusive byte array.
void setHandleError(ErrorCallback fptr)
void(*)(void) ContinueCallback
void setHandleControlChange(ControlChangeCallback fptr)
void setHandleClock(ClockCallback fptr)
@ Continue
System Real Time - Continue.
MidiType getType() const
Get the last received message's type.
void disconnectCallbackFromType(MidiType inType)
Detach an external function from the given type.
void sendPolyPressure(DataByte inNoteNumber, DataByte inPressure, Channel inChannel) __attribute__((deprecated))
Send a Polyphonic AfterTouch message (applies to a specified note)
unsigned getSysExArrayLength() const
Get the length of the System Exclusive array.
Message< Settings::SysExMaxSize > MidiMessage
void(*)(byte *array, unsigned size) SystemExclusiveCallback
void begin(Channel inChannel=1)
Call the begin method in the setup() function of the Arduino.
void(*)(void) SystemResetCallback
void(*)(void) ClockCallback
void endRpn(Channel inChannel)
Terminate an RPN frame. This will send a Null Function to deselect the currently selected RPN.
void setThruFilterMode(Thru::Mode inThruFilterMode)
Set the filter for thru mirroring.
Channel getInputChannel() const
void(*)(void) StopCallback
@ ActiveSensing
System Real Time - Active Sensing.
MIDI Library for the Arduino - Settings.
void setHandlePitchBend(PitchBendCallback fptr)
#define BEGIN_MIDI_NAMESPACE
void sendTuneRequest()
Send a Tune Request message.
@ Full
Fully enabled Thru (every incoming message is sent back).
void setHandleStart(StartCallback fptr)
@ Stop
System Real Time - Stop.
@ Tick
System Real Time - Timing Tick (1 tick = 10 milliseconds)
void setHandleAfterTouchChannel(AfterTouchChannelCallback fptr)
void(*)(Channel channel, byte, byte) ControlChangeCallback
void sendNrpnIncrement(byte inAmount, Channel inChannel)
void setHandleSystemExclusive(SystemExclusiveCallback fptr)
void setHandleContinue(ContinueCallback fptr)
void(*)(void) TickCallback
Channel getChannel() const
Get the channel of the message stored in the structure.
bool read()
Read messages from the serial port using the main input channel.
MIDI Library for the Arduino - Platform @license MIT - Copyright (c) 2015 Francois Best.
void sendRpnIncrement(byte inAmount, Channel inChannel)
void sendSysEx(unsigned inLength, const byte *inArray, bool inArrayContainsBoundaries=false)
Generate and send a System Exclusive frame.
void setHandleNoteOff(NoteOffCallback fptr)
void setHandleAfterTouchPoly(AfterTouchPolyCallback fptr)
static Channel getChannelFromStatusByte(byte inStatus)
Returns channel in the range 1-16.
void sendPitchBend(int inPitchValue, Channel inChannel)
Send a Pitch Bend message using a signed integer value.
void setHandleSongPosition(SongPositionCallback fptr)
void setHandleMessage(void(*fptr)(const MidiMessage &))
void(*)(Channel channel, byte note, byte velocity) NoteOffCallback