Control Surface master
MIDI Control Surface library for Arduino
Public Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
OutputBankableMIDIAddress Class Reference

#include <Banks/BankableAddresses.hpp>

Detailed Description

A base class for all MIDIOutputElements that can be banked.

Note
These elements don't have to be updated when the bank setting is changed, because they poll the bank setting each time they send a MIDI event.
They are not added to the bank, they just keep a reference to the bank they're a part of.
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.

Definition at line 85 of file BankableAddresses.hpp.

+ Inheritance diagram for OutputBankableMIDIAddress:
+ Collaboration diagram for OutputBankableMIDIAddress:

Public Member Functions

 OutputBankableMIDIAddress (const OutputBank &bank, BankType type)
 Create a new OutputBankableMIDIAddress object. More...
 
 OutputBankableMIDIAddress (BaseOutputBankConfig config)
 Create a new OutputBankableMIDIAddress object. More...
 
RelativeMIDIAddress getAddressOffset (setting_t bankindex) const
 Get the offset relative to the base address. More...
 
RelativeMIDIAddress getAddressOffset () const
 Get the offset relative to the base address. More...
 
setting_t getRawBankSetting () const
 Get the actual bank setting (no matter whether the element is locked or not). More...
 
setting_t getSelection () const
 Get the bank setting. More...
 
void lock ()
 Lock the bank setting. More...
 
void unlock ()
 Unlock the bank setting. More...
 

Protected Attributes

const OutputBankbank
 

Private Attributes

const BankType type
 
setting_t lockedSetting = UNLOCKED
 

Static Private Attributes

static constexpr setting_t UNLOCKED = NO_SETTING
 

Constructor & Destructor Documentation

◆ OutputBankableMIDIAddress() [1/2]

OutputBankableMIDIAddress ( const OutputBank bank,
BankType  type 
)
inline

Create a new OutputBankableMIDIAddress object.

Parameters
bankThe bank to add this element to.
typeWhat address type to change (address, channel or cable number).

Definition at line 95 of file BankableAddresses.hpp.

◆ OutputBankableMIDIAddress() [2/2]

Create a new OutputBankableMIDIAddress object.

Parameters
configThe bank and address type to change.
See also
OutputBankableMIDIAddress::OutputBankableMIDIAddress(Bank<N> &, BankType)

Definition at line 106 of file BankableAddresses.hpp.

Member Function Documentation

◆ getAddressOffset() [1/2]

RelativeMIDIAddress getAddressOffset ( setting_t  bankindex) const
inline

Get the offset relative to the base address.

Definition at line 112 of file BankableAddresses.hpp.

◆ getAddressOffset() [2/2]

RelativeMIDIAddress getAddressOffset ( ) const
inline

Get the offset relative to the base address.

Definition at line 122 of file BankableAddresses.hpp.

◆ 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

◆ type

const BankType type
private

Definition at line 127 of file BankableAddresses.hpp.

◆ bank

const OutputBank& bank
protectedinherited

Definition at line 62 of file BankableAddresses.hpp.

◆ UNLOCKED

constexpr setting_t UNLOCKED = NO_SETTING
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: