Control Surface stm32
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Transposer< MinTransposition, MaxTransposition > Class Template Reference

#include <Banks/Transposer.hpp>

Detailed Description

template<int8_t MinTransposition, int8_t MaxTransposition>
class Transposer< MinTransposition, MaxTransposition >

Class for transposing the address of NoteButton and other MIDI elements.

Examples
Transpose-Octave-NC-Button.ino, and Transposer.ino.

Definition at line 11 of file Transposer.hpp.

+ Inheritance diagram for Transposer< MinTransposition, MaxTransposition >:
+ Collaboration diagram for Transposer< MinTransposition, MaxTransposition >:

Public Member Functions

 Transposer (int8_t step=1)
 
void setTransposition (int8_t tp)
 Set the transposition. More...
 
int8_t getTransposition () const
 Get the transposition. More...
 
int8_t getTranspositionSemitones () const
 Get the transposition as a number of semitones. 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)
 

Static Public Attributes

static constexpr setting_t N = MaxTransposition - MinTransposition + 1
 
static constexpr setting_t NumBanks = N
 

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

◆ Transposer()

Transposer ( int8_t  step = 1)
inline

Definition at line 13 of file Transposer.hpp.

Member Function Documentation

◆ setTransposition()

void setTransposition ( int8_t  tp)
inline

Set the transposition.

Parameters
tpThe new transposition in the range [ MinTransposition, MaxTransposition ].
Note
The Bank::select() method expects a zero-based argument, which is cumbersome if the minimum transposition is nonzero.

Definition at line 27 of file Transposer.hpp.

◆ getTransposition()

int8_t getTransposition ( ) const
inline

Get the transposition.

Definition at line 30 of file Transposer.hpp.

◆ getTranspositionSemitones()

int8_t getTranspositionSemitones ( ) const
inline

Get the transposition as a number of semitones.

Definition at line 35 of file Transposer.hpp.

◆ select()

void select ( setting_t  bankSetting)
overridevirtualinherited

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

Get the number of banks.

Examples
Transposer.ino.

Definition at line 119 of file Bank.hpp.

◆ add()

void add ( BankSettingChangeCallback bankable)
inherited

Add a Bankable MIDI Input Element to the bank.

Parameters
bankableThe MIDI Input Element to be added.

◆ remove()

void remove ( BankSettingChangeCallback bankable)
inherited

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

◆ N

constexpr setting_t N = MaxTransposition - MinTransposition + 1
staticconstexpr

Definition at line 37 of file Transposer.hpp.

◆ NumBanks

constexpr setting_t NumBanks = N
staticconstexpr

Definition at line 38 of file Transposer.hpp.

◆ inputBankables

DoublyLinkedList<BankSettingChangeCallback> inputBankables
privateinherited

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: