FastLED 3.10.8
Loading...
Searching...
No Matches

◆ add() [1/9]

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")
static Config CreateInmp441(int pin_ws, int pin_sd, int pin_clk, AudioChannel channel, u16 sample_rate=44100ul, int i2s_num=0) FL_NO_EXCEPT
Definition input.h:153
CFastLED FastLED
Global LED strip management instance.

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

948 {
949 return fl::audio::AudioManager::instance().add(config);
950}
static AudioManager & instance() FL_NO_EXCEPT
shared_ptr< Processor > add(const Config &config) FL_NO_EXCEPT

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

+ Here is the call graph for this function: