Skip to main content

Module registry

Module registry 

Source
Expand description

The parameter registry of a synth: the key, range, unit and law of every control, with the provenance of each law.

A ParamSpec holds one control. Its Law converts between the stored value in the preset file and a physical value in an E1 unit. Laws never round: a non-integer stored value for a menu or a count is an error, and choosing the nearest option belongs to the mapper.

Each law carries a Provenance: read from facts, measured on a render or probe, or interim. A CalibrationSet replaces laws with measured tables without a code change.

use sound_to_patch::preset::registry::{registry_for, Physical, UnitKind};
use sound_to_patch::synth::Synth;

let registry = registry_for(Synth::Vital)?;
let cutoff = registry.get("filter_1_cutoff").ok_or("no cutoff")?;
let stored = cutoff.stored(&Physical::parse(UnitKind::Hz, "261.6255653 Hz")?)?;
assert!((stored - 60.0).abs() < 1e-6);

Structs§

Build
A synth build, such as 1.5.5. Each adapter defines what its text holds.
CalibrationError
A calibration set that cannot load into a registry.
CalibrationSet
The calibration tables of one synth.
CalibrationTable
A measured law for one key, as a render or probe produced it.
CustomLaw
A law an adapter implements itself, shared between registries.
ParamError
A conversion of one control that failed.
ParamSpec
One control of a synth.
Registry
A registry built from a list of entries.
Table
A piecewise law through measured points. It never extrapolates.
UnitLaw
A unit and the law that converts stored values to it.

Enums§

Interp
How a Table interpolates between its points.
Law
The closed-form laws, a measured table and a law an adapter defines.
ParamKind
What a stored value is.
Physical
A physical value in one of the E1 unit types.
Provenance
Where the law of an entry comes from.
UnitKind
The E1 unit type of a physical value.

Traits§

ParamLaw
A law between the stored value of a control and its physical value.
ParamRegistry
The parameter registry of one synth.

Functions§

registry_for
The registry of a synth.