Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Bank< NumBanks > Class Template Reference

#include <Banks/Bank.hpp>

Detailed Description

template<setting_t NumBanks>
class Bank< NumBanks >

A class that groups Bankable MIDI Output Elements and Bankable MIDI Input Elements, and allows the user to change the addresses of these elements.

See also
FAQ: Can I change the address, controller number, MIDI channel, etc. at runtime?
FAQ: How do banks work?
Template Parameters
NumBanksThe number of banks.
Examples
Bank-Button-Matrix.ino, Bank.ino, Bankable-Smart-Control-Change-Potentiometer.ino, Custom-MIDI-Output-Element-Bankable.ino, Custom-Selector-Callback.ino, Encoder-Selector-Bank.ino, MCU-OLED-SSD1306-x2.ino, MCU-OLED-SSD1306.ino, MIDI-Controller-Finished-Example.ino, MIDI_controller-97.ino, ManyAddressesPCButton.ino, Note-ManyAddresses-Transposer.ino, and One-Pot-Both-PB-and-CC.ino.

Definition at line 94 of file Bank.hpp.

+ Inheritance diagram for Bank< NumBanks >:
+ Collaboration diagram for Bank< NumBanks >:

Public Member Functions

 Bank (uint8_t tracksPerBank=1, setting_t initialSelection=0, int8_t selectionOffset=0)
 Construct a new Bank object.
 
void select (setting_t bankSetting) override
 Select the given bank setting.
 
void add (BankSettingChangeCallback *bankable)
 Add a Bankable MIDI Input Element to the bank.
 
void remove (BankSettingChangeCallback *bankable)
 Remove a Bankable MIDI Input Element from the bank.
 
setting_t getInitialSelection () const
 
void setInitialSelection (setting_t initialSelection)
 
setting_t getSelection () const
 Get the current bank setting (zero-based).
 
int8_t getSelectionOffset () const
 Get the offset of the bank setting.
 
uint8_t getTracksPerBank () const
 Get the number of tracks per bank.
 
int8_t getOffsetOfSetting (setting_t s) const
 The same as getOffset, but for a given setting.
 
int8_t getOffset () const
 Get the address offset (number of banks times the index of the selected bank after applying the offset)
 

Static Public Member Functions

static constexpr uint8_t getNumberOfBanks ()
 Get the number of banks.
 
static setting_t validateSetting (setting_t setting)
 

Private Attributes

DoublyLinkedList< BankSettingChangeCallbackinputBankables
 A linked list of all Bankable MIDI Input Elements that have been added to this bank, and that should be updated when the bank setting changes.
 
setting_t initialSelection
 
uint8_t tracksPerBank
 
setting_t bankSetting
 
int8_t selectionOffset
 

Constructor & Destructor Documentation

◆ Bank()

template<setting_t NumBanks>
Bank ( uint8_t tracksPerBank = 1,
setting_t initialSelection = 0,
int8_t selectionOffset = 0 )
inline

Construct a new Bank object.

Parameters
tracksPerBankThe number of addresses/tracks to skip for each bank setting. Must be strictly positive.
initialSelectionThe initial bank setting.
selectionOffsetThe offset added to the bank setting before computing the actual address offset.

Definition at line 107 of file Bank.hpp.

Member Function Documentation

◆ select()

template<setting_t NumBanks>
void select ( setting_t bankSetting)
overridevirtual

Select the given bank setting.

All Bankable MIDI Input elements that were added to this bank will be updated.

Parameters
bankSettingThe new setting to select.

Implements Selectable< NumBanks >.

Definition at line 162 of file Bank.hpp.

◆ getNumberOfBanks()

template<setting_t NumBanks>
static constexpr uint8_t getNumberOfBanks ( )
inlinestaticconstexpr

Get the number of banks.

Definition at line 122 of file Bank.hpp.

◆ add()

template<setting_t NumBanks>
void add ( BankSettingChangeCallback * bankable)

Add a Bankable MIDI Input Element to the bank.

Parameters
bankableThe MIDI Input Element to be added.

Definition at line 152 of file Bank.hpp.

◆ remove()

template<setting_t NumBanks>
void remove ( BankSettingChangeCallback * bankable)

Remove a Bankable MIDI Input Element from the bank.

Parameters
bankableThe MIDI Input Element to be removed.

Definition at line 157 of file Bank.hpp.

◆ validateSetting()

static setting_t validateSetting ( setting_t setting)
inlinestaticinherited

Definition at line 19 of file Selectable.hpp.

◆ getInitialSelection()

setting_t getInitialSelection ( ) const
inlineinherited

Definition at line 33 of file Selectable.hpp.

◆ setInitialSelection()

void setInitialSelection ( setting_t initialSelection)
inlineinherited

Definition at line 35 of file Selectable.hpp.

◆ getSelection()

setting_t getSelection ( ) const
inlineinherited

Get the current bank setting (zero-based).

Definition at line 44 of file Bank.hpp.

◆ getSelectionOffset()

int8_t getSelectionOffset ( ) const
inlineinherited

Get the offset of the bank setting.

Definition at line 46 of file Bank.hpp.

◆ getTracksPerBank()

uint8_t getTracksPerBank ( ) const
inlineinherited

Get the number of tracks per bank.

This is the number of addresses/tracks to skip for each bank setting.

Definition at line 50 of file Bank.hpp.

◆ getOffsetOfSetting()

int8_t getOffsetOfSetting ( setting_t s) const
inlineinherited

The same as getOffset, but for a given setting.

Definition at line 53 of file Bank.hpp.

◆ getOffset()

int8_t getOffset ( ) const
inlineinherited

Get the address offset (number of banks times the index of the selected bank after applying the offset)

Definition at line 58 of file Bank.hpp.

Member Data Documentation

◆ inputBankables

template<setting_t NumBanks>
DoublyLinkedList<BankSettingChangeCallback> inputBankables
private

A linked list of all Bankable MIDI Input Elements that have been added to this bank, and that should be updated when the bank setting changes.

The list is updated automatically when Bankable MIDI Input Elements are created or destroyed.

Definition at line 142 of file Bank.hpp.

◆ initialSelection

setting_t initialSelection
privateinherited

Definition at line 40 of file Selectable.hpp.

◆ tracksPerBank

uint8_t tracksPerBank
privateinherited

Definition at line 61 of file Bank.hpp.

◆ bankSetting

setting_t bankSetting
privateinherited

Definition at line 62 of file Bank.hpp.

◆ selectionOffset

int8_t selectionOffset
privateinherited

Definition at line 63 of file Bank.hpp.


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