Skip to content

Source: MoonLiveBuiltins_common.h

moonlive_builtins_common

The domain-neutral half of the script vocabulary: arithmetic, waveforms, noise, randomness and print.

None of it is about light, so none of it belongs to the light domain.

Functions

Return Name Description
int32_t signedArg inline A script argument read as signed, which is what every builtin taking a coordinate wants.
std::atomic< uint32_t > & printBudget inline The remaining print budget, reset by a binding when it compiles.
void resetPrintBudget inline Grant a fresh print burst, called from a binding's prepare alongside the compile.
uint32_t mm_ml_random16 inline
uint32_t mm_ml_mod inline The signed remainder, which is the wrap a cyclic animation needs; zero divisor answers 0.
uint32_t mm_ml_div inline The signed quotient, which the / operator lowers to.
uint32_t mm_ml_fdiv inline The Q16.16 quotient, which / lowers to when both sides are fixed.
uint32_t mm_ml_beat inline A rising sawtooth at a given BPM, full scale, so scaling it sweeps any fixture size.
uint32_t mm_ml_beatsin inline
uint32_t mm_ml_noise inline The gradient-noise field at a point, whose high byte picks the cell and low byte interpolates.
uint32_t mm_ml_sin inline
uint32_t mm_ml_cos inline
uint32_t mm_ml_turn inline The angle step dividing one revolution into n parts.
uint32_t mm_ml_scale inline
uint32_t mm_ml_print inline
void addCommonBuiltins inline Register the neutral builtins into whatever table asks.

signedArg

inline

inline int32_t signedArg(uintptr_t a)

A script argument read as signed, which is what every builtin taking a coordinate wants.


printBudget

inline

inline std::atomic< uint32_t > & printBudget()

The remaining print budget, reset by a binding when it compiles.


resetPrintBudget

inline

inline void resetPrintBudget()

Grant a fresh print burst, called from a binding's prepare alongside the compile.


mm_ml_random16

inline

inline uint32_t mm_ml_random16(const uintptr_t * args, uint32_t, const uint8_t *)

mm_ml_mod

inline

inline uint32_t mm_ml_mod(const uintptr_t * args, uint32_t, const uint8_t *)

The signed remainder, which is the wrap a cyclic animation needs; zero divisor answers 0.


mm_ml_div

inline

inline uint32_t mm_ml_div(const uintptr_t * args, uint32_t, const uint8_t *)

The signed quotient, which the / operator lowers to.


mm_ml_fdiv

inline

inline uint32_t mm_ml_fdiv(const uintptr_t * args, uint32_t, const uint8_t *)

The Q16.16 quotient, which / lowers to when both sides are fixed.


mm_ml_beat

inline

inline uint32_t mm_ml_beat(const uintptr_t * args, uint32_t, const uint8_t *)

A rising sawtooth at a given BPM, full scale, so scaling it sweeps any fixture size.


mm_ml_beatsin

inline

inline uint32_t mm_ml_beatsin(const uintptr_t * args, uint32_t, const uint8_t *)

mm_ml_noise

inline

inline uint32_t mm_ml_noise(const uintptr_t * args, uint32_t, const uint8_t *)

The gradient-noise field at a point, whose high byte picks the cell and low byte interpolates.


mm_ml_sin

inline

inline uint32_t mm_ml_sin(const uintptr_t * args, uint32_t, const uint8_t *)

mm_ml_cos

inline

inline uint32_t mm_ml_cos(const uintptr_t * args, uint32_t, const uint8_t *)

mm_ml_turn

inline

inline uint32_t mm_ml_turn(const uintptr_t * args, uint32_t, const uint8_t *)

The angle step dividing one revolution into n parts.


mm_ml_scale

inline

inline uint32_t mm_ml_scale(const uintptr_t * args, uint32_t, const uint8_t *)

mm_ml_print

inline

inline uint32_t mm_ml_print(const uintptr_t * args, uint32_t, const uint8_t *)

addCommonBuiltins

inline

inline void addCommonBuiltins(BuiltinTable & t)

Register the neutral builtins into whatever table asks.

More info

Why it left the light header

It lived there because that was the only vocabulary there was. When the service table arrived it had to reach into the light header for print and addControl, which is core depending on a domain. That is the wrong direction, and the reason a service script could not call sin while an effect could, for no reason either could explain.

What stays on the light side

Whatever genuinely needs a canvas: the pixel writes, the palette and particle helpers, the audio frame, and the per-light coordinates.