Control Surface  1.2.0
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback > Class Template Reference

Base class for all other classes that listen for incoming MIDI Note or Control Change messages and saves their values. More...

#include <MIDI_Inputs/NoteCCRange.hpp>

+ Inheritance diagram for NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >:
+ Collaboration diagram for NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >:

Public Member Functions

 NoteCCRange (MIDIAddress address, const Callback &callback)
 
uint8_t getValue (uint8_t index) const final override
 
void begin () override
 Initialize. More...
 
void reset () override
 Reset all values to zero. More...
 
virtual uint8_t getValue (uint8_t index) const=0
 Get the velocity or controller value for the given index in the range. More...
 
uint8_t getValue () const
 Get the velocity or controller value of the first or only note or controller. More...
 
uint8_t length () const
 Get the length of the range of note/CC addresses. More...
 
uint8_t getValue () const
 Get the velocity or controller value of the first or only note or controller. More...
 

Static Public Member Functions

constexpr static uint8_t length ()
 Get the length of the range. More...
 

Public Attributes

Callback callback
 Callback that is called when a value in the active bank changes. More...
 

Private Member Functions

bool updateImpl (const ChannelMessageMatcher &midimsg, const MIDIAddress &target) override
 
virtual uint8_t getSelection () const
 Get the active bank selection. More...
 
virtual setting_t getBankIndex (MIDIAddress target) const
 Get the bank index from a MIDI address. More...
 
virtual uint8_t getRangeIndex (MIDIAddress target) const
 Get the index of the given MIDI address in the range. More...
 

Static Private Member Functions

static uint8_t getValueFromMIDIMessage (const ChannelMessageMatcher &midimsg)
 Extract the "value" from a MIDI Note or Control Change message. More...
 

Private Attributes

Array< Array< uint8_t, RangeLen >, NumBanks > values = {{}}
 A 2D array for saving all values of the range, for all banks. More...
 
uint8_t rangeLength
 

Detailed Description

template<class MIDIInput_t, uint8_t RangeLen, uint8_t NumBanks, class Callback>
class NoteCCRange< MIDIInput_t, RangeLen, NumBanks, Callback >

Base class for all other classes that listen for incoming MIDI Note or Control Change messages and saves their values.

Can listen to a range of addresses or a single address.

Definition at line 73 of file NoteCCRange.hpp.

Constructor & Destructor Documentation

◆ NoteCCRange()

NoteCCRange ( MIDIAddress  address,
const Callback &  callback 
)
inline

Definition at line 75 of file NoteCCRange.hpp.

Member Function Documentation

◆ getValue() [1/4]

uint8_t getValue ( uint8_t  index) const
inlinefinaloverridevirtual
Todo:
check index bounds

Implements INoteCCValue.

Definition at line 79 of file NoteCCRange.hpp.

◆ begin()

void begin ( )
inlineoverride

Initialize.

Definition at line 85 of file NoteCCRange.hpp.

◆ reset()

void reset ( )
inlineoverride

Reset all values to zero.

Definition at line 87 of file NoteCCRange.hpp.

◆ updateImpl()

bool updateImpl ( const ChannelMessageMatcher midimsg,
const MIDIAddress target 
)
inlineoverrideprivate

Definition at line 95 of file NoteCCRange.hpp.

◆ getValueFromMIDIMessage()

static uint8_t getValueFromMIDIMessage ( const ChannelMessageMatcher midimsg)
inlinestaticprivate

Extract the "value" from a MIDI Note or Control Change message.

For Note On and Control Change, this is simply the second data byte, for Note Off, it's zero.

Definition at line 120 of file NoteCCRange.hpp.

◆ getSelection()

virtual uint8_t getSelection ( ) const
inlineprivatevirtual

◆ getBankIndex()

virtual setting_t getBankIndex ( MIDIAddress  target) const
inlineprivatevirtual

◆ getRangeIndex()

virtual uint8_t getRangeIndex ( MIDIAddress  target) const
inlineprivatevirtual

◆ length() [1/2]

constexpr static uint8_t length ( )
inlinestaticconstexpr

Get the length of the range.

Definition at line 148 of file NoteCCRange.hpp.

◆ getValue() [2/4]

virtual uint8_t getValue

Get the velocity or controller value for the given index in the range.

◆ getValue() [3/4]

uint8_t getValue
inline

Get the velocity or controller value of the first or only note or controller.

Definition at line 24 of file NoteCCRange.hpp.

◆ length() [2/2]

uint8_t length ( ) const
inlineinherited

Get the length of the range of note/CC addresses.

Definition at line 19 of file NoteCCRange.hpp.

◆ getValue() [4/4]

uint8_t getValue ( ) const
inlineinherited

Get the velocity or controller value of the first or only note or controller.

Definition at line 24 of file NoteCCRange.hpp.

Member Data Documentation

◆ values

Array<Array<uint8_t, RangeLen>, NumBanks> values = {{}}
private

A 2D array for saving all values of the range, for all banks.

Definition at line 142 of file NoteCCRange.hpp.

◆ callback

Callback callback

Callback that is called when a value in the active bank changes.

Definition at line 146 of file NoteCCRange.hpp.

◆ rangeLength

uint8_t rangeLength
privateinherited

Definition at line 27 of file NoteCCRange.hpp.


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