Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
ManyAddresses_Base Class Reference

#include <Banks/BankableAddresses.hpp>

Detailed Description

A base class for all MIDIOutputElements that can have one of many addresses.

The bank setting determines the address that's being used.

Note
To prevent 'sticky' notes (i.e. a button is pressed, a note on is sent, the bank is changed, the button is released, and the note off is sent to a different address, causing the first note to keep on playing indefinitely), there must be a way to lock the bank setting while a note is playing. Then when it is no longer playing, the bank setting is unlocked.
Invariant
getSelection and getRawBankSetting always return a number in the half-open interval \( \left[0, \mathrm{bank.getNumberOfBanks()}\right) \cap \mathbb{N} \).

Definition at line 150 of file BankableAddresses.hpp.

+ Inheritance diagram for ManyAddresses_Base:
+ Collaboration diagram for ManyAddresses_Base:

Public Member Functions

template<uint8_t NumBanks>
 ManyAddresses_Base (const Bank< NumBanks > &bank)
 Constructor.
 
setting_t getRawBankSetting () const
 Get the actual bank setting (no matter whether the element is locked or not).
 
setting_t getSelection () const
 Get the bank setting.
 
void lock ()
 Lock the bank setting.
 
void unlock ()
 Unlock the bank setting.
 

Protected Attributes

const OutputBankbank
 

Private Attributes

setting_t lockedSetting = Unlocked
 

Static Private Attributes

static constexpr setting_t Unlocked = NoSetting
 

Constructor & Destructor Documentation

◆ ManyAddresses_Base()

template<uint8_t NumBanks>
ManyAddresses_Base ( const Bank< NumBanks > & bank)
inline

Constructor.

Parameters
bankThe bank to add this element to.
Template Parameters
NumBanksThe number of bank settings bank has.

Definition at line 161 of file BankableAddresses.hpp.

Member Function Documentation

◆ getRawBankSetting()

setting_t getRawBankSetting ( ) const
inlineinherited

Get the actual bank setting (no matter whether the element is locked or not).

Definition at line 30 of file BankableAddresses.hpp.

◆ getSelection()

setting_t getSelection ( ) const
inlineinherited

Get the bank setting.

If the element is locked, the bank setting from the moment it was locked is returned.

Definition at line 38 of file BankableAddresses.hpp.

◆ lock()

void lock ( )
inlineinherited

Lock the bank setting.

As long as it's locked, getSelection will return the current setting, independent from the actual bank setting.

Definition at line 48 of file BankableAddresses.hpp.

◆ unlock()

void unlock ( )
inlineinherited

Unlock the bank setting.

After unlocking, getSelection will return the actual bank setting again.

Definition at line 59 of file BankableAddresses.hpp.

Member Data Documentation

◆ bank

const OutputBank& bank
protectedinherited

Definition at line 62 of file BankableAddresses.hpp.

◆ Unlocked

constexpr setting_t Unlocked = NoSetting
staticconstexprprivateinherited

Definition at line 65 of file BankableAddresses.hpp.

◆ lockedSetting

setting_t lockedSetting = Unlocked
privateinherited

Definition at line 66 of file BankableAddresses.hpp.


The documentation for this class was generated from the following file: