Control Surface  1.2.0
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
NoteValueLED Class Reference

MIDI Input Element that listens for MIDI Note messages for the given note, and displays its value by turning on/off an LED depending on whether the MIDI note velocity is above or below a certain threshold. More...

#include <MIDI_Inputs/LEDs/NoteCCRangeLEDs.hpp>

+ Inheritance diagram for NoteValueLED:
+ Collaboration diagram for NoteValueLED:

Public Member Functions

 NoteValueLED (pin_t ledPin, MIDIAddress address)
 Construct a new NoteValueLED object. More...
 
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...
 
virtual void update ()
 Update the value of the input element. Used for decaying VU meters etc. More...
 
bool updateWith (const ChannelMessageMatcher &midimsg)
 Receive a new MIDI message and update the internal state. More...
 

Static Public Member Functions

constexpr static uint8_t length ()
 Get the length of the range. More...
 
static void beginAll ()
 Initialize all MIDIInputElementNote elements. More...
 
static void updateAll ()
 Update all MIDIInputElementNote elements. More...
 
static void resetAll ()
 Reset all MIDIInputElementNote elements to their initial state. More...
 
static void updateAllWith (const ChannelMessageMatcher &midimsg)
 Update all MIDIInputElementNote elements with a new MIDI message. More...
 

Public Attributes

NoteCCLED< 1 > callback
 Callback that is called when a value in the active bank changes. More...
 

Protected Attributes

const MIDIAddress address
 
MIDIInputElementNotenext
 
MIDIInputElementNoteprevious
 

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...
 
void moveDown ()
 Move down this element in the linked list of elements. More...
 
virtual MIDIAddress getTarget (const ChannelMessageMatcher &midimsg) const
 Extract the target address from a MIDI message. 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
 

Static Private Attributes

static DoublyLinkedList< MIDIInputElementNoteelements
 

Detailed Description

MIDI Input Element that listens for MIDI Note messages for the given note, and displays its value by turning on/off an LED depending on whether the MIDI note velocity is above or below a certain threshold.

Examples
1.Note-LED.ino, 2.First-Input.ino, 6.MAX7219-NoteLED.ino, AppleMIDI.ino, Debug-MIDI-Interface.ino, Dual-MIDI-Interface.ino, and Serial-Interface.ino.

Definition at line 113 of file NoteCCRangeLEDs.hpp.

Constructor & Destructor Documentation

◆ NoteValueLED()

NoteValueLED ( pin_t  ledPin,
MIDIAddress  address 
)
inline

Construct a new NoteValueLED object.

Parameters
ledPinThe pin number with the LED connected.
addressThe MIDI address to listen to.

Definition at line 124 of file NoteCCRangeLEDs.hpp.

Member Function Documentation

◆ match()

bool match ( const MIDIAddress target) const
inlineoverrideprivatevirtualinherited

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

Reimplemented from MIDIInputElement.

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
inlineoverridevirtualinherited

Initialize.

Reimplemented from MIDIInputElement.

Definition at line 85 of file NoteCCRange.hpp.

◆ reset()

void reset
inlineoverridevirtualinherited

Reset all values to zero.

Reimplemented from MIDIInputElement.

Definition at line 87 of file NoteCCRange.hpp.

◆ updateImpl()

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

Implements MIDIInputElement.

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

◆ beginAll()

static void beginAll ( )
inlinestaticinherited

Initialize all MIDIInputElementNote elements.

See also
MIDIInputElementNote::begin

Definition at line 49 of file MIDIInputElementNote.hpp.

◆ updateAll()

static void updateAll ( )
inlinestaticinherited

Update all MIDIInputElementNote elements.

See also
MIDIInputElementNote::update

Definition at line 60 of file MIDIInputElementNote.hpp.

◆ resetAll()

static void resetAll ( )
inlinestaticinherited

Reset all MIDIInputElementNote elements to their initial state.

See also
MIDIInputElementNote::reset

Definition at line 71 of file MIDIInputElementNote.hpp.

◆ updateAllWith()

static void updateAllWith ( const ChannelMessageMatcher midimsg)
inlinestaticinherited

Update all MIDIInputElementNote elements with a new MIDI message.

See also
MIDIInputElementNote::updateWith

Definition at line 84 of file MIDIInputElementNote.hpp.

◆ moveDown()

void moveDown ( )
inlineprivateinherited

Move down this element in the linked list of elements.

This means that the element will be checked earlier on the next iteration.

Definition at line 102 of file MIDIInputElementNote.hpp.

◆ update()

virtual void update ( )
inlinevirtualinherited

◆ updateWith()

bool updateWith ( const ChannelMessageMatcher midimsg)
inlineinherited

Receive a new MIDI message and update the internal state.

Definition at line 39 of file MIDIInputElement.hpp.

◆ getTarget()

virtual MIDIAddress getTarget ( const ChannelMessageMatcher midimsg) const
inlineprivatevirtualinherited

Extract the target address from a MIDI message.

Note
This base version of the function is only valid for messages that use data1 as an address (i.e. Note On, Note Off, Polyphonic Key Pressure and Control Change), because it assumes that the target address consists of the address (data 1), the MIDI channel and the cable number.

Reimplemented in MIDIInputElementPC, MIDIInputElementChannelPressure, VU_Base< NumValues, Callback >, VU_Base< NumBanks, VULEDsCallback< NumLEDs > >, VU_Base< NumBanks, VUEmptyCallback >, VU_Base< 1, VUEmptyCallback >, and VU_Base< 1, VULEDsCallback< NumLEDs > >.

Definition at line 63 of file MIDIInputElement.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

NoteCCLED< 1 > callback
inherited

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

Definition at line 146 of file NoteCCRange.hpp.

◆ elements

DoublyLinkedList< MIDIInputElementNote > elements
staticprivateinherited

Definition at line 107 of file MIDIInputElementNote.hpp.

◆ address

const MIDIAddress address
protectedinherited

Definition at line 83 of file MIDIInputElement.hpp.

◆ next

MIDIInputElementNote * next
protectedinherited

Definition at line 323 of file LinkedList.hpp.

◆ previous

MIDIInputElementNote * previous
protectedinherited

Definition at line 324 of file LinkedList.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: