FastLED 3.9.15
Loading...
Searching...
No Matches
fl::FxEngine Class Reference

Detailed Description

Manages and renders multiple visual effects (Fx) for LED strips.

The FxEngine class is responsible for:

  • Storing and managing a collection of visual effects (Fx objects)
  • Handling transitions between effects
  • Rendering the current effect or transition to an output buffer
Examples
Animartrix.ino, FxEngine.ino, FxGfx2Video.ino, and Sailboat.ino.

Definition at line 33 of file fx_engine.h.

#include <fx_engine.h>

+ Collaboration diagram for fl::FxEngine:

Public Types

typedef fl::flat_map< int, FxPtr > IntFxMap
 

Public Member Functions

 FxEngine (u16 numLeds, bool interpolate=true)
 Constructs an FxEngine with the specified number of LEDs.
 
 ~FxEngine () FL_NOEXCEPT
 Destructor for FxEngine.
 
IntFxMap_getEffects ()
 
int addFx (Fx &effect)
 Adds a new effect to the engine.
 
int addFx (FxPtr effect)
 Adds a new effect to the engine.
 
bool draw (fl::u32 now, fl::span< CRGB > outputBuffer)
 Renders the current effect or transition to the output buffer.
 
int getCurrentFxId () const
 
FxPtr getFx (int index)
 Retrieves an effect from the engine without removing it.
 
float getSpeed () const
 
bool nextFx (u16 transition_ms=500)
 Transitions to the next effect in the sequence.
 
void pushAudioFrame (const AudioFrame &frame)
 Pushes an audio frame into the back buffer.
 
FxPtr removeFx (int index)
 Requests removal of an effect from the engine, which might not happen immediately (for example the Fx needs to finish a transition).
 
void setAudio (fl::shared_ptr< fl::audio::Processor > proc)
 Connects an audio processor for automatic audio delivery.
 
bool setNextFx (int index, u16 duration)
 Sets the next effect to transition to.
 
void setSpeed (float scale)
 Sets the speed of the fx engine, which will impact the speed of all effects.
 

Private Attributes

fl::vector< AudioFramemAudioBack
 
fl::vector< AudioFramemAudioFront
 
fl::shared_ptr< fl::audio::ProcessormAudioProcessor
 
FxCompositor mCompositor
 Handles effect transitions and rendering.
 
int mCounter = 0
 
int mCurrId
 Id of the current effect.
 
u16 mDuration = 0
 Duration of the current transition.
 
bool mDurationSet
 Flag indicating if a new transition has been set.
 
IntFxMap mEffects
 Collection of effects.
 
bool mInterpolate = true
 
TimeWarp mTimeFunction
 

The documentation for this class was generated from the following files: