This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
BankAddresses.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "BankableMIDIOutput.hpp"
4 
6 
7 namespace Bankable {
8 
10  public:
12  : BankableMIDIOutput{config}, address{address} {}
13 
15 
17  return getBaseAddress() + getAddressOffset();
18  }
19 
20  private:
22 };
23 
25  public:
29 
31  return addresses[i];
32  }
33 
35  return getBaseAddress(i) + getAddressOffset();
36  }
37 
38  private:
40 };
41 
42 template <uint8_t nb_rows, uint8_t nb_cols>
44  public:
49  channelCN} {}
50 
51  uint8_t getBaseAddress(uint8_t row, uint8_t col) const {
52  return addresses[row][col];
53  }
54 
55  MIDICNChannelAddress getActiveAddress(uint8_t row, uint8_t col) const {
56  MIDICNChannelAddress address = {getBaseAddress(row, col), channelCN};
57  return address + getAddressOffset();
58  }
59 
60  private:
63 };
64 
65 namespace ManyAddresses {
66 
71 template <uint8_t NumBanks>
73  public:
85 
87  return addresses[getSelection()];
88  }
89 
90  private:
92 };
93 
98 template <uint8_t NumBanks>
100  public:
102  OutputBankConfig config,
104  : BankableMIDIOutput{config}, addresses{addresses} {}
105 
107  return addresses[i][getSelection()];
108  }
109 
110  private:
112 };
113 
114 template <uint8_t NumBanks, uint8_t nb_rows, uint8_t nb_cols>
116  public:
118  OutputBankConfig config,
122  channelCNs} {}
123 
124  MIDICNChannelAddress getActiveAddress(uint8_t row, uint8_t col) const {
125  return {addresses[getSelection()][row][col],
127  }
128 
129  private:
132 };
133 
134 } // namespace ManyAddresses
135 } // namespace Bankable
136 
Bankable::ManyAddresses::ManyAddresses::addresses
Array< MIDICNChannelAddress, NumBanks > addresses
Definition: BankAddresses.hpp:91
Bank
A class that groups Bankable BankableMIDIOutputs and BankableMIDIInputs, and allows the user to chang...
Definition: Bank.hpp:77
Bankable::ManyAddresses::ManyMatrixAddresses
Definition: BankAddresses.hpp:115
Bankable::TwoSingleAddresses::getBaseAddress
MIDICNChannelAddress getBaseAddress(uint8_t i) const
Definition: BankAddresses.hpp:30
BankableMIDIOutput.hpp
Bankable::SingleAddress::address
MIDICNChannelAddress address
Definition: BankAddresses.hpp:21
Bankable::TwoSingleAddresses::addresses
Array< MIDICNChannelAddress, 2 > addresses
Definition: BankAddresses.hpp:39
Bankable
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
Definition: BankAddresses.hpp:7
Bankable::SingleAddress::getActiveAddress
MIDICNChannelAddress getActiveAddress() const
Definition: BankAddresses.hpp:16
Bankable::ManyAddresses::ManyMatrixAddresses::getActiveAddress
MIDICNChannelAddress getActiveAddress(uint8_t row, uint8_t col) const
Definition: BankAddresses.hpp:124
Bankable::SingleAddress::SingleAddress
SingleAddress(OutputBankConfig config, MIDICNChannelAddress address)
Definition: BankAddresses.hpp:11
Bankable::ManyAddresses::ManyAddresses
Definition: BankAddresses.hpp:72
Bankable::TwoSingleAddresses::TwoSingleAddresses
TwoSingleAddresses(OutputBankConfig config, const Array< MIDICNChannelAddress, 2 > &addresses)
Definition: BankAddresses.hpp:26
Bankable::MatrixAddress::MatrixAddress
MatrixAddress(OutputBankConfig config, const AddressMatrix< nb_rows, nb_cols > &addresses, MIDICNChannel channelCN)
Definition: BankAddresses.hpp:45
Bankable::TwoSingleAddresses::getActiveAddress
MIDICNChannelAddress getActiveAddress(uint8_t i) const
Definition: BankAddresses.hpp:34
Bankable::ManyAddresses::TwoManyAddresses::addresses
Array2D< MIDICNChannelAddress, 2, NumBanks > addresses
Definition: BankAddresses.hpp:111
BankableMIDIOutput_Base::bank
const OutputBank & bank
Definition: BankableMIDIOutput.hpp:58
ManyAddressesMIDIOutput
A base class for all MIDIOutputElements that can have one of many addresses.
Definition: BankableMIDIOutput.hpp:146
Array< MIDICNChannelAddress, 2 >
BankableMIDIOutput::getAddressOffset
RelativeMIDICNChannelAddress getAddressOffset() const
Get the offset relative to the base address.
Definition: BankableMIDIOutput.hpp:111
Bankable::ManyAddresses::TwoManyAddresses::TwoManyAddresses
TwoManyAddresses(OutputBankConfig config, const Array2D< MIDICNChannelAddress, 2, NumBanks > &addresses)
Definition: BankAddresses.hpp:101
Bankable::MatrixAddress::channelCN
MIDICNChannel channelCN
Definition: BankAddresses.hpp:62
Bankable::TwoSingleAddresses
Definition: BankAddresses.hpp:24
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
Bankable::ManyAddresses::TwoManyAddresses
Definition: BankAddresses.hpp:99
MIDICNChannelAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition: MIDICNChannelAddress.hpp:82
BankableMIDIOutput_Base::getSelection
setting_t getSelection() const
Get the bank setting.
Definition: BankableMIDIOutput.hpp:34
Bankable::MatrixAddress::getActiveAddress
MIDICNChannelAddress getActiveAddress(uint8_t row, uint8_t col) const
Definition: BankAddresses.hpp:55
Bankable::ManyAddresses::ManyMatrixAddresses::ManyMatrixAddresses
ManyMatrixAddresses(OutputBankConfig config, const Array< AddressMatrix< nb_rows, nb_cols >, NumBanks > &addresses, const Array< MIDICNChannel, NumBanks > &channelCNs)
Definition: BankAddresses.hpp:117
MIDICNChannel
A class for saving a MIDI channel and cable number.
Definition: MIDICNChannelAddress.hpp:19
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
Bankable::SingleAddress
Definition: BankAddresses.hpp:9
Bankable::ManyAddresses::ManyMatrixAddresses::addresses
Array< AddressMatrix< nb_rows, nb_cols >, NumBanks > addresses
Definition: BankAddresses.hpp:130
Bankable::SingleAddress::getBaseAddress
MIDICNChannelAddress getBaseAddress() const
Definition: BankAddresses.hpp:14
Bankable::ManyAddresses::ManyMatrixAddresses::channelCNs
Array< MIDICNChannel, NumBanks > channelCNs
Definition: BankAddresses.hpp:131
Bankable::MatrixAddress::getBaseAddress
uint8_t getBaseAddress(uint8_t row, uint8_t col) const
Definition: BankAddresses.hpp:51
Bankable::MatrixAddress::addresses
AddressMatrix< nb_rows, nb_cols > addresses
Definition: BankAddresses.hpp:61
OutputBankConfig
A struct for selecting the bank of BankableMIDIOutputs and the bank type.
Definition: BankConfig.hpp:50
Bankable::ManyAddresses::TwoManyAddresses::getActiveAddress
MIDICNChannelAddress getActiveAddress(uint8_t i) const
Definition: BankAddresses.hpp:106
Bankable::MatrixAddress
Definition: BankAddresses.hpp:43
BankableMIDIOutput
A base class for all MIDIOutputElements that can be banked.
Definition: BankableMIDIOutput.hpp:84
Bankable::ManyAddresses::ManyAddresses::getActiveAddress
MIDICNChannelAddress getActiveAddress() const
Definition: BankAddresses.hpp:86
Bankable::ManyAddresses::ManyAddresses::ManyAddresses
ManyAddresses(const Bank< NumBanks > &bank, const Array< MIDICNChannelAddress, NumBanks > &addresses)
Constructor.
Definition: BankAddresses.hpp:82