16 static constexpr auto palette = colors::PaletteGradient<colors::Red, colors::Green>;
18 static void loop(
auto& ctx)
20 auto& state = ctx.state;
21 state.soundEvent.update(ctx);
23 const float decibels = state.soundEvent.level;
25 ctx.lamp.fadeToBlackBy(state.fade);
26 const uint16_t maxLedIndex = ctx.lamp.ledCount - 1;
29 const uint16_t vuLevel = lmpd_constrain<uint16_t>(lmpd_map<uint16_t>(decibels,
34 ceilf(2.0 * ctx.lamp.maxWidthFloat),
37 ctx.lamp.fill(
palette, maxLedIndex - vuLevel, maxLedIndex);
40 static void on_enter_mode(
auto& ctx)
43 ctx.state.soundEvent.reset(ctx);
Define the audio handle object.
constexpr float silenceLevelDb
Decibel level for a silent room.
Definition: sound.h:20
constexpr float highLevelDb
Microphone is not good enough at after this.
Definition: sound.h:22
Basic "default" modes included with the hardware.
Definition: aurora.hpp:12
Define some useful color palettes, and tools to use them.
Parent object for all custom user modes.
Definition: mode_type.hpp:53
Sound processor able to detect sound level events.
Definition: utils.hpp:92
Definition: vu_meter.hpp:47
uint8_t fade
fade rate
Definition: vu_meter.hpp:49
audio::SoundEventTy soundEvent
sound event tracker
Definition: vu_meter.hpp:51
Emulate a vu-sound meter.
Definition: vu_meter.hpp:14
static constexpr auto palette
color to display
Definition: vu_meter.hpp:16