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
GenericNoteCCRange< MIDIInput_t, RangeLen, Callback > Class Template Reference

#include <MIDI_Inputs/NoteCCRange.hpp>

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

Public Member Functions

 GenericNoteCCRange (MIDIAddress address, const Callback &callback)
 
uint8_t getValue (uint8_t index) const final override
 
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 getValue () const
 Get the velocity or controller value of the first or only note or controller. More...
 
void begin () override
 Initialize. More...
 
void reset () override
 Reset all values to zero. More...
 
uint8_t length () const
 Get the length of the range of note/CC addresses. More...
 

Static Public Member Functions

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

Public Attributes

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

Private Member Functions

bool match (const MIDIAddress &target) const override
 Check if the address of the incoming MIDI message is within the range of addresses of this element. More...
 
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, class Callback = NoteCCRangeEmptyCallback>
class GenericNoteCCRange< MIDIInput_t, RangeLen, Callback >

Examples
Custom-Note-LED-Input-Element-Callback-FastLED.ino, Custom-Note-LED-Input-Element-Callback.ino, and MIDI-Note-Callback-IR.ino.

Definition at line 155 of file NoteCCRange.hpp.

Constructor & Destructor Documentation

◆ GenericNoteCCRange()

GenericNoteCCRange ( MIDIAddress  address,
const Callback &  callback 
)
inline

Definition at line 158 of file NoteCCRange.hpp.

Member Function Documentation

◆ match()

bool match ( const MIDIAddress target) const
inlineoverrideprivate

Check if the address of the incoming MIDI message is within the range of addresses of this element.

Definition at line 164 of file NoteCCRange.hpp.

◆ getValue() [1/4]

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

Implements INoteCCValue.

Definition at line 79 of file NoteCCRange.hpp.

◆ getValue() [2/4]

virtual uint8_t getValue
inherited

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

◆ getValue() [3/4]

uint8_t getValue
inlineinherited

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

Definition at line 82 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.

◆ begin()

void begin ( )
inlineoverrideinherited

Initialize.

Definition at line 85 of file NoteCCRange.hpp.

◆ reset()

void reset ( )
inlineoverrideinherited

Reset all values to zero.

Definition at line 87 of file NoteCCRange.hpp.

◆ updateImpl()

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

Definition at line 95 of file NoteCCRange.hpp.

◆ getValueFromMIDIMessage()

static uint8_t getValueFromMIDIMessage ( const ChannelMessageMatcher midimsg)
inlinestaticprivateinherited

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
inlineprivatevirtualinherited

Get the active bank selection.

Definition at line 125 of file NoteCCRange.hpp.

◆ getBankIndex()

virtual setting_t getBankIndex ( MIDIAddress  target) const
inlineprivatevirtualinherited

Get the bank index from a MIDI address.

Definition at line 128 of file NoteCCRange.hpp.

◆ getRangeIndex()

virtual uint8_t getRangeIndex ( MIDIAddress  target) const
inlineprivatevirtualinherited

Get the index of the given MIDI address in the range.

Definition at line 135 of file NoteCCRange.hpp.

◆ length() [1/2]

constexpr static uint8_t length ( )
inlinestaticconstexprinherited

Get the length of the range.

Definition at line 148 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.

Member Data Documentation

◆ values

Array<Array<uint8_t, RangeLen>, NumBanks> values
privateinherited

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

Definition at line 142 of file NoteCCRange.hpp.

◆ callback

NoteCCRangeEmptyCallback callback
inherited

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: