Control Surface stm32
MIDI Control Surface library for Arduino
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
40 }
41
48 void lock() {
51 }
52
60
61 protected:
63
64 private:
65 constexpr static setting_t UNLOCKED = NO_SETTING;
67};
68
86 public:
97
107 : OutputBankableMIDIAddress(config.bank, config.type) {}
108
113 int8_t offset = bank.getOffsetOfSetting(bankindex);
114 switch (type) {
115 case CHANGE_ADDRESS: return {offset, 0, 0};
116 case CHANGE_CHANNEL: return {0, offset, 0};
117 case CHANGE_CABLENB: return {0, 0, offset};
118 default: return {};
119 }
120 }
124 }
125
126 private:
128};
129
149 public:
158 template <uint8_t NumBanks>
161};
162
BankType
An enumeration of the different bank types.
Definition: BankConfig.hpp:12
@ CHANGE_CHANNEL
Change the offset of the channel number of the element.
Definition: BankConfig.hpp:21
@ CHANGE_CABLENB
Change the offset of the cable number of the element.
Definition: BankConfig.hpp:25
@ CHANGE_ADDRESS
Change the offset of the address (i.e.
Definition: BankConfig.hpp:17
constexpr setting_t NO_SETTING
A special setting that indicates an unused or invalid setting.
Definition: Def.hpp:53
uint8_t setting_t
The type used for Selectors.
Definition: Def.hpp:51
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class that groups Bankable MIDI Output Elements and Bankable MIDI Input Elements,...
Definition: Bank.hpp:91
A struct for selecting the bank of BankableMIDIOutputs and the bank type.
Definition: BankConfig.hpp:60
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.
static constexpr setting_t UNLOCKED
void lock()
Lock the bank setting.
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.
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.