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>(
32 ceilf(2.0 * ctx.lamp.maxWidthFloat),
35 ctx.lamp.fill(
palette, maxLedIndex - vuLevel, maxLedIndex);
38 static void on_enter_mode(
auto& ctx)
41 ctx.state.soundEvent.reset(ctx);
Define the audio handle object.
Basic "default" modes included with the hardware.
Definition: aurora.hpp:12
constexpr float highLevelDb
Microphone is not good enough at after this.
Definition: sound.h:21
constexpr float silenceLevelDb
Decibel level for a silent room.
Definition: sound.h:19
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:45
uint8_t fade
fade rate
Definition: vu_meter.hpp:47
audio::SoundEventTy soundEvent
sound event tracker
Definition: vu_meter.hpp:49
Emulate a vu-sound meter.
Definition: vu_meter.hpp:14
static constexpr auto palette
color to display
Definition: vu_meter.hpp:16