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 | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback > Class Template Reference

#include <NoteCCRange.hpp>

Inheritance diagram for Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >:
Collaboration diagram for Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >:

Public Member Functions

 GenericNoteCCRange (BankConfig< NumBanks > config, MIDICNChannelAddress address, const Callback &callback)
 
uint8_t getValue (uint8_t index) const override
 
virtual uint8_t getValue (uint8_t index) const=0
 
uint8_t getValue () const
 
uint8_t getValue () const
 
void begin () override
 Initialize. More...
 
void reset () override
 Reset all values to zero. More...
 
uint8_t length () const
 
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...
 

Static Public Member Functions

constexpr static uint8_t length ()
 

Public Attributes

Callback callback
 

Protected Member Functions

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

bool match (const MIDICNChannelAddress &target) const override
 Check if the address of the incoming MIDI message is within the range of addresses and in one of the banks of this element. More...
 
setting_t getSelection () const override
 Get the active bank selection. More...
 
uint8_t getBankIndex (MIDICNChannelAddress target) const override
 Get the bank index from a MIDI address. More...
 
uint8_t getRangeIndex (MIDICNChannelAddress target) const override
 
void onBankSettingChange () override
 A function to be executed each time the bank setting changes. More...
 
bool updateImpl (const ChannelMessageMatcher &midimsg, const MIDICNChannelAddress &target) override
 

Static Private Member Functions

static uint8_t getValueFromMIDIMessage (const ChannelMessageMatcher &midimsg)
 

Private Attributes

Array< Array< uint8_t, RangeLen >, NumBanks > values = {}
 
uint8_t rangeLength
 
Bank< N > & bank
 
const BankType type
 

Detailed Description

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback = NoteCCRangeEmptyCallback>
class Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >

Template Parameters
RangeLenThe length of the range.
NumBanksThe size of the bank.

Definition at line 164 of file NoteCCRange.hpp.

Constructor & Destructor Documentation

◆ GenericNoteCCRange()

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback = NoteCCRangeEmptyCallback>
Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::GenericNoteCCRange ( BankConfig< NumBanks >  config,
MIDICNChannelAddress  address,
const Callback &  callback 
)
inline

Definition at line 168 of file NoteCCRange.hpp.

Member Function Documentation

◆ match()

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback = NoteCCRangeEmptyCallback>
bool Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::match ( const MIDICNChannelAddress target) const
inlineoverrideprivate

Check if the address of the incoming MIDI message is within the range of addresses and in one of the banks of this element.

Definition at line 179 of file NoteCCRange.hpp.

◆ getSelection()

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback = NoteCCRangeEmptyCallback>
setting_t Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::getSelection ( ) const
inlineoverrideprivatevirtual

Get the active bank selection.

Reimplemented from NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >.

Definition at line 184 of file NoteCCRange.hpp.

◆ getBankIndex() [1/2]

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback = NoteCCRangeEmptyCallback>
uint8_t Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::getBankIndex ( MIDICNChannelAddress  target) const
inlineoverrideprivatevirtual

Get the bank index from a MIDI address.

Reimplemented from NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >.

Definition at line 188 of file NoteCCRange.hpp.

◆ getRangeIndex() [1/2]

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback = NoteCCRangeEmptyCallback>
uint8_t Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::getRangeIndex ( MIDICNChannelAddress  target) const
inlineoverrideprivatevirtual

Reimplemented from NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >.

Definition at line 192 of file NoteCCRange.hpp.

◆ onBankSettingChange()

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback = NoteCCRangeEmptyCallback>
void Bankable::GenericNoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::onBankSettingChange ( )
inlineoverrideprivatevirtual

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 from BankableMIDIInput< NumBanks >.

Definition at line 197 of file NoteCCRange.hpp.

◆ getValue() [1/4]

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
uint8_t NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::getValue ( uint8_t  index) const
inlineoverridevirtualinherited
Todo:
check index bounds

Implements INoteCCValue.

Definition at line 51 of file NoteCCRange.hpp.

◆ getValue() [2/4]

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
virtual uint8_t INoteCCValue::getValue
inherited

◆ getValue() [3/4]

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
uint8_t INoteCCValue::getValue
inlineinherited

Definition at line 16 of file NoteCCRange.hpp.

◆ getValue() [4/4]

uint8_t INoteCCValue::getValue ( ) const
inlineinherited

Definition at line 16 of file NoteCCRange.hpp.

◆ begin()

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
void NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::begin ( )
inlineoverrideinherited

Initialize.

Definition at line 57 of file NoteCCRange.hpp.

◆ reset()

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
void NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::reset ( )
inlineoverrideinherited

Reset all values to zero.

Definition at line 59 of file NoteCCRange.hpp.

◆ updateImpl()

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
bool NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::updateImpl ( const ChannelMessageMatcher midimsg,
const MIDICNChannelAddress target 
)
inlineoverrideprivateinherited

Definition at line 65 of file NoteCCRange.hpp.

◆ getValueFromMIDIMessage()

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
static uint8_t NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::getValueFromMIDIMessage ( const ChannelMessageMatcher midimsg)
inlinestaticprivateinherited

Definition at line 77 of file NoteCCRange.hpp.

◆ length() [1/2]

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
constexpr static uint8_t NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::length ( )
inlinestaticconstexprinherited

Definition at line 98 of file NoteCCRange.hpp.

◆ length() [2/2]

uint8_t INoteCCValue::length ( ) const
inlineinherited

Definition at line 14 of file NoteCCRange.hpp.

◆ getBankIndex() [2/2]

uint8_t BankableMIDIInput< N >::getBankIndex ( const MIDICNChannelAddress target,
const MIDICNChannelAddress base 
) const
inlineinherited

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]

bool BankableMIDIInput< N >::matchBankable ( uint8_t  toMatch,
uint8_t  base 
) const
inlineprotectedinherited

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.

◆ matchBankable() [2/2]

bool BankableMIDIInput< N >::matchBankable ( const MIDICNChannelAddress toMatch,
const MIDICNChannelAddress base 
) const
inlineprotectedinherited

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.

◆ matchBankableInRange()

bool BankableMIDIInput< N >::matchBankableInRange ( uint8_t  toMatch,
uint8_t  base,
uint8_t  length 
) const
inlineprotectedinherited

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() [2/2]

uint8_t BankableMIDIInput< N >::getRangeIndex ( MIDICNChannelAddress  target,
MIDICNChannelAddress  base 
) const
inlineprotectedinherited

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

Definition at line 143 of file BankableMIDIInput.hpp.

◆ inRange()

static bool BankableMIDIInput< N >::inRange ( uint8_t  toMatch,
uint8_t  base,
uint8_t  length 
)
inlinestaticprotectedinherited

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.

◆ matchBankableAddressInRange()

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

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.

Member Data Documentation

◆ values

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
Array<Array<uint8_t, RangeLen>, NumBanks> NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::values = {}
privateinherited

Definition at line 94 of file NoteCCRange.hpp.

◆ callback

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
Callback NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >::callback
inherited

Definition at line 97 of file NoteCCRange.hpp.

◆ rangeLength

uint8_t INoteCCValue::rangeLength
privateinherited

Definition at line 19 of file NoteCCRange.hpp.

◆ bank

Bank<N>& BankableMIDIInput< N >::bank
privateinherited

Definition at line 242 of file BankableMIDIInput.hpp.

◆ type

const BankType BankableMIDIInput< N >::type
privateinherited

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 file:
MIDI_Notes::F
constexpr int8_t F
Definition: Notes.hpp:23