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 | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Bank< N > Class Template Reference

A class that groups Bankable BankableMIDIOutputs and BankableMIDIInputs, and allows the user to change the addresses of these elements. More...

#include <Bank.hpp>

Inheritance diagram for Bank< N >:
Collaboration diagram for Bank< N >:

Public Member Functions

 Bank (uint8_t tracksPerBank=1, setting_t initialSelection=0)
 Construct a new Bank object. More...
 
void select (setting_t bankSetting) override
 Select the given bank setting. More...
 
setting_t getInitialSelection () const
 
void setInitialSelection (setting_t initialSelection)
 
virtual setting_t getSelection () const
 Get the current bank setting. More...
 
uint8_t getTracksPerBank () const
 Get the number of tracks per bank. More...
 
uint8_t getOffset () const
 Get the offset (number of banks times the index of the selected bank) More...
 

Static Public Member Functions

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

Private Member Functions

void add (BankableMIDIInput< N > *bankable)
 Add a BankableMIDIInput to the bank. More...
 
void remove (BankableMIDIInput< N > *bankable)
 Remove a BankableMIDIInput from the bank. More...
 

Private Attributes

DoublyLinkedList< BankableMIDIInput< N > > inputBankables
 A linked list of all BankableMIDIInput elements that have been added to this bank, and that should be updated when the bank setting changes. More...
 
setting_t initialSelection
 
uint8_t tracksPerBank
 
setting_t bankSetting
 

Detailed Description

template<setting_t N>
class Bank< N >

A class that groups Bankable BankableMIDIOutputs and BankableMIDIInputs, and allows the user to change the addresses of these elements.

Template Parameters
NThe number of banks.
Examples
Bank-Button-Matrix.ino, Encoder-Selector-Bank.ino, MCU-OLED-SSD1306-x2.ino, MCU-OLED-SSD1306.ino, MIDI-Controller-Finished-Example.ino, and One-Pot-Both-PB-and-CC.ino.

Definition at line 77 of file Bank.hpp.

Constructor & Destructor Documentation

◆ Bank()

template<setting_t N>
Bank< N >::Bank ( uint8_t  tracksPerBank = 1,
setting_t  initialSelection = 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.

Definition at line 90 of file Bank.hpp.

Member Function Documentation

◆ select()

template<setting_t N>
void Bank< N >::select ( setting_t  bankSetting)
overridevirtual

Select the given bank setting.

All BankableMIDIInputs will be updated.

Parameters
bankSettingThe new setting to select.

Implements Selectable< N >.

Definition at line 160 of file Bank.hpp.

◆ getNumberOfBanks()

template<setting_t N>
constexpr static uint8_t Bank< N >::getNumberOfBanks ( )
inlinestaticconstexpr

Get the number of Banks.

Definition at line 107 of file Bank.hpp.

◆ add()

template<setting_t N>
void Bank< N >::add ( BankableMIDIInput< N > *  bankable)
private

Add a BankableMIDIInput to the bank.

This method is called in the BankableMIDIInput constructor.

Parameters
bankableThe BankableMIDIInput to be added.

Definition at line 150 of file Bank.hpp.

◆ remove()

template<setting_t N>
void Bank< N >::remove ( BankableMIDIInput< N > *  bankable)
private

Remove a BankableMIDIInput from the bank.

This method is called in the BankableMIDIInput destructor.

Parameters
bankableThe BankableMIDIInput to be removed.

Definition at line 155 of file Bank.hpp.

◆ validateSetting()

template<setting_t N>
static setting_t Selectable< N >::validateSetting ( setting_t  setting)
inlinestaticinherited

Definition at line 19 of file Selectable.hpp.

◆ getInitialSelection()

template<setting_t N>
setting_t Selectable< N >::getInitialSelection ( ) const
inlineinherited

Definition at line 33 of file Selectable.hpp.

◆ setInitialSelection()

template<setting_t N>
void Selectable< N >::setInitialSelection ( setting_t  initialSelection)
inlineinherited

Definition at line 35 of file Selectable.hpp.

◆ getSelection()

virtual setting_t OutputBank::getSelection ( ) const
inlinevirtualinherited

Get the current bank setting.

Reimplemented in Transposer< MINIMUM_SEMITONES, MAXIMUM_SEMITONES >.

Definition at line 49 of file Bank.hpp.

◆ getTracksPerBank()

uint8_t OutputBank::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 55 of file Bank.hpp.

◆ getOffset()

uint8_t OutputBank::getOffset ( ) const
inlineinherited

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

Definition at line 61 of file Bank.hpp.

Member Data Documentation

◆ inputBankables

template<setting_t N>
DoublyLinkedList<BankableMIDIInput<N> > Bank< N >::inputBankables
private

A linked list of all BankableMIDIInput elements that have been added to this bank, and that should be updated when the bank setting changes.

The list is updated automatically when BankableMIDIInput elements are created or destroyed.

Definition at line 138 of file Bank.hpp.

◆ initialSelection

template<setting_t N>
setting_t Selectable< N >::initialSelection
privateinherited

Definition at line 40 of file Selectable.hpp.

◆ tracksPerBank

uint8_t OutputBank::tracksPerBank
privateinherited

Definition at line 64 of file Bank.hpp.

◆ bankSetting

setting_t OutputBank::bankSetting
privateinherited

Definition at line 65 of file Bank.hpp.


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