Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
AudioVULEDs.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
6#include <Audio/AudioVU.hpp>
7#include <Def/Def.hpp>
8
10
20template <uint8_t N>
21class AudioVULEDs : public AudioVU, public AH::Updatable<AudioVU> {
22 public:
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(AH::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
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
void begin() override
Initialize the shift register.
A super class for object that have to be updated regularly.
A VU meter that reads from an Audio stream using the AudioAnalyzePeak class, and displays it on an LE...
void update() override
Update the LEDs with the latest level.
AH::DotBarDisplayLEDs< N > vuleds
void begin() override
Initialize.
uint8_t previousValue
void setMode(AH::DotBarMode mode)
Set the mode to either dot or bar mode.
AudioVULEDs(const AH::DotBarDisplayLEDs< N > &vuleds, AudioAnalyzePeak &level, float gain=1.0)
Create a new AudioVULEDs object.
void dotMode()
Set the mode to dot mode.
void barMode()
Set the mode to bar mode.
A VU meter that reads from an Audio stream using the Analyzer class.
Definition AudioVU.hpp:16
uint8_t getValue() override
Get the value of the VU meter.
Definition AudioVU.hpp:60
class AudioVU::Analyzer level
float gain
Definition AudioVU.hpp:135
DotBarMode
An enumeration type to set an LED display to either bar or dot mode.