Control Surface  1.1.1
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 <Banks/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, ManyAddressesPCButton.ino, MCU-OLED-SSD1306-MEGA.ino, MCU-OLED-SSD1306-x2.ino, MCU-OLED-SSD1306.ino, MIDI-Controller-Finished-Example.ino, MIDI_controller-97.ino, and One-Pot-Both-PB-and-CC.ino.

Definition at line 77 of file Bank.hpp.

Constructor & Destructor Documentation

◆ Bank()

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()

void 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()

constexpr static uint8_t getNumberOfBanks ( )
inlinestaticconstexpr

Get the number of Banks.

Definition at line 107 of file Bank.hpp.

◆ add()

void 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()

void 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()

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()

virtual setting_t 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 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 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

DoublyLinkedList<BankableMIDIInput<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

setting_t initialSelection
privateinherited

Definition at line 40 of file Selectable.hpp.

◆ tracksPerBank

uint8_t tracksPerBank
privateinherited

Definition at line 64 of file Bank.hpp.

◆ bankSetting

setting_t bankSetting
privateinherited

Definition at line 65 of file Bank.hpp.


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