This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
BankableMIDIOutput.hpp
Go to the documentation of this file.
1 /* ✔ */
2 
3 #pragma once
4 
5 #include "Bank.hpp"
6 #include "BankConfig.hpp"
8 
10 
12  protected:
20 
21  public:
27 
36  }
37 
44  void lock() {
45  if (lockedSetting == UNLOCKED)
47  }
48 
56 
57  protected:
58  const OutputBank &bank;
59 
60  private:
61  constexpr static setting_t UNLOCKED = NO_SETTING;
63 };
64 
85  public:
96 
106  : BankableMIDIOutput(config.bank, config.type) {}
107 
112  int8_t offset = getSelection() * bank.getTracksPerBank();
113  switch (type) {
114  case CHANGE_ADDRESS: return {offset, 0, 0};
115  case CHANGE_CHANNEL: return {0, offset, 0};
116  case CHANGE_CABLENB: return {0, 0, offset};
117  default: return {};
118  }
119  }
120 
121  private:
122  const BankType type;
123 };
124 
147  public:
156  template <uint8_t NumBanks>
159 };
160 
BankableMIDIOutput_Base::UNLOCKED
constexpr static setting_t UNLOCKED
Definition: BankableMIDIOutput.hpp:61
OutputBank
A class for changing the address of BankableMIDIOutputs.
Definition: Bank.hpp:20
Bank
A class that groups Bankable BankableMIDIOutputs and BankableMIDIInputs, and allows the user to chang...
Definition: Bank.hpp:77
BankConfig.hpp
OutputBank::getTracksPerBank
uint8_t getTracksPerBank() const
Get the number of tracks per bank.
Definition: Bank.hpp:55
BankableMIDIOutput_Base::getRawBankSetting
setting_t getRawBankSetting() const
Get the actual bank setting (no matter whether the element is locked or not).
Definition: BankableMIDIOutput.hpp:26
BankableMIDIOutput_Base::BankableMIDIOutput_Base
BankableMIDIOutput_Base(const OutputBank &bank)
Constructor.
Definition: BankableMIDIOutput.hpp:19
BankableMIDIOutput_Base::lock
void lock()
Lock the bank setting.
Definition: BankableMIDIOutput.hpp:44
MIDICNChannelAddress.hpp
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
BankableMIDIOutput_Base
Definition: BankableMIDIOutput.hpp:11
RelativeMIDICNChannelAddress
A class for saving an offset to a MIDI address.
Definition: MIDICNChannelAddress.hpp:58
ManyAddressesMIDIOutput::ManyAddressesMIDIOutput
ManyAddressesMIDIOutput(const Bank< NumBanks > &bank)
Constructor.
Definition: BankableMIDIOutput.hpp:157
BankableMIDIOutput::getAddressOffset
RelativeMIDICNChannelAddress getAddressOffset() const
Get the offset relative to the base address.
Definition: BankableMIDIOutput.hpp:111
BankableMIDIOutput_Base::lockedSetting
setting_t lockedSetting
Definition: BankableMIDIOutput.hpp:62
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
BankableMIDIOutput_Base::getSelection
setting_t getSelection() const
Get the bank setting.
Definition: BankableMIDIOutput.hpp:34
OutputBank::getSelection
virtual setting_t getSelection() const
Get the current bank setting.
Definition: Bank.hpp:49
NO_SETTING
constexpr setting_t NO_SETTING
A special setting that indicates an unused or invalid setting.
Definition: Def.hpp:65
BankableMIDIOutput::BankableMIDIOutput
BankableMIDIOutput(const OutputBank &bank, BankType type)
Create a new BankableMIDIOutput object.
Definition: BankableMIDIOutput.hpp:94
CHANGE_CHANNEL
Change the offset of the channel number of the element.
Definition: BankConfig.hpp:21
BankableMIDIOutput_Base::unlock
void unlock()
Unlock the bank setting.
Definition: BankableMIDIOutput.hpp:55
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
CHANGE_CABLENB
Change the offset of the cable number of the element (experimental).
Definition: BankConfig.hpp:27
BankType
BankType
An enumeration of the different bank types.
Definition: BankConfig.hpp:12
setting_t
uint8_t setting_t
The type used for Selectors.
Definition: Def.hpp:63
BankableMIDIOutput::type
const BankType type
Definition: BankableMIDIOutput.hpp:122
Bank.hpp
BankableMIDIOutput::BankableMIDIOutput
BankableMIDIOutput(const OutputBankConfig &config)
Create a new BankableMIDIOutput object.
Definition: BankableMIDIOutput.hpp:105
CHANGE_ADDRESS
Change the offset of the address (i.e.
Definition: BankConfig.hpp:17
OutputBankConfig
A struct for selecting the bank of BankableMIDIOutputs and the bank type.
Definition: BankConfig.hpp:50
BankableMIDIOutput
A base class for all MIDIOutputElements that can be banked.
Definition: BankableMIDIOutput.hpp:84