This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
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 
19  void begin(const INoteCCValue &t) override {
20  leds.begin();
21  updateAll(t);
22  }
23 
24  void update(const INoteCCValue &t, uint8_t) override {
25  uint8_t value = t.getValue();
26  leds.display(value / 127.0f);
27  }
28 
30  void dotMode() { leds.dotMode(); }
32  void barMode() { leds.barMode(); }
34  void setMode(DotBarMode mode) { leds.setMode(mode); }
35 
36  private:
38 };
39 
40 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
41 
50 template <uint8_t NumLEDs>
51 class NoteLEDBar : public GenericNoteCCRange<MIDIInputElementNote, 1,
52  NoteCCLEDBarCallback<NumLEDs>> {
53  public:
57  NoteCCLEDBarCallback<NumLEDs>>{
58  address,
59  {leds},
60  } {}
61 
63  void dotMode() { this->callback.dotMode(); }
65  void barMode() { this->callback.barMode(); }
67  void setMode(DotBarMode mode) { this->callback.setMode(mode); }
68 };
69 
70 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
71 
80 template <uint8_t NumLEDs>
81 class CCLEDBar : public GenericNoteCCRange<MIDIInputElementCC, 1,
82  NoteCCLEDBarCallback<NumLEDs>> {
83  public:
87  NoteCCLEDBarCallback<NumLEDs>>{
88  address,
89  {leds},
90  } {}
91 
93  void dotMode() { this->callback.dotMode(); }
95  void barMode() { this->callback.barMode(); }
97  void setMode(DotBarMode mode) { this->callback.setMode(mode); }
98 };
99 
100 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
101 
102 namespace Bankable {
103 
104 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
105 
116 template <uint8_t BankSize, uint8_t NumLEDs>
117 class NoteLEDBar : public GenericNoteCCRange<MIDIInputElementNote, 1, BankSize,
118  NoteCCLEDBarCallback<NumLEDs>> {
119  public:
121  const DotBarDisplayLEDs<NumLEDs> &leds,
124  NoteCCLEDBarCallback<NumLEDs>>{
125  config,
126  address,
127  {leds},
128  } {}
129 };
130 
131 // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //
132 
143 template <uint8_t BankSize, uint8_t NumLEDs>
144 class CCLEDBar : public GenericNoteCCRange<MIDIInputElementCC, 1, BankSize,
145  NoteCCLEDBarCallback<NumLEDs>> {
146  public:
148  const DotBarDisplayLEDs<NumLEDs> &leds,
150  : GenericNoteCCRange<MIDIInputElementCC, 1, BankSize,
151  NoteCCLEDBarCallback<NumLEDs>>{
152  config,
153  address,
154  {leds},
155  } {}
156 };
157 
158 } // namespace Bankable
159 
NoteCCLEDBarCallback
Callback class that drives a LED dot/bar display based on a note or control change value.
Definition: NoteCCRangeLEDBar.hpp:15
CCLEDBar
Class that listens for Control Change events and displays the velocity on an LED Bar Graph.
Definition: NoteCCRangeLEDBar.hpp:81
MIDIInputElementNote
Class for objects that listen for incoming MIDI Note events.
Definition: MIDIInputElementNote.hpp:20
Bankable
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
Definition: BankAddresses.hpp:7
NoteCCLEDBarCallback::leds
DotBarDisplayLEDs< NumLEDs > leds
Definition: NoteCCRangeLEDBar.hpp:37
GenericNoteCCRange
Definition: NoteCCRange.hpp:105
INoteCCValue
Definition: NoteCCRange.hpp:9
NoteCCRange< MIDIInputElementNote, RangeLen, 1, NoteCCLEDBarCallback< NumLEDs > >::callback
NoteCCLEDBarCallback< NumLEDs > callback
Definition: NoteCCRange.hpp:97
SimpleNoteCCValueCallback
Definition: NoteCCRange.hpp:29
Bankable::GenericNoteCCRange
Definition: NoteCCRange.hpp:164
ExtendedInputOutput.hpp
DotBarMode
DotBarMode
An enumeration type to set an LED display to either bar or dot mode.
Definition: DotBarDisplayLEDs.hpp:12
MIDIInputElementCC
Class for objects that listen for incoming MIDI Controller Change events.
Definition: MIDIInputElementCC.hpp:23
NoteLEDBar::setMode
void setMode(DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: NoteCCRangeLEDBar.hpp:67
CCLEDBar::dotMode
void dotMode()
Set the mode to dot mode.
Definition: NoteCCRangeLEDBar.hpp:93
CCLEDBar::CCLEDBar
CCLEDBar(const DotBarDisplayLEDs< NumLEDs > &leds, MIDICNChannelAddress address)
Definition: NoteCCRangeLEDBar.hpp:84
NoteLEDBar::barMode
void barMode()
Set the mode to bar mode.
Definition: NoteCCRangeLEDBar.hpp:65
Bankable::NoteLEDBar
Class that listens for Note events and displays the velocity on an LED Bar Graph.
Definition: NoteCCRangeLEDBar.hpp:117
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
NoteCCLEDBarCallback::update
void update(const INoteCCValue &t, uint8_t) override
Definition: NoteCCRangeLEDBar.hpp:24
LEDs::begin
void begin() const
Initialize (set LED pins as outputs).
Definition: LEDs.hpp:32
MIDICNChannelAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition: MIDICNChannelAddress.hpp:82
NoteCCLEDBarCallback::NoteCCLEDBarCallback
NoteCCLEDBarCallback(const DotBarDisplayLEDs< NumLEDs > &leds)
Definition: NoteCCRangeLEDBar.hpp:17
Bankable::CCLEDBar
Class that listens for Control Change events and displays the velocity on an LED Bar Graph.
Definition: NoteCCRangeLEDBar.hpp:144
DotBarDisplayLEDs::setMode
void setMode(DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: DotBarDisplayLEDs.hpp:60
DotBarDisplayLEDs::display
void display(uint8_t value) const
Display the given number of LEDs on the LED bar.
Definition: DotBarDisplayLEDs.hpp:37
Bankable::CCLEDBar::CCLEDBar
CCLEDBar(const BankConfig< BankSize > &config, const DotBarDisplayLEDs< NumLEDs > &leds, const MIDICNChannelAddress &address)
Definition: NoteCCRangeLEDBar.hpp:147
DotBarDisplayLEDs::dotMode
void dotMode()
Set the mode to dot mode.
Definition: DotBarDisplayLEDs.hpp:63
NoteCCLEDBarCallback::barMode
void barMode()
Set the mode to bar mode.
Definition: NoteCCRangeLEDBar.hpp:32
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
NoteCCLEDBarCallback::setMode
void setMode(DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: NoteCCRangeLEDBar.hpp:34
CCLEDBar::setMode
void setMode(DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: NoteCCRangeLEDBar.hpp:97
NoteCCLEDBarCallback::begin
void begin(const INoteCCValue &t) override
Definition: NoteCCRangeLEDBar.hpp:19
DotBarDisplayLEDs.hpp
DotBarDisplayLEDs::barMode
void barMode()
Set the mode to bar mode.
Definition: DotBarDisplayLEDs.hpp:66
NoteLEDBar
Class that listens for Note events and displays the velocity on an LED Bar Graph.
Definition: NoteCCRangeLEDBar.hpp:51
DotBarDisplayLEDs< NumLEDs >
CCLEDBar::barMode
void barMode()
Set the mode to bar mode.
Definition: NoteCCRangeLEDBar.hpp:95
BankConfig
A struct for selecting the bank of BankableMIDIInputs and the bank type.
Definition: BankConfig.hpp:39
MIDIInputElement::address
const MIDICNChannelAddress address
Definition: MIDIInputElement.hpp:80
NoteLEDBar::dotMode
void dotMode()
Set the mode to dot mode.
Definition: NoteCCRangeLEDBar.hpp:63
NoteCCLEDBarCallback::dotMode
void dotMode()
Set the mode to dot mode.
Definition: NoteCCRangeLEDBar.hpp:30
Bankable::NoteLEDBar::NoteLEDBar
NoteLEDBar(const BankConfig< BankSize > &config, const DotBarDisplayLEDs< NumLEDs > &leds, const MIDICNChannelAddress &address)
Definition: NoteCCRangeLEDBar.hpp:120
INoteCCValue::getValue
virtual uint8_t getValue(uint8_t index) const =0
NoteCCRange.hpp
SimpleNoteCCValueCallback::updateAll
virtual void updateAll(const INoteCCValue &noteccval)
Definition: NoteCCRange.hpp:36
NoteLEDBar::NoteLEDBar
NoteLEDBar(const DotBarDisplayLEDs< NumLEDs > &leds, MIDICNChannelAddress address)
Definition: NoteCCRangeLEDBar.hpp:54