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).
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::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§
- Load
Report - 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).
Statics§
- EMBEDDED
- The shipped example presets, generated from
presets/*.tomlbycore/build.rs(ADR-0022):(filename, contents)tuples, sorted by filename, each embedded viainclude_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.
- load_
dir - Load every
*.tomlindir, compiling each into aPreset. Missing or unreadable directories yield an empty report rather than an error; a bad file lands inerrorsand does not stop the others (degrade, never crash). - seed_
dir - Write each embedded curated preset into
dir, creatingdir(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.