Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
NoteCCKPLEDBar.hpp
Go to the documentation of this file.
4
6
14template <uint8_t NumLEDs>
16 public:
19
20 void displayBar(uint8_t value) { this->display(value / 128.0f); }
21};
22
23// -------------------------------------------------------------------------- //
24
29template <MIDIMessageType Type, uint8_t NumLEDs>
31 : public MatchingMIDIInputElement<Type, TwoByteMIDIMatcher>,
32 public NoteCCKPLEDBarDriver<NumLEDs> {
33 public:
36
43
44 protected:
45 void handleUpdate(typename Matcher::Result match) override {
46 this->displayBar(match.value);
47 }
48
49 public:
50 void begin() override {
52 this->displayBar(0);
53 }
54
55 void reset() override { this->displayBar(0); }
56};
57
58// -------------------------------------------------------------------------- //
59
67template <uint8_t NumLEDs>
69
77template <uint8_t NumLEDs>
79
87template <uint8_t NumLEDs>
89
90// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
91
92namespace Bankable {
93
99template <MIDIMessageType Type, uint8_t BankSize, uint8_t NumLEDs>
100class NoteCCKPLEDBar : public NoteCCKPValue<Type, BankSize>,
101 public NoteCCKPLEDBarDriver<NumLEDs> {
102 public:
104 using Matcher = typename Parent::Matcher;
105
115
116 protected:
117 void handleUpdate(typename Matcher::Result match) override {
118 bool newdirty = Parent::handleUpdateImpl(match);
119 if (newdirty)
121 this->dirty |= newdirty;
122 }
123
124 void updateDisplay() { this->displayBar(this->getValue()); }
125
126 public:
127 void begin() override {
130 this->displayBar(0);
131 }
132
133 void reset() override {
134 Parent::reset();
135 this->displayBar(0);
136 }
137
138 protected:
139 void onBankSettingChange() override {
140 Parent::onBankSettingChange();
142 }
143};
144
145// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
146
157template <uint8_t BankSize, uint8_t NumLEDs>
159
170template <uint8_t BankSize, uint8_t NumLEDs>
171using CCLEDBar =
173
184template <uint8_t BankSize, uint8_t NumLEDs>
185using KPLEDBar =
187
188} // namespace Bankable
189
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class for LED bars.
void display(uint16_t value) const
Display the given number of LEDs on the LED bar.
DotBarDisplayLEDs(const PinList< N > &ledPins)
Constructor from list of pins.
void begin() const
Initialize (set LED pins as outputs).
Definition LEDs.hpp:31
Class that turns on a different number of LEDs depending on the received MIDI velocity,...
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
void begin() override
Initialize the input element.
NoteCCKPLEDBar(BankConfig< BankSize > config, const AH::PinList< NumLEDs > &leds, MIDIAddress address)
void handleUpdate(typename Matcher::Result match) override
typename Parent::Matcher Matcher
void reset() override
Reset the input element to its initial state.
Generic base class for classes that listen for MIDI Note, Control Change and Key Pressure events on a...
uint8_t getValue() const override
Get the most recent MIDI value that was received for the active bank.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
The MIDIInputElement base class is very general: you give it a MIDI message, and it calls the updateW...
Callback class that drives a LED dot/bar display based on a note or control change value.
void displayBar(uint8_t value)
NoteCCKPLEDBarDriver(const AH::PinList< NumLEDs > &leds)
Class that turns on a different number of LEDs depending on the received MIDI velocity,...
void begin() override
Initialize the input element.
void handleUpdate(typename Matcher::Result match) override
void reset() override
Reset the input element to its initial state.
NoteCCKPLEDBar(const AH::PinList< NumLEDs > &leds, MIDIAddress address)
PrintStream library
Definition Array.hpp:10
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
An array wrapper for easy copying, comparing, and iterating.
Definition Array.hpp:32
T * begin()
Get a pointer to the first element.
Definition Array.hpp:74
Matcher for MIDI messages with 2 data bytes, such as Note On/Off, Control Change, Key Pressure (but n...