This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
AudioVULEDs.hpp
Go to the documentation of this file.
1 /* ✔ */
2 
3 #pragma once
4 
5 #include <Audio/AudioVU.hpp>
6 #include <Def/Def.hpp>
8 
10 
20 template <uint8_t N>
21 class AudioVULEDs : public AudioVU, public Updatable<AudioVU> {
22  public:
35  AudioVULEDs(const DotBarDisplayLEDs<N> &vuleds, AudioAnalyzePeak &level,
36  float gain = 1.0)
37  : AudioVU(level, gain, N), vuleds(vuleds) {}
38 
42  void begin() override { vuleds.begin(); }
43 
47  void update() override {
48  uint8_t newValue = this->getValue();
49  if (newValue != previousValue) {
50  vuleds.display(newValue);
51  previousValue = newValue;
52  }
53  }
54 
61  void setMode(DotBarMode mode) { vuleds.setMode(mode); }
62 
66  void dotMode() { vuleds.dotMode(); }
67 
71  void barMode() { vuleds.barMode(); }
72 
73  private:
75  uint8_t previousValue = 0;
76 };
77 
Updatable
A super class for object that have to be updated regularly.
Definition: Updatable.hpp:20
AudioVULEDs::begin
void begin() override
Initialize.
Definition: AudioVULEDs.hpp:42
AudioVU::getValue
uint8_t getValue() override
Get the value of the VU meter.
Definition: AudioVU.hpp:61
AudioVULEDs::dotMode
void dotMode()
Set the mode to dot mode.
Definition: AudioVULEDs.hpp:66
Def.hpp
AudioVULEDs::AudioVULEDs
AudioVULEDs(const DotBarDisplayLEDs< N > &vuleds, AudioAnalyzePeak &level, float gain=1.0)
Create a new AudioVULEDs object.
Definition: AudioVULEDs.hpp:35
DotBarMode
DotBarMode
An enumeration type to set an LED display to either bar or dot mode.
Definition: DotBarDisplayLEDs.hpp:12
AudioVULEDs::barMode
void barMode()
Set the mode to bar mode.
Definition: AudioVULEDs.hpp:71
AudioVU::level
class AudioVU::Analyzer level
AudioVU.hpp
AudioVU
A VU meter that reads from an Audio stream using the Analyzer class.
Definition: AudioVU.hpp:17
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
AudioVULEDs::previousValue
uint8_t previousValue
Definition: AudioVULEDs.hpp:75
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
DotBarDisplayLEDs.hpp
AudioVULEDs::setMode
void setMode(DotBarMode mode)
Set the mode to either dot or bar mode.
Definition: AudioVULEDs.hpp:61
DotBarDisplayLEDs
A class for LED bars.
Definition: DotBarDisplayLEDs.hpp:26
AudioVULEDs::vuleds
DotBarDisplayLEDs< N > vuleds
Definition: AudioVULEDs.hpp:74
AudioVU::gain
float gain
Definition: AudioVU.hpp:135
AudioVULEDs
A VU meter that reads from an Audio stream using the AudioAnalyzePeak class, and displays it on an LE...
Definition: AudioVULEDs.hpp:21
AudioVULEDs::update
void update() override
Update the LEDs with the latest level.
Definition: AudioVULEDs.hpp:47