A type-safe utility class for saving a MIDI address consisting of a 7-bit address, a 4-bit channel, and a 4-bit cable number. More...
#include <Def/MIDIAddress.hpp>
Private Attributes | |
RawMIDIAddress | addresses |
Constructors | |
constexpr | MIDIAddress () |
Default constructor, creates an invalid address. More... | |
constexpr | MIDIAddress (int address, MIDIChannelCN channelCN) |
Constructor. More... | |
constexpr | MIDIAddress (int address, Channel channel=CHANNEL_1, Cable cableNumber=CABLE_1) |
Constructor. More... | |
constexpr | MIDIAddress (int address, Cable cableNumber) |
Constructor. More... | |
constexpr | MIDIAddress (Channel channel, Cable cableNumber=CABLE_1) |
Constructor. More... | |
constexpr | MIDIAddress (const MIDIChannelCN &address) |
Constructor. More... | |
constexpr static MIDIAddress | invalid () |
Return an invalid address. More... | |
Adding/subtracting offsets | |
MIDIAddress & | operator+= (const RelativeMIDIAddress &rhs) |
Add a relative offset to this address. More... | |
MIDIAddress & | operator-= (const RelativeMIDIAddress &rhs) |
Subtract a relative offset from this address. More... | |
MIDIAddress | operator+ (const RelativeMIDIAddress &rhs) const |
Add a relative offset. More... | |
MIDIAddress | operator- (const RelativeMIDIAddress &rhs) const |
Subtract a relative offset. More... | |
Member access | |
constexpr uint8_t | getAddress () const |
Get the address [0, 127]. More... | |
constexpr Channel | getChannel () const |
Get the channel [CHANNEL_1, CHANNEL_16]. More... | |
constexpr uint8_t | getRawChannel () const |
Get the channel as an integer [0, 15]. More... | |
constexpr Cable | getCableNumber () const |
Get the cable number [CABLE_1, CABLE_16]. More... | |
constexpr uint8_t | getRawCableNumber () const |
Get the cable number as an integer [0, 15]. More... | |
Checks | |
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 address, MIDI channel and MIDI USB cable number are equal. More... | |
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 have a MIDI address, MIDI channel or MIDI USB cable number that differs. More... | |
constexpr bool | isValid () const |
Check if the MIDI address is valid. More... | |
constexpr | operator bool () const |
Check if the MIDI address is valid. More... | |
Base functions for address pattern matching | |
static bool | matchSingle (const MIDIAddress &toMatch, const MIDIAddress &base) |
Check if two addresses match (are equal). More... | |
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 , with a given length. More... | |
A type-safe utility class for saving a MIDI address consisting of a 7-bit address, a 4-bit channel, and a 4-bit cable number.
Definition at line 91 of file MIDIAddress.hpp.
|
inlineconstexpr |
Default constructor, creates an invalid address.
Definition at line 97 of file MIDIAddress.hpp.
|
inlineconstexpr |
Constructor.
address | The 7-bit MIDI address. Depending on the message type, this can be the MIDI note number, the number of the MIDI Control Change Controller, etc. Must be a number in the range [0, 127]. |
channelCN | The MIDI Channel and the MIDI USB cable number. |
Definition at line 116 of file MIDIAddress.hpp.
|
inlineconstexpr |
Constructor.
address | The 7-bit MIDI address. Depending on the message type, this can be the MIDI note number, the number of the MIDI Control Change Controller, etc. Must be a number in the range [0, 127]. |
channel | The MIDI Channel. Use the constants CHANNEL_1 through CHANNEL_16. |
cableNumber | The MIDI USB cable number. Use the constants CABLE_1 through CABLE_16. |
Definition at line 139 of file MIDIAddress.hpp.
|
inlineconstexpr |
Constructor.
address | The 7-bit MIDI address. Depending on the message type, this can be the MIDI note number, the number of the MIDI Control Change Controller, etc. Must be a number in the range [0, 127]. |
cableNumber | The MIDI USB cable number. Use the constants CABLE_1 through CABLE_16. |
Definition at line 160 of file MIDIAddress.hpp.
|
inlineconstexpr |
Constructor.
channel | The MIDI Channel. Use the constants CHANNEL_1 through CHANNEL_16. |
cableNumber | The MIDI USB cable number. Use the constants CABLE_1 through CABLE_16. |
Definition at line 178 of file MIDIAddress.hpp.
|
inlineconstexpr |
Constructor.
address | The MIDI Channel and the MIDI USB cable number. |
Definition at line 192 of file MIDIAddress.hpp.
|
inlinestaticconstexpr |
Return an invalid address.
Definition at line 196 of file MIDIAddress.hpp.
MIDIAddress & operator+= | ( | const RelativeMIDIAddress & | rhs | ) |
Add a relative offset to this address.
Definition at line 13 of file MIDIAddress.cpp.
MIDIAddress & operator-= | ( | const RelativeMIDIAddress & | rhs | ) |
Subtract a relative offset from this address.
Definition at line 21 of file MIDIAddress.cpp.
MIDIAddress operator+ | ( | const RelativeMIDIAddress & | rhs | ) | const |
Add a relative offset.
Definition at line 29 of file MIDIAddress.cpp.
MIDIAddress operator- | ( | const RelativeMIDIAddress & | rhs | ) | const |
Subtract a relative offset.
Definition at line 35 of file MIDIAddress.cpp.
|
inlineconstexpr |
Get the address [0, 127].
Definition at line 223 of file MIDIAddress.hpp.
|
inlineconstexpr |
Get the channel [CHANNEL_1, CHANNEL_16].
Definition at line 226 of file MIDIAddress.hpp.
|
inlineconstexpr |
Get the channel as an integer [0, 15].
Definition at line 228 of file MIDIAddress.hpp.
|
inlineconstexpr |
Get the cable number [CABLE_1, CABLE_16].
Definition at line 231 of file MIDIAddress.hpp.
|
inlineconstexpr |
Get the cable number as an integer [0, 15].
Definition at line 235 of file MIDIAddress.hpp.
|
inlineconstexpr |
Check for equality: two addresses are equal if and only if they are both valid addresses and the MIDI address, MIDI channel and MIDI USB cable number are equal.
Definition at line 249 of file MIDIAddress.hpp.
|
inlineconstexpr |
Check for inequality: two addresses are not equal if and only if they are both valid addresses and have a MIDI address, MIDI channel or MIDI USB cable number that differs.
Definition at line 260 of file MIDIAddress.hpp.
|
inlineconstexpr |
Check if the MIDI address is valid.
Definition at line 268 of file MIDIAddress.hpp.
|
inlineexplicitconstexpr |
|
static |
Check if two addresses match (are equal).
Definition at line 41 of file MIDIAddress.cpp.
|
static |
Check if an address falls within a range of MIDI addresses, starting with address base
, with a given length.
true | toMatch and base are both valid addresses, the MIDI address is within the given range, and the MIDI Channel and MIDI USB Cable Number of toMatch and base are the same. |
false | Otherwise. |
Definition at line 46 of file MIDIAddress.cpp.
|
private |
Definition at line 298 of file MIDIAddress.hpp.