FastLED 3.9.7
Loading...
Searching...
No Matches
MidiInterface< Transport, _Settings, _Platform > Class Template Reference

Detailed Description

template<class Transport, class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
class MidiInterface< Transport, _Settings, _Platform >

The main class for MIDI handling. It is templated over the type of serial port to provide abstraction from the hardware interface, meaning you can use HardwareSerial, SoftwareSerial or ak47's Uart classes. The only requirement is that the class implements the begin, read, write and available methods.

Definition at line 54 of file MIDI.h.

#include <MIDI.h>

Public Types

typedef _Settings Settings
 
typedef _Platform Platform
 
typedef Message< Settings::SysExMaxSize > MidiMessage
 

Public Member Functions

 MidiInterface (Transport &)
 Constructor for MidiInterface.
 
 ~MidiInterface ()
 Destructor for MidiInterface.
 
void begin (Channel inChannel=1)
 Call the begin method in the setup() function of the Arduino.
 
void sendNoteOn (DataByte inNoteNumber, DataByte inVelocity, Channel inChannel)
 Send a Note On message.
 
void sendNoteOff (DataByte inNoteNumber, DataByte inVelocity, Channel inChannel)
 Send a Note Off message.
 
void sendProgramChange (DataByte inProgramNumber, Channel inChannel)
 Send a Program Change message.
 
void sendControlChange (DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
 Send a Control Change message.
 
void sendPitchBend (int inPitchValue, Channel inChannel)
 Send a Pitch Bend message using a signed integer value.
 
void sendPitchBend (double inPitchValue, Channel inChannel)
 Send a Pitch Bend message using a floating point value.
 
void sendPolyPressure (DataByte inNoteNumber, DataByte inPressure, Channel inChannel)
 Send a Polyphonic AfterTouch message (applies to a specified note)
 
void sendAfterTouch (DataByte inPressure, Channel inChannel)
 Send a MonoPhonic AfterTouch message (applies to all notes)
 
void sendAfterTouch (DataByte inNoteNumber, DataByte inPressure, Channel inChannel)
 Send a Polyphonic AfterTouch message (applies to a specified note)
 
void sendSysEx (unsigned inLength, const byte *inArray, bool inArrayContainsBoundaries=false)
 Generate and send a System Exclusive frame.
 
void sendTimeCodeQuarterFrame (DataByte inTypeNibble, DataByte inValuesNibble)
 Send a MIDI Time Code Quarter Frame.
 
void sendTimeCodeQuarterFrame (DataByte inData)
 Send a MIDI Time Code Quarter Frame.
 
void sendSongPosition (unsigned inBeats)
 Send a Song Position Pointer message.
 
void sendSongSelect (DataByte inSongNumber)
 Send a Song Select message.
 
void sendTuneRequest ()
 Send a Tune Request message.
 
void sendCommon (MidiType inType, unsigned=0)
 Send a Common message. Common messages reset the running status.
 
void sendClock ()
 
void sendStart ()
 
void sendStop ()
 
void sendTick ()
 
void sendContinue ()
 
void sendActiveSensing ()
 
void sendSystemReset ()
 
void sendRealTime (MidiType inType)
 Send a Real Time (one byte) message.
 
void beginRpn (unsigned inNumber, Channel inChannel)
 Start a Registered Parameter Number frame.
 
void sendRpnValue (unsigned inValue, Channel inChannel)
 Send a 14-bit value for the currently selected RPN number.
 
void sendRpnValue (byte inMsb, byte inLsb, Channel inChannel)
 Send separate MSB/LSB values for the currently selected RPN number.
 
void sendRpnIncrement (byte inAmount, Channel inChannel)
 
void sendRpnDecrement (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 beginNrpn (unsigned inNumber, Channel inChannel)
 Start a Non-Registered Parameter Number frame.
 
void sendNrpnValue (unsigned inValue, Channel inChannel)
 Send a 14-bit value for the currently selected NRPN number.
 
void sendNrpnValue (byte inMsb, byte inLsb, Channel inChannel)
 Send separate MSB/LSB values for the currently selected NRPN number.
 
void sendNrpnIncrement (byte inAmount, Channel inChannel)
 
void sendNrpnDecrement (byte inAmount, Channel inChannel)
 
void endNrpn (Channel inChannel)
 Terminate an NRPN frame. This will send a Null Function to deselect the currently selected NRPN.
 
void send (const MidiMessage &)
 Send a MIDI message.
 
void send (MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
 Generate and send a MIDI message from the values given.
 
bool read ()
 Read messages from the serial port using the main input channel.
 
bool read (Channel inChannel)
 Read messages on a specified channel.
 
MidiType getType () const
 Get the last received message's type.
 
Channel getChannel () const
 Get the channel of the message stored in the structure.
 
DataByte getData1 () const
 Get the first data byte of the last received message.
 
DataByte getData2 () const
 Get the second data byte of the last received message.
 
const byte * getSysExArray () const
 Get the System Exclusive byte array.
 
unsigned getSysExArrayLength () const
 Get the length of the System Exclusive array.
 
bool check () const
 Check if a valid message is stored in the structure.
 
Channel getInputChannel () const
 
void setInputChannel (Channel inChannel)
 Set the value for the input MIDI channel.
 
void setHandleMessage (void(*fptr)(const MidiMessage &))
 
void setHandleError (ErrorCallback fptr)
 
void setHandleNoteOff (NoteOffCallback fptr)
 
void setHandleNoteOn (NoteOnCallback fptr)
 
void setHandleAfterTouchPoly (AfterTouchPolyCallback fptr)
 
void setHandleControlChange (ControlChangeCallback fptr)
 
void setHandleProgramChange (ProgramChangeCallback fptr)
 
void setHandleAfterTouchChannel (AfterTouchChannelCallback fptr)
 
void setHandlePitchBend (PitchBendCallback fptr)
 
void setHandleSystemExclusive (SystemExclusiveCallback fptr)
 
void setHandleTimeCodeQuarterFrame (TimeCodeQuarterFrameCallback fptr)
 
void setHandleSongPosition (SongPositionCallback fptr)
 
void setHandleSongSelect (SongSelectCallback fptr)
 
void setHandleTuneRequest (TuneRequestCallback fptr)
 
void setHandleClock (ClockCallback fptr)
 
void setHandleStart (StartCallback fptr)
 
void setHandleTick (TickCallback fptr)
 
void setHandleContinue (ContinueCallback fptr)
 
void setHandleStop (StopCallback fptr)
 
void setHandleActiveSensing (ActiveSensingCallback fptr)
 
void setHandleSystemReset (SystemResetCallback fptr)
 
void disconnectCallbackFromType (MidiType inType)
 Detach an external function from the given type.
 
Thru::Mode getFilterMode () const
 
bool getThruState () const
 
void turnThruOn (Thru::Mode inThruFilterMode=Thru::Full)
 
void turnThruOff ()
 
void setThruFilterMode (Thru::Mode inThruFilterMode)
 Set the filter for thru mirroring.
 
Transport * getTransport ()
 

Static Public Member Functions

static MidiType getTypeFromStatusByte (byte inStatus)
 Extract an enumerated MIDI type from a status byte.
 
static Channel getChannelFromStatusByte (byte inStatus)
 Returns channel in the range 1-16.
 
static bool isChannelMessage (MidiType inType)
 

Member Typedef Documentation

◆ MidiMessage

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
typedef Message<Settings::SysExMaxSize> MidiInterface< Transport, _Settings, _Platform >::MidiMessage

Definition at line 59 of file MIDI.h.

◆ Platform

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
typedef _Platform MidiInterface< Transport, _Settings, _Platform >::Platform

Definition at line 58 of file MIDI.h.

◆ Settings

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
typedef _Settings MidiInterface< Transport, _Settings, _Platform >::Settings

Definition at line 57 of file MIDI.h.

Constructor & Destructor Documentation

◆ MidiInterface()

template<class Transport , class Settings , class Platform >
BEGIN_MIDI_NAMESPACE MidiInterface< Transport, Settings, Platform >::MidiInterface ( Transport & inTransport)
inline

Constructor for MidiInterface.

Definition at line 34 of file MIDI.hpp.

◆ ~MidiInterface()

template<class Transport , class Settings , class Platform >
MidiInterface< Transport, Settings, Platform >::~MidiInterface ( )
inline

Destructor for MidiInterface.

This is not really useful for the Arduino, as it is never called...

Definition at line 59 of file MIDI.hpp.

Member Function Documentation

◆ begin()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::begin ( Channel inChannel = 1)

Call the begin method in the setup() function of the Arduino.

All parameters are set to their default values:

  • Input channel set to 1 if no value is specified
  • Full thru mirroring

Definition at line 72 of file MIDI.hpp.

◆ getTransport()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
Transport * MidiInterface< Transport, _Settings, _Platform >::getTransport ( )
inline

Definition at line 264 of file MIDI.h.

◆ sendActiveSensing()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::sendActiveSensing ( )
inline

Definition at line 119 of file MIDI.h.

◆ sendClock()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::sendClock ( )
inline

Definition at line 114 of file MIDI.h.

◆ sendContinue()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::sendContinue ( )
inline

Definition at line 118 of file MIDI.h.

◆ sendStart()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::sendStart ( )
inline

Definition at line 115 of file MIDI.h.

◆ sendStop()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::sendStop ( )
inline

Definition at line 116 of file MIDI.h.

◆ sendSystemReset()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::sendSystemReset ( )
inline

Definition at line 120 of file MIDI.h.

◆ sendTick()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::sendTick ( )
inline

Definition at line 117 of file MIDI.h.

◆ setHandleActiveSensing()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleActiveSensing ( ActiveSensingCallback fptr)
inline

Definition at line 206 of file MIDI.h.

◆ setHandleAfterTouchChannel()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleAfterTouchChannel ( AfterTouchChannelCallback fptr)
inline

Definition at line 194 of file MIDI.h.

◆ setHandleAfterTouchPoly()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleAfterTouchPoly ( AfterTouchPolyCallback fptr)
inline

Definition at line 191 of file MIDI.h.

◆ setHandleClock()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleClock ( ClockCallback fptr)
inline

Definition at line 201 of file MIDI.h.

◆ setHandleContinue()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleContinue ( ContinueCallback fptr)
inline

Definition at line 204 of file MIDI.h.

◆ setHandleControlChange()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleControlChange ( ControlChangeCallback fptr)
inline

Definition at line 192 of file MIDI.h.

◆ setHandleError()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleError ( ErrorCallback fptr)
inline

Definition at line 188 of file MIDI.h.

◆ setHandleMessage()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleMessage ( void(* fptr )(const MidiMessage &))
inline

Definition at line 187 of file MIDI.h.

◆ setHandleNoteOff()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleNoteOff ( NoteOffCallback fptr)
inline

Definition at line 189 of file MIDI.h.

◆ setHandleNoteOn()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleNoteOn ( NoteOnCallback fptr)
inline

Definition at line 190 of file MIDI.h.

◆ setHandlePitchBend()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandlePitchBend ( PitchBendCallback fptr)
inline

Definition at line 195 of file MIDI.h.

◆ setHandleProgramChange()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleProgramChange ( ProgramChangeCallback fptr)
inline

Definition at line 193 of file MIDI.h.

◆ setHandleSongPosition()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleSongPosition ( SongPositionCallback fptr)
inline

Definition at line 198 of file MIDI.h.

◆ setHandleSongSelect()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleSongSelect ( SongSelectCallback fptr)
inline

Definition at line 199 of file MIDI.h.

◆ setHandleStart()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleStart ( StartCallback fptr)
inline

Definition at line 202 of file MIDI.h.

◆ setHandleStop()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleStop ( StopCallback fptr)
inline

Definition at line 205 of file MIDI.h.

◆ setHandleSystemExclusive()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleSystemExclusive ( SystemExclusiveCallback fptr)
inline

Definition at line 196 of file MIDI.h.

◆ setHandleSystemReset()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleSystemReset ( SystemResetCallback fptr)
inline

Definition at line 207 of file MIDI.h.

◆ setHandleTick()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleTick ( TickCallback fptr)
inline

Definition at line 203 of file MIDI.h.

◆ setHandleTimeCodeQuarterFrame()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleTimeCodeQuarterFrame ( TimeCodeQuarterFrameCallback fptr)
inline

Definition at line 197 of file MIDI.h.

◆ setHandleTuneRequest()

template<class Transport , class _Settings = DefaultSettings, class _Platform = DefaultPlatform>
void MidiInterface< Transport, _Settings, _Platform >::setHandleTuneRequest ( TuneRequestCallback fptr)
inline

Definition at line 200 of file MIDI.h.


The documentation for this class was generated from the following files: