22inline bool inRange(uint8_t tgt, uint8_t base, uint8_t length) {
23 return (base <= tgt) && (tgt - base < length);
53template <u
int8_t BankSize>
55 const uint8_t N = BankSize;
58 const uint8_t m = tgt;
59 const uint8_t b = base;
60 uint8_t diff = m - b - F *
B;
61 return m >= b + F *
B &&
67template <u
int8_t BankSize>
70 const uint8_t R = rangeLen;
71 const uint8_t N = BankSize;
74 const uint8_t m = tgt;
75 const uint8_t b = base;
76 uint8_t diff = m - b - F *
B;
77 return m >= b + F *
B &&
83template <u
int8_t BankSize>
87 const uint8_t m = tgt;
88 const uint8_t b = base;
89 uint8_t diff = m - b - F *
B;
94template <u
int8_t BankSize>
98 const uint8_t m = tgt;
99 const uint8_t b = base;
100 uint8_t diff = m - b - F *
B;
115template <u
int8_t BankSize>
120 switch (config.
type) {
139 default:
return false;
156template <u
int8_t BankSize>
161 switch (config.
type) {
166 config.
bank, length);
177 default:
return false;
192template <u
int8_t BankSize>
195 switch (config.
type) {
221template <u
int8_t BankSize>
@ CHANGE_CHANNEL
Change the offset of the channel number of the element.
@ CHANGE_CABLENB
Change the offset of the cable number of the element.
@ CHANGE_ADDRESS
Change the offset of the address (i.e.
#define BEGIN_CS_NAMESPACE
A class that groups Bankable MIDI Output Elements and Bankable MIDI Input Elements,...
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
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 uint8_t getAddress() const
Get the address [0, 127].
constexpr uint8_t getRawCableNumber() const
Get the cable number as an integer [0, 15].
constexpr Channel getChannel() const
Get the channel [CHANNEL_1, CHANNEL_16].
constexpr Cable getCableNumber() const
Get the cable number [CABLE_1, CABLE_16].
uint8_t getTracksPerBank() const
Get the number of tracks per bank.
int8_t getSelectionOffset() const
Get the offset of the bank setting.
bool inRange(uint8_t tgt, uint8_t base, uint8_t length)
Check whether a given address is within a range of given length starting from the given base address.
uint8_t getBankIndex(uint8_t tgt, uint8_t base, const Bank< BankSize > &bank)
bool matchBankable(uint8_t tgt, uint8_t base, const Bank< BankSize > &bank)
Check if the given address is part of the bank relative to the base address.
bool matchBankableInRange(uint8_t tgt, uint8_t base, const Bank< BankSize > &bank, uint8_t rangeLen)
uint8_t getRangeIndex(uint8_t tgt, uint8_t base, const Bank< BankSize > &bank)