Control Surface pin-t-adl
MIDI Control Surface library for Arduino
MIDIAddress.cpp
Go to the documentation of this file.
1#include "MIDIAddress.hpp"
2
4
6 this->addresses.valid &= that.addresses.valid;
7 this->addresses.address += that.addresses.address;
8 this->addresses.channel += that.addresses.channel;
9 this->addresses.cableNumber += that.addresses.cableNumber;
10 return *this;
11}
12
14 this->addresses.valid &= rhs.addresses.valid;
15 this->addresses.address += rhs.addresses.address;
16 this->addresses.channel += rhs.addresses.channel;
17 this->addresses.cableNumber += rhs.addresses.cableNumber;
18 return *this;
19}
20
22 this->addresses.valid &= rhs.addresses.valid;
23 this->addresses.address -= rhs.addresses.address;
24 this->addresses.channel -= rhs.addresses.channel;
25 this->addresses.cableNumber -= rhs.addresses.cableNumber;
26 return *this;
27}
28
30 MIDIAddress copy = *this;
31 copy += rhs;
32 return copy;
33}
34
36 MIDIAddress copy = *this;
37 copy -= rhs;
38 return copy;
39}
40
42 uint8_t length) {
43 bool valid = base.addresses.valid && toMatch.addresses.valid;
44 bool addressInRange =
45 base.addresses.address <= toMatch.addresses.address &&
46 base.addresses.address + length > toMatch.addresses.address;
47 bool equalChannelAndCN =
48 base.addresses.channel == toMatch.addresses.channel &&
49 base.addresses.cableNumber == toMatch.addresses.cableNumber;
50 return valid && addressInRange && equalChannelAndCN;
51}
52
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
MIDIAddress operator-(RelativeMIDIAddress rhs) const
Subtract a relative offset.
Definition: MIDIAddress.cpp:35
RawMIDIAddress addresses
MIDIAddress & operator-=(RelativeMIDIAddress rhs)
Subtract a relative offset from this address.
Definition: MIDIAddress.cpp:21
MIDIAddress operator+(RelativeMIDIAddress rhs) const
Add a relative offset.
Definition: MIDIAddress.cpp:29
static bool matchAddressInRange(MIDIAddress toMatch, MIDIAddress base, uint8_t length)
Check if an address falls within a range of MIDI addresses, starting with address base,...
Definition: MIDIAddress.cpp:41
MIDIAddress & operator+=(RelativeMIDIAddress rhs)
Add a relative offset to this address.
Definition: MIDIAddress.cpp:13
A class for saving an offset to a MIDI address.
RawMIDIAddress addresses
RelativeMIDIAddress & operator+=(RelativeMIDIAddress that)
Compound addition.
Definition: MIDIAddress.cpp:5