Control Surface stm32
MIDI Control Surface library for Arduino
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.

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, and One-Pot-Both-PB-and-CC.ino.

Definition at line 91 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. More...
 
void select (setting_t bankSetting) override
 Select the given bank setting. More...
 
void add (BankSettingChangeCallback *bankable)
 Add a Bankable MIDI Input Element to the bank. More...
 
void remove (BankSettingChangeCallback *bankable)
 Remove a Bankable MIDI Input Element from the bank. More...
 
setting_t getInitialSelection () const
 
void setInitialSelection (setting_t initialSelection)
 
setting_t getSelection () const
 Get the current bank setting (zero-based). More...
 
int8_t getSelectionOffset () const
 Get the offset of the bank setting. More...
 
uint8_t getTracksPerBank () const
 Get the number of tracks per bank. More...
 
int8_t getOffsetOfSetting (setting_t s) const
 The same as getOffset, but for a given setting. More...
 
int8_t getOffset () const
 Get the address offset (number of banks times the index of the selected bank after applying the offset) More...
 

Static Public Member Functions

static constexpr uint8_t getNumberOfBanks ()
 Get the number of banks. More...
 
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. More...
 
setting_t initialSelection
 
uint8_t tracksPerBank
 
setting_t bankSetting
 
int8_t selectionOffset
 

Constructor & Destructor Documentation

◆ Bank()

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 104 of file Bank.hpp.

Member Function Documentation

◆ select()

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 >.

◆ getNumberOfBanks()

static constexpr uint8_t getNumberOfBanks ( )
inlinestaticconstexpr

Get the number of banks.

Definition at line 119 of file Bank.hpp.

◆ add()

void add ( BankSettingChangeCallback bankable)

Add a Bankable MIDI Input Element to the bank.

Parameters
bankableThe MIDI Input Element to be added.

◆ remove()

void remove ( BankSettingChangeCallback bankable)

Remove a Bankable MIDI Input Element from the bank.

Parameters
bankableThe MIDI Input Element to be removed.

◆ 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

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 139 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: