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.
constexpr static auto PROGRAM_CHANGE
constexpr static auto CONTROL_CHANGE
constexpr static auto NOTE_OFF
void setChannel(Channel channel)
Set the MIDI channel of the message.
MIDIChannelCable getChannelCable() const
Get the MIDI channel and cable number.
constexpr static auto KEY_PRESSURE
ChannelMessage(MIDIMessageType type, Channel channel, uint8_t data1, uint8_t data2=0x00, Cable cable=CABLE_1)
Constructor.
void setMessageType(MIDIMessageType type)
Set the MIDI message type.
MIDIAddress getAddress() const
Get the MIDI address of this message, using data1 as the address.
constexpr static auto CHANNEL_PRESSURE
MIDIMessageType getMessageType() const
Get the MIDI message type.
ChannelMessage(const MIDIMessage &msg)
constexpr static auto PITCH_BEND
Channel getChannel() const
Get the MIDI channel of the message.
constexpr static auto NOTE_ON
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.
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
Cable getCable() const
Get the MIDI USB cable number of the message.
constexpr static auto RESET
constexpr static auto UNDEFINED_REALTIME_2
void setMessageType(MIDIMessageType type)
Set the MIDI message type.
constexpr static auto TIMING_CLOCK
MIDIMessageType getMessageType() const
Get the MIDI message type.
constexpr static auto UNDEFINED_REALTIME_1
constexpr static auto START
constexpr static auto ACTIVE_SENSING
constexpr static auto CONTINUE
bool operator==(RealTimeMessage other) const
constexpr static auto STOP
SysCommonMessage(MIDIMessageType type, uint8_t data1=0x00, uint8_t data2=0x00, Cable cable=CABLE_1)
Constructor.
uint8_t getNumberOfDataBytes() const
Get the number of data bytes of this type of System Common message.
constexpr static auto SONG_POSITION_POINTER
constexpr static auto TUNE_REQUEST
constexpr static auto UNDEFINED_SYSCOMMON_1
constexpr static auto MTC_QUARTER_FRAME
SysCommonMessage(MIDIMessageType type, Cable cable)
Constructor.
SysCommonMessage(const MIDIMessage &msg)
constexpr static auto SONG_SELECT
MIDIMessageType getMessageType() const
Get the MIDI message type.
constexpr static auto UNDEFINED_SYSCOMMON_2
SysCommonMessage(MIDIMessageType type, uint8_t data1, Cable cable)
Constructor.
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.
constexpr static auto SYSEX_START
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
bool isFirstChunk() const
constexpr static auto SYSEX_END