Arduino MIDI Library  Version 4.3.1
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

§ beginNrpn()

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 542 of file MIDI.hpp.

544 {
545  if (mCurrentNrpnNumber != inNumber)
546  {
547  const byte numMsb = 0x7f & (inNumber >> 7);
548  const byte numLsb = 0x7f & inNumber;
549  sendControlChange(NRPNLSB, numLsb, inChannel);
550  sendControlChange(NRPNMSB, numMsb, inChannel);
551  mCurrentNrpnNumber = inNumber;
552  }
553 }
Non-Registered Parameter Number (MSB)
Definition: midi_Defs.h:178
Non-Registered Parameter Number (LSB)
Definition: midi_Defs.h:177
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238
uint8_t byte
Definition: midi_Defs.h:36

§ beginRpn()

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 462 of file MIDI.hpp.

464 {
465  if (mCurrentRpnNumber != inNumber)
466  {
467  const byte numMsb = 0x7f & (inNumber >> 7);
468  const byte numLsb = 0x7f & inNumber;
469  sendControlChange(RPNLSB, numLsb, inChannel);
470  sendControlChange(RPNMSB, numMsb, inChannel);
471  mCurrentRpnNumber = inNumber;
472  }
473 }
Registered Parameter Number (MSB)
Definition: midi_Defs.h:180
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238
uint8_t byte
Definition: midi_Defs.h:36
Registered Parameter Number (LSB)
Definition: midi_Defs.h:179

§ endNrpn()

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 608 of file MIDI.hpp.

609 {
610  sendControlChange(NRPNLSB, 0x7f, inChannel);
611  sendControlChange(NRPNMSB, 0x7f, inChannel);
612  mCurrentNrpnNumber = 0xffff;
613 }
Non-Registered Parameter Number (MSB)
Definition: midi_Defs.h:178
Non-Registered Parameter Number (LSB)
Definition: midi_Defs.h:177
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238

§ endRpn()

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 528 of file MIDI.hpp.

529 {
530  sendControlChange(RPNLSB, 0x7f, inChannel);
531  sendControlChange(RPNMSB, 0x7f, inChannel);
532  mCurrentRpnNumber = 0xffff;
533 }
Registered Parameter Number (MSB)
Definition: midi_Defs.h:180
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238
Registered Parameter Number (LSB)
Definition: midi_Defs.h:179

§ send()

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 133 of file MIDI.hpp.

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

§ sendAfterTouch() [1/2]

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 265 of file MIDI.hpp.

267 {
268  send(AfterTouchChannel, inPressure, 0, inChannel);
269 }
Channel (monophonic) AfterTouch.
Definition: midi_Defs.h:73
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:133

§ sendAfterTouch() [2/2]

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 278 of file MIDI.hpp.

281 {
282  send(AfterTouchPoly, inNoteNumber, inPressure, inChannel);
283 }
Polyphonic AfterTouch.
Definition: midi_Defs.h:70
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:133

§ sendControlChange()

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 238 of file MIDI.hpp.

241 {
242  send(ControlChange, inControlNumber, inControlValue, inChannel);
243 }
Control Change / Channel Mode.
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:133

§ sendNoteOff()

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 213 of file MIDI.hpp.

216 {
217  send(NoteOff, inNoteNumber, inVelocity, inChannel);
218 }
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:133
Note Off.
Definition: midi_Defs.h:68

§ sendNoteOn()

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 194 of file MIDI.hpp.

197 {
198  send(NoteOn, inNoteNumber, inVelocity, inChannel);
199 }
Note On.
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:133

§ sendNrpnDecrement()

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

Definition at line 597 of file MIDI.hpp.

599 {
600  sendControlChange(DataDecrement, inAmount, inChannel);
601 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238

§ sendNrpnIncrement()

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

Definition at line 587 of file MIDI.hpp.

589 {
590  sendControlChange(DataIncrement, inAmount, inChannel);
591 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238

§ sendNrpnValue() [1/2]

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 560 of file MIDI.hpp.

562 {;
563  const byte valMsb = 0x7f & (inValue >> 7);
564  const byte valLsb = 0x7f & inValue;
565  sendControlChange(DataEntryMSB, valMsb, inChannel);
566  sendControlChange(DataEntryLSB, valLsb, inChannel);
567 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238
uint8_t byte
Definition: midi_Defs.h:36

§ sendNrpnValue() [2/2]

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 575 of file MIDI.hpp.

578 {
579  sendControlChange(DataEntryMSB, inMsb, inChannel);
580  sendControlChange(DataEntryLSB, inLsb, inChannel);
581 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238

§ sendPitchBend() [1/2]

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 292 of file MIDI.hpp.

294 {
295  const unsigned bend = inPitchValue - MIDI_PITCHBEND_MIN;
296  send(PitchBend, (bend & 0x7f), (bend >> 7) & 0x7f, inChannel);
297 }
#define MIDI_PITCHBEND_MIN
Definition: midi_Defs.h:51
Pitch Bend.
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:133

§ sendPitchBend() [2/2]

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 307 of file MIDI.hpp.

309 {
310  const int scale = inPitchValue > 0.0 ? MIDI_PITCHBEND_MAX : MIDI_PITCHBEND_MIN;
311  const int value = int(inPitchValue * double(scale));
312  sendPitchBend(value, inChannel);
313 }
#define MIDI_PITCHBEND_MAX
Definition: midi_Defs.h:52
#define MIDI_PITCHBEND_MIN
Definition: midi_Defs.h:51
void sendPitchBend(int inPitchValue, Channel inChannel)
Send a Pitch Bend message using a signed integer value.
Definition: MIDI.hpp:292

§ sendPolyPressure()

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 253 of file MIDI.hpp.

256 {
257  send(AfterTouchPoly, inNoteNumber, inPressure, inChannel);
258 }
Polyphonic AfterTouch.
Definition: midi_Defs.h:70
void send(MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel)
Generate and send a MIDI message from the values given.
Definition: MIDI.hpp:133

§ sendProgramChange()

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 225 of file MIDI.hpp.

227 {
228  send(ProgramChange, inProgramNumber, 0, inChannel);
229 }
Program Change.
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:133

§ sendRealTime()

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 436 of file MIDI.hpp.

437 {
438  // Do not invalidate Running Status for real-time messages
439  // as they can be interleaved within any message.
440 
441  switch (inType)
442  {
443  case Clock:
444  case Start:
445  case Stop:
446  case Continue:
447  case ActiveSensing:
448  case SystemReset:
449  mSerial.write((byte)inType);
450  break;
451  default:
452  // Invalid Real Time marker
453  break;
454  }
455 }
System Real Time - Stop.
Definition: midi_Defs.h:83
System Real Time - Timing Clock.
Definition: midi_Defs.h:80
System Real Time - Continue.
Definition: midi_Defs.h:82
System Real Time - Start.
Definition: midi_Defs.h:81
uint8_t byte
Definition: midi_Defs.h:36
System Real Time - Active Sensing.
Definition: midi_Defs.h:84
System Real Time - System Reset.
Definition: midi_Defs.h:85

§ sendRpnDecrement()

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

Definition at line 517 of file MIDI.hpp.

519 {
520  sendControlChange(DataDecrement, inAmount, inChannel);
521 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238

§ sendRpnIncrement()

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

Definition at line 507 of file MIDI.hpp.

509 {
510  sendControlChange(DataIncrement, inAmount, inChannel);
511 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238

§ sendRpnValue() [1/2]

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 480 of file MIDI.hpp.

482 {;
483  const byte valMsb = 0x7f & (inValue >> 7);
484  const byte valLsb = 0x7f & inValue;
485  sendControlChange(DataEntryMSB, valMsb, inChannel);
486  sendControlChange(DataEntryLSB, valLsb, inChannel);
487 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238
uint8_t byte
Definition: midi_Defs.h:36

§ sendRpnValue() [2/2]

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 495 of file MIDI.hpp.

498 {
499  sendControlChange(DataEntryMSB, inMsb, inChannel);
500  sendControlChange(DataEntryLSB, inLsb, inChannel);
501 }
void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel)
Send a Control Change message.
Definition: MIDI.hpp:238

§ sendSongPosition()

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 404 of file MIDI.hpp.

405 {
406  mSerial.write((byte)SongPosition);
407  mSerial.write(inBeats & 0x7f);
408  mSerial.write((inBeats >> 7) & 0x7f);
409 
410  if (Settings::UseRunningStatus)
411  {
412  mRunningStatus_TX = InvalidType;
413  }
414 }
System Common - Song Position Pointer.
Definition: midi_Defs.h:77
For notifying errors.
Definition: midi_Defs.h:67
uint8_t byte
Definition: midi_Defs.h:36

§ sendSongSelect()

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

Send a Song Select message.

Definition at line 418 of file MIDI.hpp.

419 {
420  mSerial.write((byte)SongSelect);
421  mSerial.write(inSongNumber & 0x7f);
422 
423  if (Settings::UseRunningStatus)
424  {
425  mRunningStatus_TX = InvalidType;
426  }
427 }
System Common - Song Select.
Definition: midi_Defs.h:78
For notifying errors.
Definition: midi_Defs.h:67
uint8_t byte
Definition: midi_Defs.h:36

§ sendSysEx()

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 325 of file MIDI.hpp.

328 {
329  const bool writeBeginEndBytes = !inArrayContainsBoundaries;
330 
331  if (writeBeginEndBytes)
332  {
333  mSerial.write(0xf0);
334  }
335 
336  for (unsigned i = 0; i < inLength; ++i)
337  {
338  mSerial.write(inArray[i]);
339  }
340 
341  if (writeBeginEndBytes)
342  {
343  mSerial.write(0xf7);
344  }
345 
346  if (Settings::UseRunningStatus)
347  {
348  mRunningStatus_TX = InvalidType;
349  }
350 }
For notifying errors.
Definition: midi_Defs.h:67

§ sendTimeCodeQuarterFrame() [1/2]

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 375 of file MIDI.hpp.

377 {
378  const byte data = (((inTypeNibble & 0x07) << 4) | (inValuesNibble & 0x0f));
380 }
void sendTimeCodeQuarterFrame(DataByte inTypeNibble, DataByte inValuesNibble)
Send a MIDI Time Code Quarter Frame.
Definition: MIDI.hpp:375
uint8_t byte
Definition: midi_Defs.h:36

§ sendTimeCodeQuarterFrame() [2/2]

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 389 of file MIDI.hpp.

390 {
391  mSerial.write((byte)TimeCodeQuarterFrame);
392  mSerial.write(inData);
393 
394  if (Settings::UseRunningStatus)
395  {
396  mRunningStatus_TX = InvalidType;
397  }
398 }
System Common - MIDI Time Code Quarter Frame.
Definition: midi_Defs.h:76
For notifying errors.
Definition: midi_Defs.h:67
uint8_t byte
Definition: midi_Defs.h:36

§ sendTuneRequest()

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 358 of file MIDI.hpp.

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