Skip to content

MoonLiveLayout

Source: MoonLiveLayout.h

MoonLiveLayout

class MoonLiveLayout
src/light/moonlive/MoonLiveLayout.h:30

Inherits: LayoutBase

Where the lights physically are, written as text on a running device.

Public Methods

virtual inline const char * tags() const override : The tags the script declares, or the scripted-module mark when it declares none.

virtual inline Dim dimensions() const override : The axes this layout declares, which the card and the picker show.

virtual inline void defineControls() override : Publish the script name, and every control the script declares.

virtual inline void prepare() override : Compile the script, where the lights themselves are placed by whoever asks.

virtual inline nrOfLightsType lightCount() const override : Run the script, counting what it places.

virtual inline void placeLights(const CoordSink & sink) const override : Run the script again, emitting each light into the consumer's sink.

virtual inline void release() override : Drop the compiled program and its memory.

virtual inline void onControlChanged(const char * name) override : Nothing to do on a control write, since compile re-derives from the file every time.

inline void setScript(const char * name) : Point the layout at a script in the shared script directory; the next [prepare()] compiles it.

More info

Why a layout is worth scripting

A layout is the one part of the pipeline that differs for every physical build, so each one has meant a new class, a rebuild and a reflash. A script means the person who hung the lights describes where they went and sees it immediately.

The binding that needed the language to grow

A modifier transforms one coordinate because the Layer calls it per light, where a layout places every light itself, which takes a loop.

Why it still allocates nothing

The script calls addLight per light, and the binding points that call at a counter on the sizing pass and at the sink on the walk. Staging the coordinates instead would cost 48 KB on a 16k-light fixture. The count and the coordinates come from the same code, so the two answers cannot drift apart.