This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
Public Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
BankableMIDIOutput Class Reference

A base class for all MIDIOutputElements that can be banked. More...

#include <BankableMIDIOutput.hpp>

Inheritance diagram for BankableMIDIOutput:
Collaboration diagram for BankableMIDIOutput:

Public Member Functions

 BankableMIDIOutput (const OutputBank &bank, BankType type)
 Create a new BankableMIDIOutput object. More...
 BankableMIDIOutput (const OutputBankConfig &config)
 Create a new BankableMIDIOutput object. More...
RelativeMIDICNChannelAddress 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

constexpr static setting_t UNLOCKED = NO_SETTING

Detailed Description

A base class for all MIDIOutputElements that can be banked.

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.
Create BankableMIDIElement class, make this inherit from it, as well as ManyAddressesMIDIOutput.

Definition at line 84 of file BankableMIDIOutput.hpp.

Constructor & Destructor Documentation

◆ BankableMIDIOutput() [1/2]

BankableMIDIOutput::BankableMIDIOutput ( const OutputBank bank,
BankType  type 

Create a new BankableMIDIOutput object.

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

Definition at line 94 of file BankableMIDIOutput.hpp.

◆ BankableMIDIOutput() [2/2]

BankableMIDIOutput::BankableMIDIOutput ( const OutputBankConfig config)

Create a new BankableMIDIOutput object.

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

Definition at line 105 of file BankableMIDIOutput.hpp.

Member Function Documentation

◆ getAddressOffset()

RelativeMIDICNChannelAddress BankableMIDIOutput::getAddressOffset ( ) const

Get the offset relative to the base address.

Definition at line 111 of file BankableMIDIOutput.hpp.

◆ getRawBankSetting()

setting_t BankableMIDIOutput_Base::getRawBankSetting ( ) const

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

Definition at line 26 of file BankableMIDIOutput.hpp.

◆ getSelection()

setting_t BankableMIDIOutput_Base::getSelection ( ) const

Get the bank setting.

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

Definition at line 34 of file BankableMIDIOutput.hpp.

◆ lock()

void BankableMIDIOutput_Base::lock ( )

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 44 of file BankableMIDIOutput.hpp.

◆ unlock()

void BankableMIDIOutput_Base::unlock ( )

Unlock the bank setting.

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

Definition at line 55 of file BankableMIDIOutput.hpp.

Member Data Documentation

◆ type

const BankType BankableMIDIOutput::type

Definition at line 122 of file BankableMIDIOutput.hpp.

◆ bank

const OutputBank& BankableMIDIOutput_Base::bank

Definition at line 58 of file BankableMIDIOutput.hpp.


constexpr static setting_t BankableMIDIOutput_Base::UNLOCKED = NO_SETTING

Definition at line 61 of file BankableMIDIOutput.hpp.

◆ lockedSetting

setting_t BankableMIDIOutput_Base::lockedSetting = UNLOCKED

Definition at line 62 of file BankableMIDIOutput.hpp.

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