Skip to main content

Module preset

Module preset 

Source
Expand description

The preset layer — ADR-0002 layers 1-2: TOML data binding built-in system parameters to a pure expression language over the audio analysis.

Pure is a statement about the evaluator, not about the surface: a [latch] (ADR-0137) reads state the render layer holds between frames, and expr’s own header says how that is arranged without the evaluator learning it.

expr compiles and evaluates expression strings; schema parses a TOML preset into compiled Bindings; path parses the one thing here that is not an expression, a [path] d string, into an authored silhouette (ADR-0107). This module also loads presets in bulk: default_presets embeds the shipped examples (so the C-ABI/foobar path always has visuals without a preset directory), seed_dir writes the embedded curated set into a per-user directory on first run (write-if-absent, so a user’s edits survive), and load_dir reads a directory for the standalone’s hot-reload path — a malformed file is reported, never fatal, so the caller keeps the last good set (NFR 10). drift reads that same directory against the embedded set without changing it, because seeding writes if-absent and never prunes: what an operator keeps diverges, and a shell has to be able to say how.

Re-exports§

pub use expr::Expr;
pub use expr::ExprError;
pub use expr::GateFlag;
pub use expr::GateKind;
pub use expr::LATCH_CAP;
pub use expr::NodeObservation;
pub use expr::Observations;
pub use expr::SATURATED_OCCUPANCY;
pub use expr::Variables;
pub use expr::compile;
pub use schema::export;
pub use schema::Binding;
pub use schema::Easing;
pub use schema::GLOBAL_PARAMS;
pub use schema::HoldEdge;
pub use schema::KeyDesc;
pub use schema::KeyKind;
pub use schema::Latch;
pub use schema::Layer;
pub use schema::LayerBlend;
pub use schema::LayerJoin;
pub use schema::Preset;
pub use schema::PresetError;
pub use schema::PresetWarning;
pub use schema::Roster;
pub use schema::SystemKind;
pub use schema::TableDesc;
pub use schema::is_known_param;
pub use schema::kind_of_param;

Modules§

expr
A tiny pure expression language over the audio-analysis variables, compiled once at preset load and evaluated per parameter per frame.
path
An authored silhouette, parsed from inline SVG path data (ADR-0107).
schema
TOML preset schema: which built-in system a preset drives and the expression bound to each of its named parameters.

Structs§

DriftEntry
One *.toml in a preset directory, as drift judged it.
DriftReport
What a preset directory holds beyond the set this build ships.
DuplicateName
A display name claimed by more than one file that compiles.
LoadReport
The outcome of loading a preset directory: the presets that compiled, in filename order, plus the files that failed and the non-fatal problems found in the ones that succeeded (so the caller can surface both).

Enums§

DriftStatus
How one file in a preset directory stands against the set this build ships.

Statics§

EMBEDDED
The shipped example presets, generated from presets/*.toml by core/build.rs (ADR-0022): (filename, contents) tuples, sorted by filename, each embedded via include_str!.

Functions§

default_presets
Parse the embedded example presets. The shipped files are valid, so on the off chance one fails it is skipped rather than panicking — the caller still gets a usable set.
drift
Judge every *.toml in dir against EMBEDDED, without changing anything: seeding writes if-absent and never prunes, so a directory an operator keeps drifts from the shipped set in three ways at once, and this is the read that names them.
load_dir
Load every *.toml in dir, compiling each into a Preset. Missing or unreadable directories yield an empty report rather than an error; a bad file lands in errors and does not stop the others (degrade, never crash).
seed_dir
Write each embedded curated preset into dir, creating dir (and any missing parents) first, but never overwriting a file that already exists — a user’s edits to a seeded preset survive re-seeding. Returns how many files were newly written. Idempotent: a second call on an already-seeded directory writes zero.