|
RGB Sunglasses Animation Extension API fw-v3.8.1-1-geacf2f0
rgbx ABI + C++ wrapper for sandboxed .llext animations
|
Extension-side analog of the firmware's BaseAnimation. More...
#include <rgbx_animation.h>
Public Member Functions | |
| virtual void | init () |
| Called once, on the sandboxed thread, after every (re)load and before the first tick. | |
| virtual void | tick (uint32_t dt_ms)=0 |
| Called once per frame; render into the framebuffer via setPixel()/fill(). | |
| virtual bool | goodMoment () const |
| Queried after every tick(): return true when the frame just rendered ended at a natural switch boundary (end of a scroll/clip/cycle), so shuffle mode (issue #121) may switch away without visual jarring. | |
Protected Member Functions | |
| size_t | width () const |
| Framebuffer width in pixels (manifest value). | |
| size_t | height () const |
| Framebuffer height in pixels (manifest value). | |
| void | setPixel (size_t x, size_t y, uint8_t r, uint8_t g, uint8_t b) |
| Write one pixel (out-of-range coordinates are ignored). | |
| void | fill (uint8_t r, uint8_t g, uint8_t b) |
| Fill the whole framebuffer with one color. | |
| uint32_t | paramU32 (size_t i) const |
| Value of UINT32 parameter i. | |
| uint32_t | param (size_t i) const |
| Alias of paramU32() kept for early extensions. | |
| uint32_t | paramColor (size_t i) const |
| Value of COLOR parameter i. | |
| bool | paramBool (size_t i) const |
| Value of BOOL parameter i. | |
| float | paramF32 (size_t i) const |
| Value of FLOAT parameter i. | |
| const char * | paramString (size_t i) const |
| Value of STRING parameter i. | |
IMU snapshot accessors | |
All read zero on a build or board with no IMU, so an animation can use them unconditionally. | |
| float | accelX () const |
| Accelerometer X for this tick. | |
| float | accelY () const |
| Accelerometer Y for this tick. | |
| float | accelZ () const |
| Accelerometer Z for this tick. | |
| float | gyroX () const |
| Gyroscope X for this tick. | |
| float | gyroY () const |
| Gyroscope Y for this tick. | |
| float | gyroZ () const |
| Gyroscope Z for this tick. | |
Button accessors | |
Both read zero when no buttons are present. proto0 mapping: 0=Up, 1=Left, 2=Right, 3=Down, 4=Wake. | |
| uint32_t | buttonsPressed () const |
| Raw pressed-since-last-tick bitmask. | |
| bool | buttonWasPressed (size_t id) const |
| Whether one button was pressed since the previous tick. | |
Audio snapshot accessors | |
All read zero when audio is absent or silent, so an animation can use them unconditionally. Bands are ordered low frequencies first. | |
| float | bandEnergy (size_t b) const |
| Smoothed energy of one coarse band. | |
| bool | isBeat (size_t b) const |
| Whether a beat fired in one band this frame. | |
| float | displayBucket (size_t i) const |
| Energy of one fine-grained spectrum bucket, for bar-graph style visualisation. | |
| static constexpr size_t | numBands () |
| Number of coarse audio bands. | |
| static constexpr size_t | numDisplayBuckets () |
| Number of fine-grained display buckets. | |
Extension-side analog of the firmware's BaseAnimation.
Subclass it and instantiate with RGBX_ANIMATION() below.
|
inlineprotected |
Accelerometer X for this tick.
|
inlineprotected |
Accelerometer Y for this tick.
|
inlineprotected |
Accelerometer Z for this tick.
|
inlineprotected |
Smoothed energy of one coarse band.
| b | Band index, 0 .. numBands()-1. |
|
inlineprotected |
Raw pressed-since-last-tick bitmask.
|
inlineprotected |
Whether one button was pressed since the previous tick.
| id | Button id (proto0: 0=Up, 1=Left, 2=Right, 3=Down, 4=Wake). |
|
inlineprotected |
Energy of one fine-grained spectrum bucket, for bar-graph style visualisation.
| i | Bucket index, 0 .. numDisplayBuckets()-1. |
value * 255 pins the bass and never lights the treble.
|
inlineprotected |
Fill the whole framebuffer with one color.
| r | Red channel, 0-255. |
| g | Green channel, 0-255. |
| b | Blue channel, 0-255. |
|
inlinevirtual |
Queried after every tick(): return true when the frame just rendered ended at a natural switch boundary (end of a scroll/clip/cycle), so shuffle mode (issue #121) may switch away without visual jarring.
Default: every frame is a good moment — matching built-in animations with no override. Backed by the optional rgbx_good_moment export, which RGBX_ANIMATION() always emits for wrapper-based extensions.
|
inlineprotected |
Gyroscope X for this tick.
|
inlineprotected |
Gyroscope Y for this tick.
|
inlineprotected |
Gyroscope Z for this tick.
|
inlineprotected |
Framebuffer height in pixels (manifest value).
|
inlineprotected |
Whether a beat fired in one band this frame.
| b | Band index, 0 .. numBands()-1. |
|
inlinestaticconstexprprotected |
Number of coarse audio bands.
|
inlinestaticconstexprprotected |
Number of fine-grained display buckets.
|
inlineprotected |
Alias of paramU32() kept for early extensions.
| i | Parameter index in manifest declaration order. |
|
inlineprotected |
Value of BOOL parameter i.
| i | Parameter index in manifest declaration order. |
|
inlineprotected |
Value of COLOR parameter i.
| i | Parameter index in manifest declaration order. |
|
inlineprotected |
Value of FLOAT parameter i.
The float rides in the shared uint32_t params[] slot as its raw IEEE-754 bit pattern (see RGBX_PARAM_FLOAT), so this accessor bit-casts via memcpy — a static_cast would silently yield the integer-converted value instead.
| i | Parameter index in manifest declaration order. |
|
inlineprotected |
Value of STRING parameter i.
String values live in rgbx_inputs::param_strings, slotted by declaration order among the string-typed params only — this accessor does that mapping for you, so i is the plain manifest index.
| i | Parameter index in manifest declaration order. |
|
inlineprotected |
Value of UINT32 parameter i.
| i | Parameter index in manifest declaration order. |
|
inlineprotected |
Write one pixel (out-of-range coordinates are ignored).
| x | Column, 0 .. width()-1. Out-of-range values are a no-op. |
| y | Row, 0 .. height()-1. Out-of-range values are a no-op. |
| r | Red channel, 0-255. |
| g | Green channel, 0-255. |
| b | Blue channel, 0-255. |
|
pure virtual |
Called once per frame; render into the framebuffer via setPixel()/fill().
Must return well within the host's per-tick CPU budget or the extension is aborted and unloaded.
| dt_ms | Nominal milliseconds since the previous tick. |
|
inlineprotected |
Framebuffer width in pixels (manifest value).