FastLED 3.9.7
|
Manages and renders multiple visual effects (Fx) for LED strips.
The FxEngine class is responsible for:
Definition at line 38 of file fx_engine.h.
#include <fx_engine.h>
Public Types | |
typedef fl::FixedMap< int, FxPtr, FASTLED_FX_ENGINE_MAX_FX > | IntFxMap |
Public Member Functions | |
FxEngine (uint16_t numLeds, bool interpolate=true) | |
Constructs an FxEngine with the specified number of LEDs. | |
~FxEngine () | |
Destructor for FxEngine. | |
int | addFx (FxPtr effect) |
Adds a new effect to the engine. | |
int | addFx (Fx &effect) |
Adds a new effect to the engine. | |
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). | |
FxPtr | getFx (int index) |
Retrieves an effect from the engine without removing it. | |
int | getCurrentFxId () const |
bool | draw (uint32_t now, CRGB *outputBuffer) |
Renders the current effect or transition to the output buffer. | |
bool | nextFx (uint16_t transition_ms=500) |
Transitions to the next effect in the sequence. | |
bool | setNextFx (int index, uint16_t duration) |
Sets the next effect to transition to. | |
IntFxMap & | _getEffects () |
void | setSpeed (float scale) |
Sets the speed of the fx engine, which will impact the speed of all effects. | |
typedef fl::FixedMap<int, FxPtr, FASTLED_FX_ENGINE_MAX_FX> fl::FxEngine::IntFxMap |
Definition at line 40 of file fx_engine.h.
fl::FxEngine::FxEngine | ( | uint16_t | numLeds, |
bool | interpolate = true ) |
Constructs an FxEngine with the specified number of LEDs.
numLeds | The number of LEDs in the strip. |
Definition at line 7 of file fx_engine.cpp.
fl::FxEngine::~FxEngine | ( | ) |
Destructor for FxEngine.
Definition at line 14 of file fx_engine.cpp.
|
inline |
Definition at line 110 of file fx_engine.h.
|
inline |
Adds a new effect to the engine.
Allocate from static memory. This is not reference tracked and an object passed in must never be deleted, as the engine will use a non tracking Ptr which may outlive a call to removeFx() and the engine will thefore not know that an object has been deleted. But if it's a static object that's then the object probably wasn't going to be deleted anyway.
Definition at line 68 of file fx_engine.h.
int fl::FxEngine::addFx | ( | FxPtr | effect | ) |
Adds a new effect to the engine.
effect | Pointer to the effect to be added. |
Definition at line 16 of file fx_engine.cpp.
bool fl::FxEngine::draw | ( | uint32_t | now, |
CRGB * | outputBuffer ) |
Renders the current effect or transition to the output buffer.
now | The current time in milliseconds. |
outputBuffer | The buffer to render the effect into. |
Definition at line 84 of file fx_engine.cpp.
|
inline |
Definition at line 85 of file fx_engine.h.
FxPtr fl::FxEngine::getFx | ( | int | index | ) |
Retrieves an effect from the engine without removing it.
index | The id of the effect to retrieve. |
Definition at line 75 of file fx_engine.cpp.
bool fl::FxEngine::nextFx | ( | uint16_t | transition_ms = 500 | ) |
Transitions to the next effect in the sequence.
duration | The duration of the transition in milliseconds. |
Definition at line 35 of file fx_engine.cpp.
FxPtr fl::FxEngine::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).
index | The index of the effect to remove. |
Definition at line 54 of file fx_engine.cpp.
bool fl::FxEngine::setNextFx | ( | int | index, |
uint16_t | duration ) |
Sets the next effect to transition to.
index | The index of the effect to transition to. |
duration | The duration of the transition in milliseconds. |
Definition at line 44 of file fx_engine.cpp.
|
inline |
Sets the speed of the fx engine, which will impact the speed of all effects.
timeScale | The new time scale value. |
Definition at line 116 of file fx_engine.h.