MIDI Control Surface library for Arduino
|
Go to the documentation of this file.
11 struct __attribute__((packed)) RawMIDICNChannelAddress {
15 uint8_t cableNumber : 4;
48 constexpr
explicit operator bool()
const {
return isValid(); }
65 int deltaCableNumber = 0)
68 (uint8_t)deltaAddress,
69 (uint8_t)deltaChannel,
70 (uint8_t)deltaCableNumber,
76 static_assert(((-1) & 0x7F) == 0x7F,
77 "Negative numbers must be two's complement");
99 int cableNumber = 0x0)
103 (uint8_t)channel.getRaw(),
104 (uint8_t)cableNumber,
110 (uint8_t)channel.
getRaw(),
111 (uint8_t)cableNumber,
127 return this->addresses.valid && rhs.
addresses.valid &&
128 this->addresses.address == rhs.
addresses.address &&
129 this->addresses.channel == rhs.
addresses.channel &&
130 this->addresses.cableNumber == rhs.
addresses.cableNumber;
134 return this->addresses.valid && rhs.
addresses.valid &&
135 !(this->addresses.address == rhs.
addresses.address &&
136 this->addresses.channel == rhs.
addresses.channel &&
137 this->addresses.cableNumber == rhs.
addresses.cableNumber);
158 constexpr
explicit operator bool()
const {
return isValid(); }
MIDICNChannelAddress operator-(const RelativeMIDICNChannelAddress &rhs) const
A type-safe class for MIDI channels.
constexpr static MIDICNChannelAddress invalid()
constexpr MIDICNChannelAddress(Channel channel, int cableNumber=0x0)
constexpr MIDICNChannelAddress()
RawMIDICNChannelAddress addresses
constexpr uint8_t getRawChannel() const
Get the channel [0, 15].
static bool matchAddressInRange(const MIDICNChannelAddress &toMatch, const MIDICNChannelAddress &base, uint8_t length)
Check if an address falls within a range of addresses, starting with address base,...
#define BEGIN_CS_NAMESPACE
constexpr uint8_t getCableNumber() const
Get the cable number [0, 15].
A class for saving an offset to a MIDI address.
constexpr bool isValid() const
Check if the MIDI address is valid.
RawMIDICNChannelAddress addresses
static bool matchSingle(const MIDICNChannelAddress &toMatch, const MIDICNChannelAddress &base)
Check if two addresses match.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
constexpr MIDICNChannelAddress(int address, MIDICNChannel channelCN)
constexpr RelativeMIDICNChannelAddress()
constexpr uint8_t getAddress() const
Get the address [0, 127].
constexpr bool isValid() const
Check if the MIDI address is valid.
constexpr RelativeMIDICNChannelAddress(int deltaAddress, int deltaChannel=0, int deltaCableNumber=0)
A class for saving a MIDI channel and cable number.
RawMIDICNChannelAddress addresses
constexpr int8_t getRaw() const
Get the channel as an integer.
constexpr MIDICNChannelAddress(const MIDICNChannel &address)
constexpr MIDICNChannel()
MIDICNChannelAddress & operator-=(const RelativeMIDICNChannelAddress &rhs)
MIDICNChannelAddress operator+(const RelativeMIDICNChannelAddress &rhs) const
MIDICNChannelAddress & operator+=(const RelativeMIDICNChannelAddress &rhs)
constexpr bool operator==(const MIDICNChannelAddress &rhs) const
constexpr uint8_t getRawChannel() const
Get the channel as an integer [0, 15].
constexpr MIDICNChannelAddress(int address, Channel channel=CHANNEL_1, int cableNumber=0x0)
constexpr bool operator!=(const MIDICNChannelAddress &rhs) const
constexpr static MIDICNChannel invalid()
constexpr Channel getChannel() const
Get the channel [CHANNEL_1, CHANNEL_16].
constexpr Channel CHANNEL_1
constexpr Channel getChannel() const
Get the channel [1, 16].
constexpr MIDICNChannel(Channel channel, int cableNumber=0)
constexpr bool isValid() const
constexpr uint8_t getCableNumber() const
Get the cable number [0, 15].