MIDI Input Element that listens for MIDI Note messages in a given range, and displays their values using a FastLED LED strip. More...
#include <MIDI_Inputs/LEDs/FastLED.hpp>
Public Member Functions | |
NoteRangeFastLED (Array< CRGB, RangeLen > &leds, MIDIAddress address, const ColorMapper &colormapper={}) | |
Construct a new NoteRangeFastLED object. More... | |
NoteRangeFastLED (CRGB *leds, MIDIAddress address, const ColorMapper &colormapper={}) | |
Construct a new NoteRangeFastLED object. More... | |
void | setBrightness (uint8_t brightness) |
Set the maximum brightness of the LEDs. More... | |
uint8_t | getBrightness () const |
Get the maximum brightness of the LEDs. More... | |
void | setLEDIndexPermuter (index_permuter_f permuter) |
Change the mapping from the MIDI index to the LED index. 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 | |
NoteCCFastLEDCallback< DefaultColorMapper > | callback |
Callback that is called when a value in the active bank changes. More... | |
Protected Attributes | |
const MIDIAddress | address |
MIDIInputElementNote * | next |
MIDIInputElementNote * | previous |
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< MIDIInputElementNote > | elements |
MIDI Input Element that listens for MIDI Note messages in a given range, and displays their values using a FastLED LED strip.
This class doesn't actually write to the LEDs directly, it writes to a buffer of CRGB values that is sent to the LEDs by the FastLED library in the user code.
RangeLen | The length of the range of MIDI note numbers to listen for. |
DefaultColorMapper | The color mapper that defines how each MIDI value should be mapped to an RGB color for the LEDs. |
Definition at line 136 of file FastLED.hpp.
|
inline |
Construct a new NoteRangeFastLED object.
leds | A buffer of CRGB colors, used by the FastLED library. This class only writes to the buffer, it's the responsibility of the user to actually output this buffer to the LEDs in the main loop, using the FastLED library. |
address | The first address in the range. The entire range is defined by this address and the RangeLen template parameter. For example, if address = 10 and RangeLen = 4 , the this object will listen to addresses 10, 11, 12, 13. |
colormapper | Optional initialization for the color mapper. |
Definition at line 156 of file FastLED.hpp.
|
inline |
Construct a new NoteRangeFastLED object.
leds | A buffer of CRGB colors, used by the FastLED library. This class only writes to the buffer, it's the responsibility of the user to actually output this buffer to the LEDs in the main loop, using the FastLED library. |
address | The first address in the range. The entire range is defined by this address and the RangeLen template parameter. For example, if address = 10 and RangeLen = 4 , the this object will listen to addresses 10, 11, 12, 13. |
colormapper | Optional initialization for the color mapper. |
Definition at line 180 of file FastLED.hpp.
|
inline |
Set the maximum brightness of the LEDs.
brightness | The maximum brightness [0, 255] |
Definition at line 189 of file FastLED.hpp.
|
inline |
Get the maximum brightness of the LEDs.
Definition at line 193 of file FastLED.hpp.
|
inline |
Change the mapping from the MIDI index to the LED index.
The MIDI index is derived from the note or controller number.
The function should take the (zer-based) MIDI index value as a parameter, and return the corresponding LED index (zero-based). By default, the LED index is the same as the MIDI index.
Definition at line 195 of file FastLED.hpp.
|
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.
|
inlinefinaloverridevirtualinherited |
|
inherited |
Get the velocity or controller value for the given index in the range.
|
inlineinherited |
Get the velocity or controller value of the first or only note or controller.
Definition at line 82 of file NoteCCRange.hpp.
|
inlineinherited |
Get the velocity or controller value of the first or only note or controller.
Definition at line 24 of file NoteCCRange.hpp.
|
inlineoverridevirtualinherited |
|
inlineoverridevirtualinherited |
Reset all values to zero.
Reimplemented from MIDIInputElement.
Definition at line 87 of file NoteCCRange.hpp.
|
inlineoverrideprivatevirtualinherited |
Implements MIDIInputElement.
Definition at line 95 of file NoteCCRange.hpp.
|
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.
|
inlineprivatevirtualinherited |
Get the active bank selection.
Definition at line 125 of file NoteCCRange.hpp.
|
inlineprivatevirtualinherited |
Get the bank index from a MIDI address.
Definition at line 128 of file NoteCCRange.hpp.
|
inlineprivatevirtualinherited |
Get the index of the given MIDI address in the range.
Definition at line 135 of file NoteCCRange.hpp.
|
inlinestaticconstexprinherited |
Get the length of the range.
Definition at line 148 of file NoteCCRange.hpp.
|
inlineinherited |
Get the length of the range of note/CC addresses.
Definition at line 19 of file NoteCCRange.hpp.
|
inlinestaticinherited |
Initialize all MIDIInputElementNote elements.
Definition at line 49 of file MIDIInputElementNote.hpp.
|
inlinestaticinherited |
Update all MIDIInputElementNote elements.
Definition at line 60 of file MIDIInputElementNote.hpp.
|
inlinestaticinherited |
Reset all MIDIInputElementNote elements to their initial state.
Definition at line 71 of file MIDIInputElementNote.hpp.
|
inlinestaticinherited |
Update all MIDIInputElementNote elements with a new MIDI message.
Definition at line 84 of file MIDIInputElementNote.hpp.
|
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.
|
inlinevirtualinherited |
Update the value of the input element. Used for decaying VU meters etc.
Reimplemented in 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 36 of file MIDIInputElement.hpp.
|
inlineinherited |
Receive a new MIDI message and update the internal state.
Definition at line 39 of file MIDIInputElement.hpp.
|
inlineprivatevirtualinherited |
Extract the target address from a MIDI message.
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.
A 2D array for saving all values of the range, for all banks.
Definition at line 142 of file NoteCCRange.hpp.
|
inherited |
Callback that is called when a value in the active bank changes.
Definition at line 146 of file NoteCCRange.hpp.
|
staticprivateinherited |
Definition at line 107 of file MIDIInputElementNote.hpp.
|
protectedinherited |
Definition at line 83 of file MIDIInputElement.hpp.
|
protectedinherited |
Definition at line 323 of file LinkedList.hpp.
|
protectedinherited |
Definition at line 324 of file LinkedList.hpp.
|
privateinherited |
Definition at line 27 of file NoteCCRange.hpp.