4#include <AH/STL/cstddef>
5#include <AH/STL/vector>
7#include <Settings/NamespaceSettings.hpp>
15#include <Def/Cable.hpp>
104 return this->header == other.
header && this->data1 == other.
data1 &&
105 this->data2 == other.
data2 && this->cable == other.
cable;
122 header =
static_cast<uint8_t
>(type);
157 return data1 | (uint16_t(
data2) << uint16_t(7));
162 data1 = (data >> 0) & 0x7F;
163 data2 = (data >> 7) & 0x7F;
192 header |=
static_cast<uint8_t
>(type) & 0xF0;
290 template <u
int16_t N>
300 return this->length == other.
length && this->cable == other.
cable &&
301 (this->length == 0 ||
339 return this->message == other.
message && this->cable == other.
cable;
345 message =
static_cast<uint8_t
>(type);
std::remove_reference< decltype(*F(""))>::type * FlashString_t
MIDIMessageType
All possible MIDI status byte values (without channel).
MIDICodeIndexNumber
MIDI USB Code Index Numbers.
FlashString_t enum_to_string(MIDIMessageType)
#define BEGIN_CS_NAMESPACE
#define AH_DIAGNOSTIC_POP()
#define AH_DIAGNOSTIC_WERROR()
A type-safe class for MIDI USB Cable numbers.
constexpr uint8_t getOneBased() const
Get the cable as an integer.
A type-safe class for MIDI channels.
constexpr uint8_t getRaw() const
Get the channel as an integer.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
A class for saving a MIDI channel and cable number.
Print & operator<<(Print &os, Quaternion e)
Printing.
static constexpr auto PROGRAM_CHANGE
static constexpr auto CONTROL_CHANGE
void setChannel(Channel channel)
Set the MIDI channel of the message.
MIDIChannelCable getChannelCable() const
Get the MIDI channel and cable number.
ChannelMessage(MIDIMessageType type, Channel channel, uint8_t data1, uint8_t data2=0x00, Cable cable=CABLE_1)
Constructor.
static constexpr auto NOTE_ON
void setMessageType(MIDIMessageType type)
Set the MIDI message type.
MIDIAddress getAddress() const
Get the MIDI address of this message, using data1 as the address.
MIDIMessageType getMessageType() const
Get the MIDI message type.
ChannelMessage(const MIDIMessage &msg)
static constexpr auto CHANNEL_PRESSURE
Channel getChannel() const
Get the MIDI channel of the message.
static constexpr auto KEY_PRESSURE
static constexpr auto NOTE_OFF
static constexpr auto PITCH_BEND
bool hasTwoDataBytes() const
Check whether this message has one or two data bytes.
void setCable(Cable cable)
Set the MIDI USB cable number of the message.
uint8_t data2
First MIDI data byte.
MIDIMessage(uint8_t header, uint8_t data1, uint8_t data2, Cable cable=CABLE_1)
Constructor.
bool hasValidChannelMessageHeader() const
Check whether the header is a valid header for a channel message.
uint8_t header
MIDI status byte (message type and channel).
void setData1(uint8_t data)
Set the first data byte.
bool operator==(MIDIMessage other) const
Check for equality.
void setData2(uint8_t data)
Set the second data byte.
Cable getCable() const
Get the MIDI USB cable number of the message.
void sanitize()
Make sure that the status byte has the most significant bit set and the data bytes have the most sign...
uint8_t getData1() const
Get the first data byte.
uint8_t data1
First MIDI data byte.
void setMessageType(MIDIMessageType type)
Set the MIDI message type.
MIDIMessageType getMessageType() const
Get the MIDI message type.
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.
Cable cable
USB MIDI cable number;.
uint16_t getData14bit() const
If Data 1 and Data 2 represent a single 14-bit number, you can use this method to retrieve that numbe...
uint8_t getData2() const
Get the second data byte.
bool hasValidSystemCommonHeader() const
Check whether the header is a valid header for a System Common message.
MIDIMessage(MIDIMessageType header, uint8_t data1, uint8_t data2, Cable cable=CABLE_1)
Constructor.
bool operator!=(MIDIMessage other) const
Check for inequality.
static constexpr auto UNDEFINED_REALTIME_2
void setCable(Cable cable)
Set the MIDI USB cable number of the message.
RealTimeMessage(uint8_t message, Cable cable=CABLE_1)
Constructor.
RealTimeMessage(MIDIMessageType message, Cable cable=CABLE_1)
Constructor.
bool isValid() const
Check whether the header is a valid header for a Real-Time message.
bool operator!=(RealTimeMessage other) const
static constexpr auto UNDEFINED_REALTIME_1
Cable getCable() const
Get the MIDI USB cable number of the message.
static constexpr auto ACTIVE_SENSING
static constexpr auto CONTINUE
static constexpr auto STOP
static constexpr auto RESET
void setMessageType(MIDIMessageType type)
Set the MIDI message type.
MIDIMessageType getMessageType() const
Get the MIDI message type.
static constexpr auto TIMING_CLOCK
static constexpr auto START
bool operator==(RealTimeMessage other) const
SysCommonMessage(MIDIMessageType type, uint8_t data1=0x00, uint8_t data2=0x00, Cable cable=CABLE_1)
Constructor.
static constexpr auto SONG_POSITION_POINTER
uint8_t getNumberOfDataBytes() const
Get the number of data bytes of this type of System Common message.
static constexpr auto UNDEFINED_SYSCOMMON_2
static constexpr auto SONG_SELECT
SysCommonMessage(MIDIMessageType type, Cable cable)
Constructor.
static constexpr auto TUNE_REQUEST
SysCommonMessage(const MIDIMessage &msg)
MIDIMessageType getMessageType() const
Get the MIDI message type.
static constexpr auto MTC_QUARTER_FRAME
static constexpr auto UNDEFINED_SYSCOMMON_1
SysCommonMessage(MIDIMessageType type, uint8_t data1, Cable cable)
Constructor.
static constexpr auto SYSEX_END
void setCable(Cable cable)
Set the MIDI USB cable number of the message.
SysExMessage(const uint8_t(&array)[N], Cable cable=CABLE_1)
Constructor.
SysExMessage()
Constructor.
SysExMessage(const uint8_t *data, uint16_t length, Cable cable=CABLE_1)
Constructor.
SysExMessage(const std::vector< uint8_t > &vec, Cable cable=CABLE_1)
Constructor.
bool operator!=(SysExMessage other) const
Cable getCable() const
Get the MIDI USB cable number of the message.
bool operator==(SysExMessage other) const
bool isCompleteMessage() const
static constexpr auto SYSEX_START
bool isFirstChunk() const