FastLED 3.10.8
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, AnimartrixRing.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) FL_NO_EXCEPT
 Constructs an FxEngine with the specified number of LEDs.
 
 ~FxEngine () FL_NO_EXCEPT
 Destructor for FxEngine.
 
IntFxMap & _getEffects () FL_NO_EXCEPT
 
int addFx (Fx &effect) FL_NO_EXCEPT
 Adds a new effect to the engine.
 
int addFx (FxPtr effect) FL_NO_EXCEPT
 Adds a new effect to the engine.
 
bool draw (fl::u32 now, fl::span< CRGB > outputBuffer) FL_NO_EXCEPT
 Renders the current effect or transition to the output buffer.
 
int getCurrentFxId () const FL_NO_EXCEPT
 
FxPtr getFx (int index) FL_NO_EXCEPT
 Retrieves an effect from the engine without removing it.
 
float getSpeed () const FL_NO_EXCEPT
 
bool nextFx (u16 transition_ms=500) FL_NO_EXCEPT
 Transitions to the next effect in the sequence.
 
void pushAudioFrame (const AudioFrame &frame) FL_NO_EXCEPT
 Pushes an audio frame into the back buffer.
 
FxPtr removeFx (int index) FL_NO_EXCEPT
 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) FL_NO_EXCEPT
 Connects an audio processor for automatic audio delivery.
 
bool setNextFx (int index, u16 duration) FL_NO_EXCEPT
 Sets the next effect to transition to.
 
void setSpeed (float scale) FL_NO_EXCEPT
 Sets the speed of the fx engine, which will impact the speed of all effects.
 

Private Attributes

fl::vector< AudioFrame > mAudioBack
 
fl::vector< AudioFrame > mAudioFront
 
fl::shared_ptr< fl::audio::Processor > mAudioProcessor
 
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: