Arduino MIDI Library  Version 4.3
MIDI Output

Functions

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

Detailed Description

Function Documentation

template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 543 of file MIDI.hpp.

545 {
546  if (mCurrentNrpnNumber != inNumber)
547  {
548  const byte numMsb = 0x7f & (inNumber >> 7);
549  const byte numLsb = 0x7f & inNumber;
550  sendControlChange(NRPNLSB, numLsb, inChannel);
551  sendControlChange(NRPNMSB, numMsb, inChannel);
552  mCurrentNrpnNumber = inNumber;
553  }
554 }
uint8_t byte
Definition: midi_Defs.h:37
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
Non-Registered Parameter Number (MSB)
Definition: midi_Defs.h:179
Non-Registered Parameter Number (LSB)
Definition: midi_Defs.h:178
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 463 of file MIDI.hpp.

465 {
466  if (mCurrentRpnNumber != inNumber)
467  {
468  const byte numMsb = 0x7f & (inNumber >> 7);
469  const byte numLsb = 0x7f & inNumber;
470  sendControlChange(RPNLSB, numLsb, inChannel);
471  sendControlChange(RPNMSB, numMsb, inChannel);
472  mCurrentRpnNumber = inNumber;
473  }
474 }
uint8_t byte
Definition: midi_Defs.h:37
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
Registered Parameter Number (MSB)
Definition: midi_Defs.h:181
Registered Parameter Number (LSB)
Definition: midi_Defs.h:180
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 609 of file MIDI.hpp.

610 {
611  sendControlChange(NRPNLSB, 0x7f, inChannel);
612  sendControlChange(NRPNMSB, 0x7f, inChannel);
613  mCurrentNrpnNumber = 0xffff;
614 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
Non-Registered Parameter Number (MSB)
Definition: midi_Defs.h:179
Non-Registered Parameter Number (LSB)
Definition: midi_Defs.h:178
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 529 of file MIDI.hpp.

530 {
531  sendControlChange(RPNLSB, 0x7f, inChannel);
532  sendControlChange(RPNMSB, 0x7f, inChannel);
533  mCurrentRpnNumber = 0xffff;
534 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
Registered Parameter Number (MSB)
Definition: midi_Defs.h:181
Registered Parameter Number (LSB)
Definition: midi_Defs.h:180
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 134 of file MIDI.hpp.

138 {
139  // Then test if channel is valid
140  if (inChannel >= MIDI_CHANNEL_OFF ||
141  inChannel == MIDI_CHANNEL_OMNI ||
142  inType < 0x80)
143  {
144  return; // Don't send anything
145  }
146 
147  if (inType <= PitchBend) // Channel messages
148  {
149  // Protection: remove MSBs on data
150  inData1 &= 0x7f;
151  inData2 &= 0x7f;
152 
153  const StatusByte status = getStatus(inType, inChannel);
154 
155  if (Settings::UseRunningStatus)
156  {
157  if (mRunningStatus_TX != status)
158  {
159  // New message, memorise and send header
160  mRunningStatus_TX = status;
161  mSerial.write(mRunningStatus_TX);
162  }
163  }
164  else
165  {
166  // Don't care about running status, send the status byte.
167  mSerial.write(status);
168  }
169 
170  // Then send data
171  mSerial.write(inData1);
172  if (inType != ProgramChange && inType != AfterTouchChannel)
173  {
174  mSerial.write(inData2);
175  }
176  }
177  else if (inType >= Clock && inType <= SystemReset)
178  {
179  sendRealTime(inType); // System Real-time and 1 byte.
180  }
181 }
System Real Time - System Reset.
Definition: midi_Defs.h:86
Pitch Bend.
Definition: midi_Defs.h:75
#define MIDI_CHANNEL_OFF
Definition: midi_Defs.h:50
System Real Time - Timing Clock.
Definition: midi_Defs.h:81
byte StatusByte
Definition: midi_Defs.h:58
Channel (monophonic) AfterTouch.
Definition: midi_Defs.h:74
#define MIDI_CHANNEL_OMNI
Definition: midi_Defs.h:49
Program Change.
Definition: midi_Defs.h:73
void sendRealTime(MidiType inType)
Send a Real Time (one byte) message.
Definition: MIDI.hpp:437
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 266 of file MIDI.hpp.

268 {
269  send(AfterTouchChannel, inPressure, 0, inChannel);
270 }
Channel (monophonic) AfterTouch.
Definition: midi_Defs.h:74
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:134
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 279 of file MIDI.hpp.

282 {
283  send(AfterTouchPoly, inNoteNumber, inPressure, inChannel);
284 }
Polyphonic AfterTouch.
Definition: midi_Defs.h:71
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:134
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 239 of file MIDI.hpp.

242 {
243  send(ControlChange, inControlNumber, inControlValue, inChannel);
244 }
Control Change / Channel Mode.
Definition: midi_Defs.h:72
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:134
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 214 of file MIDI.hpp.

217 {
218  send(NoteOff, inNoteNumber, inVelocity, inChannel);
219 }
Note Off.
Definition: midi_Defs.h:69
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:134
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 195 of file MIDI.hpp.

198 {
199  send(NoteOn, inNoteNumber, inVelocity, inChannel);
200 }
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:134
Note On.
Definition: midi_Defs.h:70
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::sendNrpnDecrement ( byte  inAmount,
Channel  inChannel 
)
inline

Definition at line 598 of file MIDI.hpp.

600 {
601  sendControlChange(DataDecrement, inAmount, inChannel);
602 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::sendNrpnIncrement ( byte  inAmount,
Channel  inChannel 
)
inline

Definition at line 588 of file MIDI.hpp.

590 {
591  sendControlChange(DataIncrement, inAmount, inChannel);
592 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 561 of file MIDI.hpp.

563 {;
564  const byte valMsb = 0x7f & (inValue >> 7);
565  const byte valLsb = 0x7f & inValue;
566  sendControlChange(DataEntryMSB, valMsb, inChannel);
567  sendControlChange(DataEntryLSB, valLsb, inChannel);
568 }
uint8_t byte
Definition: midi_Defs.h:37
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 576 of file MIDI.hpp.

579 {
580  sendControlChange(DataEntryMSB, inMsb, inChannel);
581  sendControlChange(DataEntryLSB, inLsb, inChannel);
582 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 293 of file MIDI.hpp.

295 {
296  const unsigned bend = inPitchValue - MIDI_PITCHBEND_MIN;
297  send(PitchBend, (bend & 0x7f), (bend >> 7) & 0x7f, inChannel);
298 }
Pitch Bend.
Definition: midi_Defs.h:75
#define MIDI_PITCHBEND_MIN
Definition: midi_Defs.h:52
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:134
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 308 of file MIDI.hpp.

310 {
311  const int scale = inPitchValue > 0.0 ? MIDI_PITCHBEND_MAX : MIDI_PITCHBEND_MIN;
312  const int value = int(inPitchValue * double(scale));
313  sendPitchBend(value, inChannel);
314 }
void sendPitchBend(int inPitchValue, Channel inChannel)
Send a Pitch Bend message using a signed integer value.
Definition: MIDI.hpp:293
#define MIDI_PITCHBEND_MIN
Definition: midi_Defs.h:52
#define MIDI_PITCHBEND_MAX
Definition: midi_Defs.h:53
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 254 of file MIDI.hpp.

257 {
258  send(AfterTouchPoly, inNoteNumber, inPressure, inChannel);
259 }
Polyphonic AfterTouch.
Definition: midi_Defs.h:71
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:134
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 226 of file MIDI.hpp.

228 {
229  send(ProgramChange, inProgramNumber, 0, inChannel);
230 }
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:134
Program Change.
Definition: midi_Defs.h:73
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 437 of file MIDI.hpp.

438 {
439  // Do not invalidate Running Status for real-time messages
440  // as they can be interleaved within any message.
441 
442  switch (inType)
443  {
444  case Clock:
445  case Start:
446  case Stop:
447  case Continue:
448  case ActiveSensing:
449  case SystemReset:
450  mSerial.write((byte)inType);
451  break;
452  default:
453  // Invalid Real Time marker
454  break;
455  }
456 }
System Real Time - System Reset.
Definition: midi_Defs.h:86
uint8_t byte
Definition: midi_Defs.h:37
System Real Time - Timing Clock.
Definition: midi_Defs.h:81
System Real Time - Active Sensing.
Definition: midi_Defs.h:85
System Real Time - Stop.
Definition: midi_Defs.h:84
System Real Time - Continue.
Definition: midi_Defs.h:83
System Real Time - Start.
Definition: midi_Defs.h:82
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::sendRpnDecrement ( byte  inAmount,
Channel  inChannel 
)
inline

Definition at line 518 of file MIDI.hpp.

520 {
521  sendControlChange(DataDecrement, inAmount, inChannel);
522 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::sendRpnIncrement ( byte  inAmount,
Channel  inChannel 
)
inline

Definition at line 508 of file MIDI.hpp.

510 {
511  sendControlChange(DataIncrement, inAmount, inChannel);
512 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 481 of file MIDI.hpp.

483 {;
484  const byte valMsb = 0x7f & (inValue >> 7);
485  const byte valLsb = 0x7f & inValue;
486  sendControlChange(DataEntryMSB, valMsb, inChannel);
487  sendControlChange(DataEntryLSB, valLsb, inChannel);
488 }
uint8_t byte
Definition: midi_Defs.h:37
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 496 of file MIDI.hpp.

499 {
500  sendControlChange(DataEntryMSB, inMsb, inChannel);
501  sendControlChange(DataEntryLSB, inLsb, inChannel);
502 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:239
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::sendSongPosition ( unsigned  inBeats)
inline

Send a Song Position Pointer message.

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

Definition at line 405 of file MIDI.hpp.

406 {
407  mSerial.write((byte)SongPosition);
408  mSerial.write(inBeats & 0x7f);
409  mSerial.write((inBeats >> 7) & 0x7f);
410 
411  if (Settings::UseRunningStatus)
412  {
413  mRunningStatus_TX = InvalidType;
414  }
415 }
uint8_t byte
Definition: midi_Defs.h:37
For notifying errors.
Definition: midi_Defs.h:68
System Common - Song Position Pointer.
Definition: midi_Defs.h:78
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::sendSongSelect ( DataByte  inSongNumber)
inline

Send a Song Select message.

Definition at line 419 of file MIDI.hpp.

420 {
421  mSerial.write((byte)SongSelect);
422  mSerial.write(inSongNumber & 0x7f);
423 
424  if (Settings::UseRunningStatus)
425  {
426  mRunningStatus_TX = InvalidType;
427  }
428 }
uint8_t byte
Definition: midi_Defs.h:37
For notifying errors.
Definition: midi_Defs.h:68
System Common - Song Select.
Definition: midi_Defs.h:79
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 326 of file MIDI.hpp.

329 {
330  const bool writeBeginEndBytes = !inArrayContainsBoundaries;
331 
332  if (writeBeginEndBytes)
333  {
334  mSerial.write(0xf0);
335  }
336 
337  for (unsigned i = 0; i < inLength; ++i)
338  {
339  mSerial.write(inArray[i]);
340  }
341 
342  if (writeBeginEndBytes)
343  {
344  mSerial.write(0xf7);
345  }
346 
347  if (Settings::UseRunningStatus)
348  {
349  mRunningStatus_TX = InvalidType;
350  }
351 }
For notifying errors.
Definition: midi_Defs.h:68
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 376 of file MIDI.hpp.

378 {
379  const byte data = (((inTypeNibble & 0x07) << 4) | (inValuesNibble & 0x0f));
381 }
uint8_t byte
Definition: midi_Defs.h:37
void sendTimeCodeQuarterFrame(DataByte inTypeNibble, DataByte inValuesNibble)
Send a MIDI Time Code Quarter Frame.
Definition: MIDI.hpp:376
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 390 of file MIDI.hpp.

391 {
392  mSerial.write((byte)TimeCodeQuarterFrame);
393  mSerial.write(inData);
394 
395  if (Settings::UseRunningStatus)
396  {
397  mRunningStatus_TX = InvalidType;
398  }
399 }
uint8_t byte
Definition: midi_Defs.h:37
System Common - MIDI Time Code Quarter Frame.
Definition: midi_Defs.h:77
For notifying errors.
Definition: midi_Defs.h:68
template<class SerialPort , class Settings >
void MidiInterface< SerialPort, Settings >::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 359 of file MIDI.hpp.

360 {
361  mSerial.write(TuneRequest);
362 
363  if (Settings::UseRunningStatus)
364  {
365  mRunningStatus_TX = InvalidType;
366  }
367 }
For notifying errors.
Definition: midi_Defs.h:68
System Common - Tune Request.
Definition: midi_Defs.h:80