FastLED 3.9.15
Loading...
Searching...
No Matches

◆ add() [1/8]

FL_MAYBE_UNUSED fl::shared_ptr< fl::audio::Processor > CFastLED::add ( const fl::audio::Config & config)
static

Add an audio input and return an auto-pumped Processor.

Creates an audio input from the given config and sets up a scheduler task that automatically reads samples and feeds them to the Processor during FastLED.show(). The returned processor can be used to register event callbacks (onBeat, onVocalStart, etc.) without manual update() calls.

On platforms without audio hardware support, returns a no-op Processor (callbacks will never fire but the returned pointer is valid).

Parameters
configAudio hardware configuration (e.g., Config::CreateInmp441(...))
Returns
shared_ptr to Processor, or nullptr on failure

Example:

auto config = fl::audio::Config::CreateInmp441(WS, SD, CLK, fl::Both);
auto audio = FastLED.add(config);
audio->setGain(2.0f); // Optional: amplify input
audio->onBeat([]{ /* pulse leds */ });
fl::UIAudio audio("Audio Input")
CFastLED FastLED
Global LED strip management instance.
static Config CreateInmp441(int pin_ws, int pin_sd, int pin_clk, AudioChannel channel, u16 sample_rate=44100ul, int i2s_num=0) FL_NOEXCEPT
Definition input.h:153

Definition at line 749 of file FastLED.cpp.hpp.

749 {
750 return fl::audio::AudioManager::instance().add(config);
751}
shared_ptr< Processor > add(const Config &config) FL_NOEXCEPT
static AudioManager & instance() FL_NOEXCEPT

References fl::audio::AudioManager::add(), and fl::audio::AudioManager::instance().

+ Here is the call graph for this function: