Control Surface  1.1.1
MIDI Control Surface library for Arduino
NoteCCRangeLEDBar.hpp
Go to the documentation of this file.
4 
6 
14 template <uint8_t NumLEDs>
16  public:
18  : leds(leds) {}
19 
20  void begin(const INoteCCValue &t) override {
21  leds.begin();
22  updateAll(t);
23  }
24 
25  void update(const INoteCCValue &t, uint8_t) override {
26  uint8_t value = t.getValue();
27  leds.display(value / 127.0f);
28  }
29 
31  void dotMode() { leds.dotMode(); }
33  void barMode() { leds.barMode(); }
35  void setMode(AH::DotBarMode mode) { leds.setMode(mode); }
36 
37  private:
39 };
40 
41 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
42 
51 template <uint8_t NumLEDs>
52 class NoteLEDBar : public GenericNoteCCRange<MIDIInputElementNote, 1,
53  NoteCCLEDBarCallback<NumLEDs>> {
54  public:
58  NoteCCLEDBarCallback<NumLEDs>>{
59  address,
60  {leds},
61  } {}
62 
64  void dotMode() { this->callback.dotMode(); }
66  void barMode() { this->callback.barMode(); }
68  void setMode(AH::DotBarMode mode) { this->callback.setMode(mode); }
69 };
70 
71 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
72 
81 template <uint8_t NumLEDs>
82 class CCLEDBar : public GenericNoteCCRange<MIDIInputElementCC, 1,
83  NoteCCLEDBarCallback<NumLEDs>> {
84  public:
88  NoteCCLEDBarCallback<NumLEDs>>{
89  address,
90  {leds},
91  } {}
92 
94  void dotMode() { this->callback.dotMode(); }
96  void barMode() { this->callback.barMode(); }
98  void setMode(AH::DotBarMode mode) { this->callback.setMode(mode); }
99 };
100 
101 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
102 
103 namespace Bankable {
104 
105 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
106 
117 template <uint8_t BankSize, uint8_t NumLEDs>
118 class NoteLEDBar : public GenericNoteCCRange<MIDIInputElementNote, 1, BankSize,
119  NoteCCLEDBarCallback<NumLEDs>> {
120  public:
122  const AH::DotBarDisplayLEDs<NumLEDs> &leds,
125  NoteCCLEDBarCallback<NumLEDs>>{
126  config,
127  address,
128  {leds},
129  } {}
130 
132  void dotMode() { this->callback.dotMode(); }
134  void barMode() { this->callback.barMode(); }
136  void setMode(AH::DotBarMode mode) { this->callback.setMode(mode); }
137 };
138 
139 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
140 
151 template <uint8_t BankSize, uint8_t NumLEDs>
152 class CCLEDBar : public GenericNoteCCRange<MIDIInputElementCC, 1, BankSize,
153  NoteCCLEDBarCallback<NumLEDs>> {
154  public:
156  const AH::DotBarDisplayLEDs<NumLEDs> &leds,
158  : GenericNoteCCRange<MIDIInputElementCC, 1, BankSize,
159  NoteCCLEDBarCallback<NumLEDs>>{
160  config,
161  address,
162  {leds},
163  } {}
164 
166  void dotMode() { this->callback.dotMode(); }
168  void barMode() { this->callback.barMode(); }
170  void setMode(AH::DotBarMode mode) { this->callback.setMode(mode); }
171 };
172 
173 } // namespace Bankable
174 
MIDIInputElement::address
const MIDICNChannelAddress address
Definition: MIDIInputElement.hpp:80
NoteCCLEDBarCallback
Callback class that drives a LED dot/bar display based on a note or control change value.
Definition: NoteCCRangeLEDBar.hpp:15
AH::DotBarDisplayLEDs::display
void display(uint8_t value) const
Display the given number of LEDs on the LED bar.
Definition: DotBarDisplayLEDs.hpp:40
CCLEDBar
Class that listens for Control Change events and displays the velocity on an LED Bar Graph.
Definition: NoteCCRangeLEDBar.hpp:82
MIDIInputElementNote
Class for objects that listen for incoming MIDI Note events.
Definition: MIDIInputElementNote.hpp:20
Bankable::CCLEDBar::dotMode
void dotMode()
Set the mode to dot mode.
Definition: NoteCCRangeLEDBar.hpp:166
Bankable
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
Definition: BankAddresses.hpp:7
NoteCCLEDBarCallback::setMode
void setMode(AH::DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: NoteCCRangeLEDBar.hpp:35
SimpleNoteCCValueCallback::updateAll
virtual void updateAll(const INoteCCValue &noteccval)
Update all values: called when a bank change causes all values to (possibly) change,...
Definition: NoteCCRange.hpp:58
AH::LEDs::begin
void begin() const
Initialize (set LED pins as outputs).
Definition: LEDs.hpp:34
GenericNoteCCRange
Definition: NoteCCRange.hpp:155
INoteCCValue
Interface for NoteCCValue objects: provides getters for the velocity or controller values.
Definition: NoteCCRange.hpp:13
SimpleNoteCCValueCallback
A callback for NoteCCRange with an action that can be implemented by the user.
Definition: NoteCCRange.hpp:46
AH::DotBarDisplayLEDs::barMode
void barMode()
Set the mode to bar mode.
Definition: DotBarDisplayLEDs.hpp:72
Bankable::GenericNoteCCRange
Definition: NoteCCRange.hpp:247
ExtendedInputOutput.hpp
NoteCCLEDBarCallback::dotMode
void dotMode()
Set the mode to dot mode.
Definition: NoteCCRangeLEDBar.hpp:31
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
MIDIInputElementCC
Class for objects that listen for incoming MIDI Controller Change events.
Definition: MIDIInputElementCC.hpp:23
NoteCCLEDBarCallback::NoteCCLEDBarCallback
NoteCCLEDBarCallback(const AH::DotBarDisplayLEDs< NumLEDs > &leds)
Definition: NoteCCRangeLEDBar.hpp:17
Bankable::NoteLEDBar::setMode
void setMode(AH::DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: NoteCCRangeLEDBar.hpp:136
Bankable::NoteLEDBar::barMode
void barMode()
Set the mode to bar mode.
Definition: NoteCCRangeLEDBar.hpp:134
AH::DotBarDisplayLEDs::setMode
void setMode(DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: DotBarDisplayLEDs.hpp:66
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
AH::DotBarMode
DotBarMode
An enumeration type to set an LED display to either bar or dot mode.
Definition: DotBarDisplayLEDs.hpp:15
NoteCCRange< MIDIInputElementNote, RangeLen, 1, NoteCCLEDBarCallback< NumLEDs > >::callback
NoteCCLEDBarCallback< NumLEDs > callback
Callback that is called when a value in the active bank changes.
Definition: NoteCCRange.hpp:146
Bankable::NoteLEDBar
Class that listens for Note events and displays the velocity on an LED Bar Graph.
Definition: NoteCCRangeLEDBar.hpp:118
CCLEDBar::setMode
void setMode(AH::DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: NoteCCRangeLEDBar.hpp:98
NoteLEDBar::dotMode
void dotMode()
Set the mode to dot mode.
Definition: NoteCCRangeLEDBar.hpp:64
CCLEDBar::dotMode
void dotMode()
Set the mode to dot mode.
Definition: NoteCCRangeLEDBar.hpp:94
MIDICNChannelAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition: MIDICNChannelAddress.hpp:82
Bankable::NoteLEDBar::dotMode
void dotMode()
Set the mode to dot mode.
Definition: NoteCCRangeLEDBar.hpp:132
Bankable::CCLEDBar
Class that listens for Control Change events and displays the velocity on an LED Bar Graph.
Definition: NoteCCRangeLEDBar.hpp:152
NoteLEDBar::barMode
void barMode()
Set the mode to bar mode.
Definition: NoteCCRangeLEDBar.hpp:66
CCLEDBar::CCLEDBar
CCLEDBar(const AH::DotBarDisplayLEDs< NumLEDs > &leds, MIDICNChannelAddress address)
Definition: NoteCCRangeLEDBar.hpp:85
NoteCCLEDBarCallback::leds
AH::DotBarDisplayLEDs< NumLEDs > leds
Definition: NoteCCRangeLEDBar.hpp:38
Bankable::NoteLEDBar::NoteLEDBar
NoteLEDBar(const BankConfig< BankSize > &config, const AH::DotBarDisplayLEDs< NumLEDs > &leds, const MIDICNChannelAddress &address)
Definition: NoteCCRangeLEDBar.hpp:121
NoteCCLEDBarCallback::barMode
void barMode()
Set the mode to bar mode.
Definition: NoteCCRangeLEDBar.hpp:33
NoteCCLEDBarCallback::begin
void begin(const INoteCCValue &t) override
Initialize: called once.
Definition: NoteCCRangeLEDBar.hpp:20
NoteLEDBar::setMode
void setMode(AH::DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: NoteCCRangeLEDBar.hpp:68
NoteLEDBar::NoteLEDBar
NoteLEDBar(const AH::DotBarDisplayLEDs< NumLEDs > &leds, MIDICNChannelAddress address)
Definition: NoteCCRangeLEDBar.hpp:55
INoteCCValue::getValue
virtual uint8_t getValue(uint8_t index) const =0
Get the velocity or controller value for the given index in the range.
DotBarDisplayLEDs.hpp
Bankable::CCLEDBar::barMode
void barMode()
Set the mode to bar mode.
Definition: NoteCCRangeLEDBar.hpp:168
AH::DotBarDisplayLEDs::dotMode
void dotMode()
Set the mode to dot mode.
Definition: DotBarDisplayLEDs.hpp:69
Bankable::CCLEDBar::CCLEDBar
CCLEDBar(const BankConfig< BankSize > &config, const AH::DotBarDisplayLEDs< NumLEDs > &leds, const MIDICNChannelAddress &address)
Definition: NoteCCRangeLEDBar.hpp:155
NoteLEDBar
Class that listens for Note events and displays the velocity on an LED Bar Graph.
Definition: NoteCCRangeLEDBar.hpp:52
NoteCCLEDBarCallback::update
void update(const INoteCCValue &t, uint8_t) override
Update the given index: called when a new message is received for this index.
Definition: NoteCCRangeLEDBar.hpp:25
BankConfig
A struct for selecting the bank of BankableMIDIInputs and the bank type.
Definition: BankConfig.hpp:39
Bankable::CCLEDBar::setMode
void setMode(AH::DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: NoteCCRangeLEDBar.hpp:170
CCLEDBar::barMode
void barMode()
Set the mode to bar mode.
Definition: NoteCCRangeLEDBar.hpp:96
NoteCCRange.hpp
AH::DotBarDisplayLEDs< NumLEDs >