Arduino MIDI Library  Version 5.0.1
MIDI Output

Functions

void MidiInterface< Transport, _Settings, _Platform >::send (const MidiMessage &)
 Send a MIDI message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::send (MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
 Generate and send a MIDI message from the values given. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendNoteOn (DataByte inNoteNumber, DataByte inVelocity, Channel inChannel)
 Send a Note On message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendNoteOff (DataByte inNoteNumber, DataByte inVelocity, Channel inChannel)
 Send a Note Off message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendProgramChange (DataByte inProgramNumber, Channel inChannel)
 Send a Program Change message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendControlChange (DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
 Send a Control Change message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendPolyPressure (DataByte inNoteNumber, DataByte inPressure, Channel inChannel) __attribute__((deprecated))
 Send a Polyphonic AfterTouch message (applies to a specified note) More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendAfterTouch (DataByte inPressure, Channel inChannel)
 Send a MonoPhonic AfterTouch message (applies to all notes) More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendAfterTouch (DataByte inNoteNumber, DataByte inPressure, Channel inChannel)
 Send a Polyphonic AfterTouch message (applies to a specified note) More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendPitchBend (int inPitchValue, Channel inChannel)
 Send a Pitch Bend message using a signed integer value. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendPitchBend (double inPitchValue, Channel inChannel)
 Send a Pitch Bend message using a floating point value. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendSysEx (unsigned inLength, const byte *inArray, bool inArrayContainsBoundaries=false)
 Generate and send a System Exclusive frame. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendTuneRequest ()
 Send a Tune Request message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendTimeCodeQuarterFrame (DataByte inTypeNibble, DataByte inValuesNibble)
 Send a MIDI Time Code Quarter Frame. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendTimeCodeQuarterFrame (DataByte inData)
 Send a MIDI Time Code Quarter Frame. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendSongPosition (unsigned inBeats)
 Send a Song Position Pointer message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendSongSelect (DataByte inSongNumber)
 Send a Song Select message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendCommon (MidiType inType, unsigned=0)
 Send a Common message. Common messages reset the running status. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendRealTime (MidiType inType)
 Send a Real Time (one byte) message. More...
 
void MidiInterface< Transport, _Settings, _Platform >::beginRpn (unsigned inNumber, Channel inChannel)
 Start a Registered Parameter Number frame. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendRpnValue (unsigned inValue, Channel inChannel)
 Send a 14-bit value for the currently selected RPN number. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendRpnValue (byte inMsb, byte inLsb, Channel inChannel)
 Send separate MSB/LSB values for the currently selected RPN number. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendRpnIncrement (byte inAmount, Channel inChannel)
 
void MidiInterface< Transport, _Settings, _Platform >::sendRpnDecrement (byte inAmount, Channel inChannel)
 
void MidiInterface< Transport, _Settings, _Platform >::endRpn (Channel inChannel)
 Terminate an RPN frame. This will send a Null Function to deselect the currently selected RPN. More...
 
void MidiInterface< Transport, _Settings, _Platform >::beginNrpn (unsigned inNumber, Channel inChannel)
 Start a Non-Registered Parameter Number frame. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendNrpnValue (unsigned inValue, Channel inChannel)
 Send a 14-bit value for the currently selected NRPN number. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendNrpnValue (byte inMsb, byte inLsb, Channel inChannel)
 Send separate MSB/LSB values for the currently selected NRPN number. More...
 
void MidiInterface< Transport, _Settings, _Platform >::sendNrpnIncrement (byte inAmount, Channel inChannel)
 
void MidiInterface< Transport, _Settings, _Platform >::sendNrpnDecrement (byte inAmount, Channel inChannel)
 
void MidiInterface< Transport, _Settings, _Platform >::endNrpn (Channel inChannel)
 Terminate an NRPN frame. This will send a Null Function to deselect the currently selected NRPN. More...
 

Detailed Description

Function Documentation

◆ beginNrpn()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::beginNrpn ( unsigned  inNumber,
Channel  inChannel 
)
inline

Start a Non-Registered Parameter Number frame.

Parameters
inNumberThe 14-bit number of the NRPN you want to select.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 603 of file MIDI.hpp.

605 {
606  if (mCurrentNrpnNumber != inNumber)
607  {
608  const byte numMsb = 0x7f & (inNumber >> 7);
609  const byte numLsb = 0x7f & inNumber;
610  sendControlChange(NRPNLSB, numLsb, inChannel);
611  sendControlChange(NRPNMSB, numMsb, inChannel);
612  mCurrentNrpnNumber = inNumber;
613  }
614 }

◆ beginRpn()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::beginRpn ( unsigned  inNumber,
Channel  inChannel 
)
inline

Start a Registered Parameter Number frame.

Parameters
inNumberThe 14-bit number of the RPN you want to select.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 523 of file MIDI.hpp.

525 {
526  if (mCurrentRpnNumber != inNumber)
527  {
528  const byte numMsb = 0x7f & (inNumber >> 7);
529  const byte numLsb = 0x7f & inNumber;
530  sendControlChange(RPNLSB, numLsb, inChannel);
531  sendControlChange(RPNMSB, numMsb, inChannel);
532  mCurrentRpnNumber = inNumber;
533  }
534 }

◆ endNrpn()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::endNrpn ( Channel  inChannel)
inline

Terminate an NRPN frame. This will send a Null Function to deselect the currently selected NRPN.

Parameters
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 669 of file MIDI.hpp.

670 {
671  sendControlChange(NRPNLSB, 0x7f, inChannel);
672  sendControlChange(NRPNMSB, 0x7f, inChannel);
673  mCurrentNrpnNumber = 0xffff;
674 }

◆ endRpn()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::endRpn ( Channel  inChannel)
inline

Terminate an RPN frame. This will send a Null Function to deselect the currently selected RPN.

Parameters
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 589 of file MIDI.hpp.

590 {
591  sendControlChange(RPNLSB, 0x7f, inChannel);
592  sendControlChange(RPNMSB, 0x7f, inChannel);
593  mCurrentRpnNumber = 0xffff;
594 }

◆ send() [1/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::send ( const MidiMessage inMessage)
inline

Send a MIDI message.

Parameters
inMessageThe message

This method is used when you want to send a Message that has not been constructed by the library, but by an external source. This method does not check against any of the constraints. Typically this function is use by MIDI Bridges taking MIDI messages and passing them thru.

Definition at line 118 of file MIDI.hpp.

119 {
120  if (!inMessage.valid)
121  return;
122 
123  if (mTransport.beginTransmission(inMessage.type))
124  {
125  const StatusByte status = getStatus(inMessage.type, inMessage.channel);
126  mTransport.write(status);
127 
128  if (inMessage.type != MidiType::SystemExclusive)
129  {
130  if (inMessage.length > 1) mTransport.write(inMessage.data1);
131  if (inMessage.length > 2) mTransport.write(inMessage.data2);
132  } else
133  {
134  // sysexArray does not contain the start and end tags
135  mTransport.write(MidiType::SystemExclusiveStart);
136 
137  for (size_t i = 0; i < inMessage.getSysExSize(); i++)
138  mTransport.write(inMessage.sysexArray[i]);
139 
140  mTransport.write(MidiType::SystemExclusiveEnd);
141  }
142  }
143  mTransport.endTransmission();
144  UpdateLastSentTime();
145 }

◆ send() [2/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::send ( MidiType  inType,
DataByte  inData1,
DataByte  inData2,
Channel  inChannel 
)

Generate and send a MIDI message from the values given.

Parameters
inTypeThe message type (see type defines for reference)
inData1The first data byte.
inData2The second data byte (if the message contains only 1 data byte, set this one to 0).
inChannelThe output channel on which the message will be sent (values from 1 to 16). Note: you cannot send to OMNI.

This is an internal method, use it only if you need to send raw data from your code, at your own risks.

Definition at line 160 of file MIDI.hpp.

164 {
165  if (inType <= PitchBend) // Channel messages
166  {
167  // Then test if channel is valid
168  if (inChannel >= MIDI_CHANNEL_OFF ||
169  inChannel == MIDI_CHANNEL_OMNI ||
170  inType < 0x80)
171  {
172  return; // Don't send anything
173  }
174  // Protection: remove MSBs on data
175  inData1 &= 0x7f;
176  inData2 &= 0x7f;
177 
178  const StatusByte status = getStatus(inType, inChannel);
179 
180  if (mTransport.beginTransmission(inType))
181  {
182  if (Settings::UseRunningStatus)
183  {
184  if (mRunningStatus_TX != status)
185  {
186  // New message, memorise and send header
187  mRunningStatus_TX = status;
188  mTransport.write(mRunningStatus_TX);
189  }
190  }
191  else
192  {
193  // Don't care about running status, send the status byte.
194  mTransport.write(status);
195  }
196 
197  // Then send data
198  mTransport.write(inData1);
199  if (inType != ProgramChange && inType != AfterTouchChannel)
200  {
201  mTransport.write(inData2);
202  }
203 
204  mTransport.endTransmission();
205  UpdateLastSentTime();
206  }
207  }
208  else if (inType >= Clock && inType <= SystemReset)
209  {
210  sendRealTime(inType); // System Real-time and 1 byte.
211  }
212 }

◆ sendAfterTouch() [1/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendAfterTouch ( DataByte  inNoteNumber,
DataByte  inPressure,
Channel  inChannel 
)
inline

Send a Polyphonic AfterTouch message (applies to a specified note)

Parameters
inNoteNumberThe note to apply AfterTouch to (0 to 127).
inPressureThe amount of AfterTouch to apply (0 to 127).
inChannelThe channel on which the message will be sent (1 to 16).
See also
Replaces sendPolyPressure (which is now deprecated).

Definition at line 310 of file MIDI.hpp.

313 {
314  send(AfterTouchPoly, inNoteNumber, inPressure, inChannel);
315 }

◆ sendAfterTouch() [2/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendAfterTouch ( DataByte  inPressure,
Channel  inChannel 
)
inline

Send a MonoPhonic AfterTouch message (applies to all notes)

Parameters
inPressureThe amount of AfterTouch to apply to all notes.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 297 of file MIDI.hpp.

299 {
300  send(AfterTouchChannel, inPressure, 0, inChannel);
301 }

◆ sendCommon()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendCommon ( MidiType  inType,
unsigned  inData1 = 0 
)
inline

Send a Common message. Common messages reset the running status.

Parameters
inTypeThe available Common types are: TimeCodeQuarterFrame, SongPosition, SongSelect and TuneRequest.
See also
MidiType
Parameters
inData1The byte that goes with the common message.

Definition at line 443 of file MIDI.hpp.

444 {
445  switch (inType)
446  {
448  case SongPosition:
449  case SongSelect:
450  case TuneRequest:
451  break;
452  default:
453  // Invalid Common marker
454  return;
455  }
456 
457  if (mTransport.beginTransmission(inType))
458  {
459  mTransport.write((byte)inType);
460  switch (inType)
461  {
463  mTransport.write(inData1);
464  break;
465  case SongPosition:
466  mTransport.write(inData1 & 0x7f);
467  mTransport.write((inData1 >> 7) & 0x7f);
468  break;
469  case SongSelect:
470  mTransport.write(inData1 & 0x7f);
471  break;
472  case TuneRequest:
473  break;
474  default:
475  break; // LCOV_EXCL_LINE - Coverage blind spot
476  }
477  mTransport.endTransmission();
478  UpdateLastSentTime();
479  }
480 
481  if (Settings::UseRunningStatus)
482  mRunningStatus_TX = InvalidType;
483 }

◆ sendControlChange()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendControlChange ( DataByte  inControlNumber,
DataByte  inControlValue,
Channel  inChannel 
)
inline

Send a Control Change message.

Parameters
inControlNumberThe controller number (0 to 127).
inControlValueThe value for the specified controller (0 to 127).
inChannelThe channel on which the message will be sent (1 to 16).
See also
MidiControlChangeNumber

Definition at line 270 of file MIDI.hpp.

273 {
274  send(ControlChange, inControlNumber, inControlValue, inChannel);
275 }

◆ sendNoteOff()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendNoteOff ( DataByte  inNoteNumber,
DataByte  inVelocity,
Channel  inChannel 
)
inline

Send a Note Off message.

Parameters
inNoteNumberPitch value in the MIDI format (0 to 127).
inVelocityRelease velocity (0 to 127).
inChannelThe channel on which the message will be sent (1 to 16).

Note: you can send NoteOn with zero velocity to make a NoteOff, this is based on the Running Status principle, to avoid sending status messages and thus sending only NoteOn data. sendNoteOff will always send a real NoteOff message. Take a look at the values, names and frequencies of notes here: http://www.phys.unsw.edu.au/jw/notes.html

Definition at line 245 of file MIDI.hpp.

248 {
249  send(NoteOff, inNoteNumber, inVelocity, inChannel);
250 }

◆ sendNoteOn()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendNoteOn ( DataByte  inNoteNumber,
DataByte  inVelocity,
Channel  inChannel 
)
inline

Send a Note On message.

Parameters
inNoteNumberPitch value in the MIDI format (0 to 127).
inVelocityNote attack velocity (0 to 127). A NoteOn with 0 velocity is considered as a NoteOff.
inChannelThe channel on which the message will be sent (1 to 16).

Take a look at the values, names and frequencies of notes here: http://www.phys.unsw.edu.au/jw/notes.html

Definition at line 226 of file MIDI.hpp.

229 {
230  send(NoteOn, inNoteNumber, inVelocity, inChannel);
231 }

◆ sendNrpnDecrement()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendNrpnDecrement ( byte  inAmount,
Channel  inChannel 
)
inline

Definition at line 658 of file MIDI.hpp.

660 {
661  sendControlChange(DataDecrement, inAmount, inChannel);
662 }

◆ sendNrpnIncrement()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendNrpnIncrement ( byte  inAmount,
Channel  inChannel 
)
inline

Definition at line 648 of file MIDI.hpp.

650 {
651  sendControlChange(DataIncrement, inAmount, inChannel);
652 }

◆ sendNrpnValue() [1/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendNrpnValue ( byte  inMsb,
byte  inLsb,
Channel  inChannel 
)
inline

Send separate MSB/LSB values for the currently selected NRPN number.

Parameters
inMsbThe MSB part of the value to send. Meaning depends on NRPN number.
inLsbThe LSB part of the value to send. Meaning depends on NRPN number.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 636 of file MIDI.hpp.

639 {
640  sendControlChange(DataEntryMSB, inMsb, inChannel);
641  sendControlChange(DataEntryLSB, inLsb, inChannel);
642 }

◆ sendNrpnValue() [2/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendNrpnValue ( unsigned  inValue,
Channel  inChannel 
)
inline

Send a 14-bit value for the currently selected NRPN number.

Parameters
inValueThe 14-bit value of the selected NRPN.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 621 of file MIDI.hpp.

623 {;
624  const byte valMsb = 0x7f & (inValue >> 7);
625  const byte valLsb = 0x7f & inValue;
626  sendControlChange(DataEntryMSB, valMsb, inChannel);
627  sendControlChange(DataEntryLSB, valLsb, inChannel);
628 }

◆ sendPitchBend() [1/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendPitchBend ( double  inPitchValue,
Channel  inChannel 
)
inline

Send a Pitch Bend message using a floating point value.

Parameters
inPitchValueThe amount of bend to send (in a floating point format), between -1.0f (maximum downwards bend) and +1.0f (max upwards bend), center value is 0.0f.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 339 of file MIDI.hpp.

341 {
342  const int scale = inPitchValue > 0.0 ? MIDI_PITCHBEND_MAX : MIDI_PITCHBEND_MIN;
343  const int value = int(inPitchValue * double(scale));
344  sendPitchBend(value, inChannel);
345 }

◆ sendPitchBend() [2/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendPitchBend ( int  inPitchValue,
Channel  inChannel 
)
inline

Send a Pitch Bend message using a signed integer value.

Parameters
inPitchValueThe amount of bend to send (in a signed integer format), between MIDI_PITCHBEND_MIN and MIDI_PITCHBEND_MAX, center value is 0.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 324 of file MIDI.hpp.

326 {
327  const unsigned bend = unsigned(inPitchValue - int(MIDI_PITCHBEND_MIN));
328  send(PitchBend, (bend & 0x7f), (bend >> 7) & 0x7f, inChannel);
329 }

◆ sendPolyPressure()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendPolyPressure ( DataByte  inNoteNumber,
DataByte  inPressure,
Channel  inChannel 
)
inline

Send a Polyphonic AfterTouch message (applies to a specified note)

Parameters
inNoteNumberThe note to apply AfterTouch to (0 to 127).
inPressureThe amount of AfterTouch to apply (0 to 127).
inChannelThe channel on which the message will be sent (1 to 16). Note: this method is deprecated and will be removed in a future revision of the library,
See also
sendAfterTouch to send polyphonic and monophonic AfterTouch messages.

Definition at line 285 of file MIDI.hpp.

288 {
289  send(AfterTouchPoly, inNoteNumber, inPressure, inChannel);
290 }

◆ sendProgramChange()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendProgramChange ( DataByte  inProgramNumber,
Channel  inChannel 
)
inline

Send a Program Change message.

Parameters
inProgramNumberThe Program to select (0 to 127).
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 257 of file MIDI.hpp.

259 {
260  send(ProgramChange, inProgramNumber, 0, inChannel);
261 }

◆ sendRealTime()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendRealTime ( MidiType  inType)
inline

Send a Real Time (one byte) message.

Parameters
inTypeThe available Real Time types are: Start, Stop, Continue, Clock, ActiveSensing and SystemReset.
See also
MidiType

Definition at line 492 of file MIDI.hpp.

493 {
494  // Do not invalidate Running Status for real-time messages
495  // as they can be interleaved within any message.
496 
497  switch (inType)
498  {
499  case Clock:
500  case Start:
501  case Stop:
502  case Continue:
503  case ActiveSensing:
504  case SystemReset:
505  if (mTransport.beginTransmission(inType))
506  {
507  mTransport.write((byte)inType);
508  mTransport.endTransmission();
509  UpdateLastSentTime();
510  }
511  break;
512  default:
513  // Invalid Real Time marker
514  break;
515  }
516 }

◆ sendRpnDecrement()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendRpnDecrement ( byte  inAmount,
Channel  inChannel 
)
inline

Definition at line 578 of file MIDI.hpp.

580 {
581  sendControlChange(DataDecrement, inAmount, inChannel);
582 }

◆ sendRpnIncrement()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendRpnIncrement ( byte  inAmount,
Channel  inChannel 
)
inline

Definition at line 568 of file MIDI.hpp.

570 {
571  sendControlChange(DataIncrement, inAmount, inChannel);
572 }

◆ sendRpnValue() [1/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendRpnValue ( byte  inMsb,
byte  inLsb,
Channel  inChannel 
)
inline

Send separate MSB/LSB values for the currently selected RPN number.

Parameters
inMsbThe MSB part of the value to send. Meaning depends on RPN number.
inLsbThe LSB part of the value to send. Meaning depends on RPN number.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 556 of file MIDI.hpp.

559 {
560  sendControlChange(DataEntryMSB, inMsb, inChannel);
561  sendControlChange(DataEntryLSB, inLsb, inChannel);
562 }

◆ sendRpnValue() [2/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendRpnValue ( unsigned  inValue,
Channel  inChannel 
)
inline

Send a 14-bit value for the currently selected RPN number.

Parameters
inValueThe 14-bit value of the selected RPN.
inChannelThe channel on which the message will be sent (1 to 16).

Definition at line 541 of file MIDI.hpp.

543 {;
544  const byte valMsb = 0x7f & (inValue >> 7);
545  const byte valLsb = 0x7f & inValue;
546  sendControlChange(DataEntryMSB, valMsb, inChannel);
547  sendControlChange(DataEntryLSB, valLsb, inChannel);
548 }

◆ sendSongPosition()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendSongPosition ( unsigned  inBeats)
inline

Send a Song Position Pointer message.

Parameters
inBeatsThe number of beats since the start of the song.

Definition at line 423 of file MIDI.hpp.

424 {
425  sendCommon(SongPosition, inBeats);
426 }

◆ sendSongSelect()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendSongSelect ( DataByte  inSongNumber)
inline

Send a Song Select message.

Definition at line 430 of file MIDI.hpp.

431 {
432  sendCommon(SongSelect, inSongNumber);
433 }

◆ sendSysEx()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendSysEx ( unsigned  inLength,
const byte inArray,
bool  inArrayContainsBoundaries = false 
)
inline

Generate and send a System Exclusive frame.

Parameters
inLengthThe size of the array to send
inArrayThe byte array containing the data to send
inArrayContainsBoundariesWhen set to 'true', 0xf0 & 0xf7 bytes (start & stop SysEx) will NOT be sent (and therefore must be included in the array). default value for ArrayContainsBoundaries is set to 'false' for compatibility with previous versions of the library.

Definition at line 357 of file MIDI.hpp.

360 {
361  const bool writeBeginEndBytes = !inArrayContainsBoundaries;
362 
363  if (mTransport.beginTransmission(MidiType::SystemExclusiveStart))
364  {
365  if (writeBeginEndBytes)
366  mTransport.write(MidiType::SystemExclusiveStart);
367 
368  for (unsigned i = 0; i < inLength; ++i)
369  mTransport.write(inArray[i]);
370 
371  if (writeBeginEndBytes)
372  mTransport.write(MidiType::SystemExclusiveEnd);
373 
374  mTransport.endTransmission();
375  UpdateLastSentTime();
376  }
377 
378  if (Settings::UseRunningStatus)
379  mRunningStatus_TX = InvalidType;
380 }

◆ sendTimeCodeQuarterFrame() [1/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendTimeCodeQuarterFrame ( DataByte  inData)
inline

Send a MIDI Time Code Quarter Frame.

See MIDI Specification for more information.

Parameters
inDataif you want to encode directly the nibbles in your program, you can send the byte here.

Definition at line 414 of file MIDI.hpp.

415 {
417 }

◆ sendTimeCodeQuarterFrame() [2/2]

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendTimeCodeQuarterFrame ( DataByte  inTypeNibble,
DataByte  inValuesNibble 
)
inline

Send a MIDI Time Code Quarter Frame.

Parameters
inTypeNibbleMTC type
inValuesNibbleMTC data See MIDI Specification for more information.

Definition at line 400 of file MIDI.hpp.

402 {
403  const byte data = byte((((inTypeNibble & 0x07) << 4) | (inValuesNibble & 0x0f)));
405 }

◆ sendTuneRequest()

template<class Transport , class Settings , class Platform >
void MidiInterface< Transport, Settings, Platform >::sendTuneRequest
inline

Send a Tune Request message.

When a MIDI unit receives this message, it should tune its oscillators (if equipped with any).

Definition at line 388 of file MIDI.hpp.

389 {
391 }
Clock
@ Clock
System Real Time - Timing Clock.
Definition: midi_Defs.h:113
SystemReset
@ SystemReset
System Real Time - System Reset.
Definition: midi_Defs.h:121
SystemExclusive
@ SystemExclusive
System Exclusive.
Definition: midi_Defs.h:104
TuneRequest
@ TuneRequest
System Common - Tune Request.
Definition: midi_Defs.h:111
DataEntryLSB
@ DataEntryLSB
Definition: midi_Defs.h:168
byte
uint8_t byte
Definition: midi_Defs.h:36
MIDI_PITCHBEND_MIN
#define MIDI_PITCHBEND_MIN
Definition: midi_Defs.h:46
MIDI_CHANNEL_OFF
#define MIDI_CHANNEL_OFF
Definition: midi_Defs.h:44
ProgramChange
@ ProgramChange
Channel Message - Program Change.
Definition: midi_Defs.h:101
Start
@ Start
System Real Time - Start.
Definition: midi_Defs.h:116
InvalidType
@ InvalidType
For notifying errors.
Definition: midi_Defs.h:96
DataIncrement
@ DataIncrement
Definition: midi_Defs.h:200
MidiInterface::sendControlChange
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:270
SystemExclusiveStart
@ SystemExclusiveStart
System Exclusive Start.
Definition: midi_Defs.h:105
MidiInterface::sendCommon
void sendCommon(MidiType inType, unsigned=0)
Send a Common message. Common messages reset the running status.
Definition: MIDI.hpp:443
MidiInterface::sendRealTime
void sendRealTime(MidiType inType)
Send a Real Time (one byte) message.
Definition: MIDI.hpp:492
AfterTouchPoly
@ AfterTouchPoly
Channel Message - Polyphonic AfterTouch.
Definition: midi_Defs.h:99
MidiInterface::sendTimeCodeQuarterFrame
void sendTimeCodeQuarterFrame(DataByte inTypeNibble, DataByte inValuesNibble)
Send a MIDI Time Code Quarter Frame.
Definition: MIDI.hpp:400
MidiInterface::send
void send(const MidiMessage &)
Send a MIDI message.
Definition: MIDI.hpp:118
TimeCodeQuarterFrame
@ TimeCodeQuarterFrame
System Common - MIDI Time Code Quarter Frame.
Definition: midi_Defs.h:106
StatusByte
byte StatusByte
Definition: midi_Defs.h:56
RPNLSB
@ RPNLSB
Registered Parameter Number (LSB)
Definition: midi_Defs.h:204
NoteOn
@ NoteOn
Channel Message - Note On.
Definition: midi_Defs.h:98
Continue
@ Continue
System Real Time - Continue.
Definition: midi_Defs.h:117
NoteOff
@ NoteOff
Channel Message - Note Off.
Definition: midi_Defs.h:97
SongSelect
@ SongSelect
System Common - Song Select.
Definition: midi_Defs.h:108
ActiveSensing
@ ActiveSensing
System Real Time - Active Sensing.
Definition: midi_Defs.h:120
PitchBend
@ PitchBend
Channel Message - Pitch Bend.
Definition: midi_Defs.h:103
MIDI_CHANNEL_OMNI
#define MIDI_CHANNEL_OMNI
Definition: midi_Defs.h:43
Stop
@ Stop
System Real Time - Stop.
Definition: midi_Defs.h:118
ControlChange
@ ControlChange
Channel Message - Control Change / Channel Mode.
Definition: midi_Defs.h:100
NRPNLSB
@ NRPNLSB
Non-Registered Parameter Number (LSB)
Definition: midi_Defs.h:202
SystemExclusiveEnd
@ SystemExclusiveEnd
System Exclusive End.
Definition: midi_Defs.h:112
SongPosition
@ SongPosition
System Common - Song Position Pointer.
Definition: midi_Defs.h:107
RPNMSB
@ RPNMSB
Registered Parameter Number (MSB)
Definition: midi_Defs.h:205
MidiInterface::sendPitchBend
void sendPitchBend(int inPitchValue, Channel inChannel)
Send a Pitch Bend message using a signed integer value.
Definition: MIDI.hpp:324
DataDecrement
@ DataDecrement
Definition: midi_Defs.h:201
AfterTouchChannel
@ AfterTouchChannel
Channel Message - Channel (monophonic) AfterTouch.
Definition: midi_Defs.h:102
MIDI_PITCHBEND_MAX
#define MIDI_PITCHBEND_MAX
Definition: midi_Defs.h:47
NRPNMSB
@ NRPNMSB
Non-Registered Parameter Number (MSB)
Definition: midi_Defs.h:203
DataEntryMSB
@ DataEntryMSB
Definition: midi_Defs.h:153