Control Surface new-input
MIDI Control Surface library for Arduino
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ChannelMessage Struct Reference

#include <MIDI_Parsers/MIDI_MessageTypes.hpp>

Detailed Description

Examples
MIDI-Input-Callback.ino, MIDI-Input.ino, and Mackie-Control-Universal-Reverse-Engineering.ino.

Definition at line 175 of file MIDI_MessageTypes.hpp.

+ Inheritance diagram for ChannelMessage:
+ Collaboration diagram for ChannelMessage:

Public Member Functions

 ChannelMessage (MIDIMessageType type, Channel channel, uint8_t data1, uint8_t data2=0x00, Cable cable=CABLE_1)
 Constructor.
 
 ChannelMessage (const MIDIMessage &msg)
 
MIDIMessageType getMessageType () const
 Get the MIDI message type.
 
void setMessageType (MIDIMessageType type)
 Set the MIDI message type.
 
Channel getChannel () const
 Get the MIDI channel of the message.
 
void setChannel (Channel channel)
 Set the MIDI channel of the message.
 
MIDIChannelCable getChannelCable () const
 Get the MIDI channel and cable number. More...
 
MIDIAddress getAddress () const
 Get the MIDI address of this message, using data1 as the address. More...
 
bool hasTwoDataBytes () const
 Check whether this message has one or two data bytes. More...
 
 MIDIMessage (uint8_t header, uint8_t data1, uint8_t data2, Cable cable=CABLE_1)
 Constructor.
 
 MIDIMessage (MIDIMessageType header, uint8_t data1, uint8_t data2, Cable cable=CABLE_1)
 Constructor.
 
bool operator== (MIDIMessage other) const
 Check for equality.
 
bool operator!= (MIDIMessage other) const
 Check for inequality.
 
uint8_t getData1 () const
 Get the first data byte.
 
uint8_t getData2 () const
 Get the second data byte.
 
void setData1 (uint8_t data)
 Set the first data byte.
 
void setData2 (uint8_t data)
 Set the second data byte.
 
Cable getCable () const
 Get the MIDI USB cable number of the message.
 
void setCable (Cable cable)
 Set the MIDI USB cable number of the message.
 
bool hasValidChannelMessageHeader () const
 Check whether the header is a valid header for a channel message.
 
bool hasValidSystemCommonHeader () const
 Check whether the header is a valid header for a System Common message. More...
 
uint16_t getData14bit () const
 If Data 1 and Data 2 represent a single 14-bit number, you can use this method to retrieve that number.
 
void setData14bit (uint16_t data)
 If Data 1 and Data 2 represent a single 14-bit number, you can use this method to set that number.
 
void sanitize ()
 Make sure that the status byte has the most significant bit set and the data bytes have the most significant bits cleared.
 

Public Attributes

uint8_t header
 MIDI status byte (message type and channel).
 
uint8_t data1
 First MIDI data byte.
 
uint8_t data2
 First MIDI data byte.
 
Cable cable
 USB MIDI cable number;.
 

Static Public Attributes

constexpr static auto NOTE_OFF = MIDIMessageType::NOTE_OFF
 
constexpr static auto NOTE_ON = MIDIMessageType::NOTE_ON
 
constexpr static auto KEY_PRESSURE = MIDIMessageType::KEY_PRESSURE
 
constexpr static auto CC = MIDIMessageType::CC
 
constexpr static auto CONTROL_CHANGE = MIDIMessageType::CONTROL_CHANGE
 
constexpr static auto PROGRAM_CHANGE = MIDIMessageType::PROGRAM_CHANGE
 
constexpr static auto CHANNEL_PRESSURE = MIDIMessageType::CHANNEL_PRESSURE
 
constexpr static auto PITCH_BEND = MIDIMessageType::PITCH_BEND
 

Member Function Documentation

◆ getChannelCable()

MIDIChannelCable getChannelCable ( ) const
inline

Get the MIDI channel and cable number.

Note
Valid for all MIDI Channel messages, including Channel Pressure and Pitch Bend.

Definition at line 206 of file MIDI_MessageTypes.hpp.

◆ getAddress()

MIDIAddress getAddress ( ) const
inline

Get the MIDI address of this message, using data1 as the address.

Note
Don't use this for Channel Pressure or Pitch Bend messages, as data1 will have a different meaning in those cases.

Definition at line 210 of file MIDI_MessageTypes.hpp.

◆ hasTwoDataBytes()

bool hasTwoDataBytes ( ) const
inline

Check whether this message has one or two data bytes.

  • 2 data bytes: Note On/Off, Aftertouch, Control Change or Pitch Bend
  • 1 data byte: Program Change or Channel Pressure

Returns false if the header is a SysEx, Real-Time or System Common byte.

Definition at line 218 of file MIDI_MessageTypes.hpp.

◆ hasValidSystemCommonHeader()

bool hasValidSystemCommonHeader ( ) const
inlineinherited

Check whether the header is a valid header for a System Common message.

Note
SysExEnd is considered a System Common message by the MIDI Standard, SysExStart is not.
Reserved System Common messages are also considered valid System Common messages.

Definition at line 150 of file MIDI_MessageTypes.hpp.


The documentation for this struct was generated from the following file: