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

A base class for all MIDIInputElements that can be banked. More...

#include <Bank.hpp>

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

Public Member Functions

virtual ~BankableMIDIInput ()
 Destructor: remove element from the bank. More...
 
setting_t getSelection () const
 Get the current bank setting. More...
 
uint8_t getBankIndex (const MIDICNChannelAddress &target, const MIDICNChannelAddress &base) const
 Calculate the bank setting of a given MIDI address, relative to a base address. More...
 

Protected Member Functions

 BankableMIDIInput (Bank< N > &bank, BankType type)
 Create a new BankableMIDIInput object, and add it to the bank. More...
 
 BankableMIDIInput (const BankConfig< N > &config)
 Create a new BankableMIDIInput object, and add it to the bank. More...
 
bool matchBankable (uint8_t toMatch, uint8_t base) const
 Check if the given address is part of the bank relative to the base address. More...
 
bool matchBankableInRange (uint8_t toMatch, uint8_t base, uint8_t length) const
 Check if the given address is part of the bank relative to the base address. More...
 
uint8_t getRangeIndex (MIDICNChannelAddress target, MIDICNChannelAddress base) const
 If matchBankableAddressInRange returned true, get the index of the message in the range. More...
 
bool matchBankable (const MIDICNChannelAddress &toMatch, const MIDICNChannelAddress &base) const
 Check whether a given address is part of the bank relative to the base address. More...
 
bool matchBankableAddressInRange (const MIDICNChannelAddress &toMatch, const MIDICNChannelAddress &base, uint8_t length) const
 Check whether a given address is part of the bank relative to the base address and within a range with a given length. More...
 

Static Protected Member Functions

static bool inRange (uint8_t toMatch, uint8_t base, uint8_t length)
 Check whether a given address is within a range of given length starting from the given base address. More...
 

Protected Attributes

BankableMIDIInput< N > * next
 
BankableMIDIInput< N > * previous
 

Private Member Functions

virtual void onBankSettingChange ()
 A function to be executed each time the bank setting changes. More...
 

Private Attributes

Bank< N > & bank
 
const BankType type
 

Detailed Description

template<setting_t N>
class BankableMIDIInput< N >

A base class for all MIDIInputElements that can be banked.

Note
These elements must be updated when the bank setting is changed, so they are added to a linked list of the bank.
Template Parameters
NThe number of banks.

Definition at line 13 of file Bank.hpp.

Constructor & Destructor Documentation

◆ BankableMIDIInput() [1/2]

template<setting_t N>
BankableMIDIInput< N >::BankableMIDIInput ( Bank< N > &  bank,
BankType  type 
)
inlineprotected

Create a new BankableMIDIInput object, and add it to the bank.

Parameters
bankThe bank to add this element to.
typeWhat address type to change (address, channel or cable number).

Definition at line 33 of file BankableMIDIInput.hpp.

◆ BankableMIDIInput() [2/2]

template<setting_t N>
BankableMIDIInput< N >::BankableMIDIInput ( const BankConfig< N > &  config)
inlineprotected

Create a new BankableMIDIInput object, and add it to the bank.

Parameters
configThe bank and address type to change.
See also
BankableMIDIInput::BankableMIDIInput(Bank<N> &, BankType)

Definition at line 45 of file BankableMIDIInput.hpp.

◆ ~BankableMIDIInput()

template<setting_t N>
virtual BankableMIDIInput< N >::~BankableMIDIInput ( )
inlinevirtual

Destructor: remove element from the bank.

Definition at line 52 of file BankableMIDIInput.hpp.

Member Function Documentation

◆ getSelection()

template<setting_t N>
setting_t BankableMIDIInput< N >::getSelection ( ) const
inline

Get the current bank setting.

See also
Bank<N>::getSelection()

Definition at line 59 of file BankableMIDIInput.hpp.

◆ getBankIndex()

template<setting_t N>
uint8_t BankableMIDIInput< N >::getBankIndex ( const MIDICNChannelAddress target,
const MIDICNChannelAddress base 
) const
inline

Calculate the bank setting of a given MIDI address, relative to a base address.

Parameters
targetThe MIDI address to calculate the bank setting of.
baseThe base address to compare it to (the address of bank setting 0).

Definition at line 71 of file BankableMIDIInput.hpp.

◆ matchBankable() [1/2]

template<setting_t N>
bool BankableMIDIInput< N >::matchBankable ( uint8_t  toMatch,
uint8_t  base 
) const
inlineprotected

Check if the given address is part of the bank relative to the base address.

Consider the following example:
A Bank with 4 tracks per bank (T), 2 bank settings (N), and a base address of 3.

0 1 2 3 4 5 6 7 8 9 10 11 12 ...
F F F T F F F T F F F F F ...

Addresses before the base adddress are not matched (0, 1, 2).
Addresses after N * T are not matched (8, 9, 10, 11, 12).
Addresses with a distance to the base address that is not a multiple of N are not matched (4, 5, 6).

Parameters
toMatchThe address to check.
baseThe base address (the address of bank setting 0).
Note
Equivalent to matchBankableInRange(toMatch, base, 1).

Definition at line 113 of file BankableMIDIInput.hpp.

◆ matchBankableInRange()

template<setting_t N>
bool BankableMIDIInput< N >::matchBankableInRange ( uint8_t  toMatch,
uint8_t  base,
uint8_t  length 
) const
inlineprotected

Check if the given address is part of the bank relative to the base address.

Todo:
This is very hard to explain without a specific example ...
Parameters
toMatchThe address to check.
baseThe base address (the address of bank setting 0).
lengthThe length of the range.

Definition at line 132 of file BankableMIDIInput.hpp.

◆ getRangeIndex()

template<setting_t N>
uint8_t BankableMIDIInput< N >::getRangeIndex ( MIDICNChannelAddress  target,
MIDICNChannelAddress  base 
) const
inlineprotected

If matchBankableAddressInRange returned true, get the index of the message in the range.

Definition at line 143 of file BankableMIDIInput.hpp.

◆ inRange()

template<setting_t N>
static bool BankableMIDIInput< N >::inRange ( uint8_t  toMatch,
uint8_t  base,
uint8_t  length 
)
inlinestaticprotected

Check whether a given address is within a range of given length starting from the given base address.

Parameters
toMatchThe address to check
baseThe base address, start of the range.
lengthThe length of the range.

Definition at line 162 of file BankableMIDIInput.hpp.

◆ matchBankable() [2/2]

template<setting_t N>
bool BankableMIDIInput< N >::matchBankable ( const MIDICNChannelAddress toMatch,
const MIDICNChannelAddress base 
) const
inlineprotected

Check whether a given address is part of the bank relative to the base address.

Parameters
toMatchThe address to check.
baseThe base address (the address of bank setting 0).

Definition at line 175 of file BankableMIDIInput.hpp.

◆ matchBankableAddressInRange()

template<setting_t N>
bool BankableMIDIInput< N >::matchBankableAddressInRange ( const MIDICNChannelAddress toMatch,
const MIDICNChannelAddress base,
uint8_t  length 
) const
inlineprotected

Check whether a given address is part of the bank relative to the base address and within a range with a given length.

Parameters
toMatchThe address to check.
baseThe base address (the address of bank setting 0).
lengthThe length of the range.

Definition at line 212 of file BankableMIDIInput.hpp.

◆ onBankSettingChange()

template<setting_t N>
virtual void BankableMIDIInput< N >::onBankSettingChange ( )
inlineprivatevirtual

A function to be executed each time the bank setting changes.

Think of an LED that indicates whether a track is muted or not. If this LED is bankable, let's say with 4 tracks per bank, 2 banks, and a base address of 3, then this LED object keeps the state of tracks 3 and 7. When the bank setting is 0, the LED displays the state of track 3, when the bank setting is 1, the LED displays the state of track 7.
To know when to update the LED, this callback is used.

Reimplemented in MCU::Bankable::GenericVU< NumBanks, Callback >, MCU::Bankable::GenericVU< NumBanks >, MCU::Bankable::GenericVU< NumBanks, VULEDsCallback< NumLEDs > >, MCU::Bankable::GenericVPotRing< NumBanks, Callback >, MCU::Bankable::GenericVPotRing< NumBanks >, MCU::Bankable::GenericVPotRing< NumBanks, VPotRingLEDsCallback >, Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >, Bankable::GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCFastLED< ColorMapper > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, 1, NumBanks >, Bankable::GenericNoteCCRange< MIDIInputElementNote, RangeLen, BankSize, NoteCCFastLED< ColorMapper > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, RangeLen, BankSize, NoteCCFastLED< ColorMapper > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCLED< 1 > >, Bankable::GenericNoteCCRange< MIDIInputElementNote, RangeLen, BankSize, NoteCCLED< RangeLen > >, Bankable::GenericNoteCCRange< MIDIInputElementNote, RangeLen, NumBanks >, Bankable::GenericNoteCCRange< MIDIInputElementNote, 1, NumBanks >, Bankable::GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCLEDBarCallback< NumLEDs > >, Bankable::GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCLED< 1 > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCFastLED< ColorMapper > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCLEDBarCallback< NumLEDs > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, RangeLen, BankSize, NoteCCLED< RangeLen > >, and Bankable::GenericNoteCCRange< MIDIInputElementCC, RangeLen, NumBanks >.

Definition at line 255 of file BankableMIDIInput.hpp.

Member Data Documentation

◆ bank

template<setting_t N>
Bank<N>& BankableMIDIInput< N >::bank
private

Definition at line 242 of file BankableMIDIInput.hpp.

◆ type

template<setting_t N>
const BankType BankableMIDIInput< N >::type
private

Definition at line 243 of file BankableMIDIInput.hpp.

◆ next

BankableMIDIInput< N > * DoublyLinkable< BankableMIDIInput< N > >::next
protectedinherited

Definition at line 301 of file LinkedList.hpp.

◆ previous

BankableMIDIInput< N > * DoublyLinkable< BankableMIDIInput< N > >::previous
protectedinherited

Definition at line 302 of file LinkedList.hpp.


The documentation for this class was generated from the following files:
MIDI_Notes::F
constexpr int8_t F
Definition: Notes.hpp:23