Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
BankAddresses.hpp
Go to the documentation of this file.
1#pragma once
2
4
6
7namespace Bankable {
8
23
24template <uint8_t N>
26 public:
30
32
34 auto address = getBaseAddress();
35 for (const OutputBankableMIDIAddress &bank : banks)
36 address += bank.getAddressOffset();
37 return address;
38 }
39
40 void lock() {
42 bank.lock();
43 }
44
45 void unlock() {
47 bank.unlock();
48 }
49
50 private:
53};
54
56 public:
58 const Array<MIDIAddress, 2> &addresses)
59 : OutputBankableMIDIAddress(config), first(addresses[0]),
60 second(addresses[1]) {}
61
64
71
72 private:
74};
75
76template <uint8_t NumRows, uint8_t NumCols>
78 public:
84
85 uint8_t getBaseAddress(uint8_t row, uint8_t col) const {
86 return addresses[row][col];
87 }
88
89 MIDIAddress getActiveAddress(uint8_t row, uint8_t col) const {
90 MIDIAddress address = {getBaseAddress(row, col), channelCN};
91 return address + getAddressOffset();
92 }
93
94 private:
97};
98
99namespace ManyAddresses {
100
105template <uint8_t NumBanks>
125
130template <uint8_t NumBanks>
132 public:
134 const Array2D<MIDIAddress, 2, NumBanks> &addresses)
135 : ManyAddresses_Base(bank), first {addresses[0]},
136 second {addresses[1]} {}
137
142
143 private:
145};
146
147template <uint8_t NumBanks, uint8_t NumRows, uint8_t NumCols>
166
167} // namespace ManyAddresses
168} // namespace Bankable
169
Array2D< uint8_t, NumRows, NumCols > AddressMatrix
Definition Def.hpp:30
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class that groups Bankable MIDI Output Elements and Bankable MIDI Input Elements,...
Definition Bank.hpp:94
DualAddresses(BaseOutputBankConfig config, const Array< MIDIAddress, 2 > &addresses)
MIDIAddress getFirstActiveAddress() const
MIDIAddress getSecondBaseAddress() const
MIDIAddress getFirstBaseAddress() const
MIDIAddress getSecondActiveAddress() const
DualManyAddresses(const Bank< NumBanks > &bank, const Array2D< MIDIAddress, 2, NumBanks > &addresses)
Array< MIDIAddress, NumBanks > first
Array< MIDIAddress, NumBanks > second
Array< MIDIAddress, NumBanks > addresses
ManyAddresses(const Bank< NumBanks > &bank, const Array< MIDIAddress, NumBanks > &addresses)
Constructor.
Array< AddressMatrix< NumRows, NumCols >, NumBanks > addresses
ManyMatrixAddresses(const Bank< NumBanks > &bank, const Array< AddressMatrix< NumRows, NumCols >, NumBanks > &addresses, const Array< MIDIChannelCable, NumBanks > &channelCNs)
MIDIAddress getActiveAddress(uint8_t row, uint8_t col) const
Array< MIDIChannelCable, NumBanks > channelCNs
AddressMatrix< NumRows, NumCols > addresses
MIDIAddress getActiveAddress(uint8_t row, uint8_t col) const
uint8_t getBaseAddress(uint8_t row, uint8_t col) const
MIDIChannelCable channelCN
MatrixAddress(BaseOutputBankConfig config, const AddressMatrix< NumRows, NumCols > &addresses, MIDIChannelCable channelCN)
Array< OutputBankableMIDIAddress, N > banks
SingleAddressMultipleBanks(const Array< OutputBankableMIDIAddress, N > &banks, MIDIAddress address)
MIDIAddress getBaseAddress() const
SingleAddress(BaseOutputBankConfig config, MIDIAddress address)
MIDIAddress getActiveAddress() const
A struct for selecting the bank of BankableMIDIOutputs and the bank type.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
A class for saving a MIDI channel and cable number.
A base class for all MIDIOutputElements that can have one of many addresses.
setting_t getSelection() const
Get the bank setting.
A base class for all MIDIOutputElements that can be banked.
RelativeMIDIAddress getAddressOffset() const
Get the offset relative to the base address for the active bank.
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
An array wrapper for easy copying, comparing, and iterating.
Definition Array.hpp:32