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:
18 : AH::DotBarDisplayLEDs<NumLEDs>(leds) {}
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
42 : Parent(address), NoteCCKPLEDBarDriver<NumLEDs>(leds) {}
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
113 const AH::PinList<NumLEDs> &leds, MIDIAddress address)
114 : Parent(config, address), NoteCCKPLEDBarDriver<NumLEDs>(leds) {}
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 {
135 this->displayBar(0);
136 }
137
138 protected:
139 void onBankSettingChange() override {
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
DotBarDisplayLEDs(const PinList< N > &ledPins)
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,...
NoteCCKPValue< Type, BankSize > Parent
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.
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
bool handleUpdateImpl(typename Matcher::Result match)
BankableTwoByteMIDIMatcher< BankSize > Matcher
NoteCCKPValue(BankConfig< BankSize > config, MIDIAddress address)
uint8_t getValue() const override
Get the most recent MIDI value that was received for the active bank.
void reset() override
Reset all values to zero.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
virtual void begin()
Initialize the input element.
MatchingMIDIInputElement(const TwoByteMIDIMatcher &matcher)
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,...
MatchingMIDIInputElement< Type, Matcher > Parent
void begin() override
Initialize the input element.
TwoByteMIDIMatcher Matcher
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)
NoteCCKPLEDBar< MIDIMessageType::KeyPressure, BankSize, NumLEDs > KPLEDBar
Class that listens for Key Pressure events and displays the pressure on an LED Bar Graph,...
NoteCCKPLEDBar< MIDIMessageType::ControlChange, BankSize, NumLEDs > CCLEDBar
Class that listens for Control Change events and displays the value on an LED Bar Graph,...
NoteCCKPLEDBar< MIDIMessageType::NoteOn, BankSize, NumLEDs > NoteLEDBar
Class that listens for Note events and displays the velocity on an LED Bar Graph, turning on a differ...
NoteCCKPLEDBar< MIDIMessageType::ControlChange, NumLEDs > CCLEDBar
Class that listens for Control Change events and displays the value on an LED Bar Graph,...
NoteCCKPLEDBar< MIDIMessageType::NoteOn, NumLEDs > NoteLEDBar
Class that listens for Note events and displays the velocity on an LED Bar Graph, turning on a differ...
NoteCCKPLEDBar< MIDIMessageType::KeyPressure, NumLEDs > KPLEDBar
Class that listens for Key Pressure events and displays the pressure on an LED Bar Graph,...
PrintStream library
Definition Array.hpp:10
Array< pin_t, N > PinList
An easy alias for arrays of pins.
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
Matcher for MIDI messages with 2 data bytes, such as Note On/Off, Control Change, Key Pressure (but n...