ADR-0001 — CLAP first, implemented directly with clack; VST3 and AU later through clap-wrapper
Status: accepted
Context: The instruments must load in common DAWs. CLAP fits best: a plain C ABI, threading rules written into the spec, per-note expression and polyphonic modulation — which matter for instruments. Writing the core in C was considered for latency; it gives none (latency comes from the host buffer and the algorithm; Rust and C compile through LLVM to the same code), while Rust’s type system checks exactly what breaks C plugins: CLAP’s main-thread/audio-thread rules, host-pointer lifetimes, audio↔GUI data races, parsing state and model files. The maintainer wants direct control over CLAP rather than a framework’s abstraction. See Plugin formats.
Decision: Each instrument is a CLAP plugin written in Rust directly against CLAP with clack (clack-plugin, clack-extensions; clap-sys where clack lacks something). The plugin crate implements the CLAP interfaces itself — params, state, note ports, audio ports, GUI, timer — and calls the framework-free DSP core (ADR-0002). The GUI is Rust too: egui (ADR-0006). VST3 (Ableton Live, Cubase) and AUv2 (Logic) come later by wrapping the CLAP with clap-wrapper; a standalone build for testing comes from clap-wrapper too, or from a small host of our own on clack-host.
Rejected alternative: nice-plug (less code, CLAP + VST3 from one source, but it hides CLAP behind its own model and is a community fork of an unmaintained framework). Core in C with a Rust GUI (no latency gain; the audio↔GUI link would cross an FFI boundary unchecked on both sides; two build systems). Plain clap-sys only (all unsafe, no thread-safety types).
Consequences: More code per plugin than with a framework (parameter handling, state, GUI embedding are ours), in exchange for full access to CLAP features and no framework between us and the host. Until clap-wrapper is added, Live and Logic users cannot load the plugins. clap-validator runs on every plugin in CI.