Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
BankableAddresses.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
5#include "Bank.hpp"
6#include "BankConfig.hpp"
7#include <Def/MIDIAddress.hpp>
8
10
16 protected:
24
25 public:
31
41
48 void lock() {
51 }
52
60
61 protected:
63
64 private:
65 constexpr static setting_t Unlocked = NoSetting;
67};
68
86 public:
97
108
113 int8_t offset = bank.getOffsetOfSetting(bankindex);
114 switch (type) {
115 case ChangeAddress: return {offset, 0, 0};
116 case ChangeChannel: return {0, offset, 0};
117 case ChangeCable: return {0, 0, offset};
118 default: return {};
119 }
120 }
127
128 private:
130};
131
151 public:
160 template <uint8_t NumBanks>
163};
164
BankType
An enumeration of the different bank types.
@ ChangeAddress
Change the offset of the address (i.e.
@ ChangeCable
Change the offset of the cable number of the element.
@ ChangeChannel
Change the offset of the channel number of the element.
constexpr setting_t NoSetting
A special setting that indicates an unused or invalid setting.
Definition Def.hpp:55
uint8_t setting_t
The type used for Selectors.
Definition Def.hpp:53
#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
A struct for selecting the bank of BankableMIDIOutputs and the bank type.
A base class for all MIDIOutputElements that can have one of many addresses.
ManyAddresses_Base(const Bank< NumBanks > &bank)
Constructor.
A class for changing the address of BankableMIDIOutputs.
Definition Bank.hpp:16
setting_t getSelection() const
Get the current bank setting (zero-based).
Definition Bank.hpp:44
int8_t getOffsetOfSetting(setting_t s) const
The same as getOffset, but for a given setting.
Definition Bank.hpp:53
Class for keeping track of the active bank, and allows locking of the bank setting.
setting_t getSelection() const
Get the bank setting.
OutputBankableMIDIAddress_Base(const OutputBank &bank)
Constructor.
setting_t getRawBankSetting() const
Get the actual bank setting (no matter whether the element is locked or not).
void unlock()
Unlock the bank setting.
void lock()
Lock the bank setting.
static constexpr setting_t Unlocked
A base class for all MIDIOutputElements that can be banked.
OutputBankableMIDIAddress(const OutputBank &bank, BankType type)
Create a new OutputBankableMIDIAddress object.
RelativeMIDIAddress getAddressOffset() const
Get the offset relative to the base address for the active bank.
OutputBankableMIDIAddress(BaseOutputBankConfig config)
Create a new OutputBankableMIDIAddress object.
RelativeMIDIAddress getAddressOffset(setting_t bankindex) const
Get the offset relative to the base address.
A class for saving an offset to a MIDI address.