MIDI Control Surface library for Arduino
|
Go to the documentation of this file.
11 struct __attribute__((packed)) RawMIDIAddress {
15 uint8_t cableNumber : 4;
51 constexpr
explicit operator bool()
const {
return isValid(); }
70 int deltaCableNumber = 0)
73 (uint8_t)deltaAddress,
74 (uint8_t)deltaChannel,
75 (uint8_t)deltaCableNumber,
85 static_assert(((-1) & 0x7F) == 0x7F,
86 "Negative numbers must be two's complement");
145 cableNumber.getRaw(),
183 cableNumber.getRaw(),
250 return this->addresses.valid && rhs.
addresses.valid &&
251 this->addresses.address == rhs.
addresses.address &&
252 this->addresses.channel == rhs.
addresses.channel &&
253 this->addresses.cableNumber == rhs.
addresses.cableNumber;
261 return this->addresses.valid && rhs.
addresses.valid &&
262 !(this->addresses.address == rhs.
addresses.address &&
263 this->addresses.channel == rhs.
addresses.channel &&
264 this->addresses.cableNumber == rhs.
addresses.cableNumber);
272 constexpr
explicit operator bool()
const {
return isValid(); }
MIDIAddress operator+(const RelativeMIDIAddress &rhs) const
Add a relative offset.
constexpr uint8_t getRawChannel() const
Get the channel as an integer [0, 15].
A type-safe class for MIDI channels.
constexpr static MIDIAddress invalid()
Return an invalid address.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
MIDIAddress & operator-=(const RelativeMIDIAddress &rhs)
Subtract a relative offset from this address.
constexpr Cable getCableNumber() const
Get the cable number [CABLE_1, CABLE_16].
A type-safe class for MIDI USB Cable numbers.
constexpr Cable getCableNumber() const
Get the cable number [CABLE_1, CABLE_16].
constexpr RelativeMIDIAddress()
constexpr RelativeMIDIAddress(int deltaAddress, int deltaChannel=0, int deltaCableNumber=0)
A class for saving an offset to a MIDI address.
A class for saving a MIDI channel and cable number.
#define BEGIN_CS_NAMESPACE
constexpr MIDIAddress(Channel channel, Cable cableNumber=CABLE_1)
Constructor.
RelativeMIDIAddress & operator+=(RelativeMIDIAddress that)
Compound addition.
constexpr bool isValid() const
constexpr MIDIAddress(int address, Cable cableNumber)
Constructor.
static bool matchAddressInRange(const MIDIAddress &toMatch, const MIDIAddress &base, uint8_t length)
Check if an address falls within a range of MIDI addresses, starting with address base,...
constexpr Channel getChannel() const
Get the channel [1, 16].
MIDIAddress & operator+=(const RelativeMIDIAddress &rhs)
Add a relative offset to this address.
static bool matchSingle(const MIDIAddress &toMatch, const MIDIAddress &base)
Check if two addresses match (are equal).
MIDIAddress operator-(const RelativeMIDIAddress &rhs) const
Subtract a relative offset.
constexpr MIDIAddress(const MIDIChannelCN &address)
Constructor.
constexpr bool isValid() const
Check if the MIDI address is valid.
constexpr uint8_t getRawChannel() const
Get the channel as an integer [0, 15].
constexpr static MIDIChannelCN invalid()
constexpr bool operator==(const MIDIAddress &rhs) const
Check for equality: two addresses are equal if and only if they are both valid addresses and the MIDI...
constexpr MIDIChannelCN(Channel channel, Cable cableNumber=CABLE_1)
constexpr MIDIChannelCN()
constexpr uint8_t getAddress() const
Get the address [0, 127].
constexpr MIDIAddress(int address, Channel channel=CHANNEL_1, Cable cableNumber=CABLE_1)
Constructor.
constexpr Channel getChannel() const
Get the channel [CHANNEL_1, CHANNEL_16].
constexpr bool operator!=(const MIDIAddress &rhs) const
Check for inequality: two addresses are not equal if and only if they are both valid addresses and ha...
constexpr uint8_t getRaw() const
Get the channel as an integer.
constexpr uint8_t getRawCableNumber() const
Get the cable number as an integer [0, 15].
constexpr uint8_t getRawCableNumber() const
Get the cable number as an integer [0, 15].
constexpr uint8_t getRaw() const
Get the cable as an integer.
constexpr Channel CHANNEL_1
constexpr bool isValid() const
Check if the MIDI address is valid.
constexpr MIDIAddress()
Default constructor, creates an invalid address.
constexpr MIDIAddress(int address, MIDIChannelCN channelCN)
Constructor.