Phase 31: add CLAP, VST2 and VST3 mono effect hosting

This commit is contained in:
Johannes Findeisen 2026-10-27 17:34:46 +01:00
commit 9e0e4562d7
114 changed files with 10369 additions and 75 deletions

View file

@ -204,3 +204,56 @@ live-sine CC maps without changing plugin state records. Direct static edits do
not override existing lanes. Live CCs do not map to plugins; missing targets or
modules fail without installing partial state. See CONTROL.md for timing,
precedence, reset and backward-jump behavior.
## Phase 31: CLAP, VST2 and VST3 effect loaders
**File → Load plugin** now detects LADSPA, CLAP, VST2 and VST3 entry points in an
explicit trusted Linux module. **Insert plugin on selected wire** and **Replace
selected plugin** use the same browser and transactional graph preparation. The
identity/editor dialog names the format and stable ID. Existing LADSPA controls
and automation continue to work. Modern effects currently use their default
configuration: the editor shows identity but no editable parameters.
Choose the actual binary: `.clap` for CLAP, a VST2 `.so` exporting `VSTPluginMain`,
or a VST3 bundle's `Contents/<architecture>-linux/<module>.so` exporting
`ModuleEntry`, `ModuleExit` and `GetPluginFactory`. The chooser does not resolve
bundle directories or recursively scan plugin folders. On Linux this avoids
executing unrelated plugins just to discover one selected module. Auto-detection
prefers CLAP, then VST2, then VST3, otherwise LADSPA; the C API also provides
`xtc_plugin_probe_format` for an explicit format.
The modern subset is **one mono audio input and one mono output, float32, default
configuration, zero reported latency**. Stereo graph playback uses independent
instances. True stereo/multichannel/sidechain buses, instruments, MIDI/events,
custom editors, parameter changes/automation, programs/presets, opaque state,
transport/time information, workers and latency compensation are not implemented
for these three formats. Modern metadata with controls/automation is rejected,
not silently ignored. VST3 event buses and CLAP note ports are rejected. Plugins
requiring unsupported host extensions may refuse initialization. This is not a
claim that all CLAP/VST2/VST3 plugins will load or sound identically after updates.
Only original effect fixtures have been qualified for the new formats. Trusted
plugin code is in-process and can crash/hang or violate realtime rules. No plugin
binary is included in packages. A VST2 ABI adapter does not provide rights to the
discontinued SDK or plugin redistribution. See decision 0010 and LICENSES.md.
The control/main thread owns discovery, activation, module reference accounting,
retirement and unloading. CLAP's start-processing call runs on the audio owner;
main-thread callbacks are coalesced and serviced via `xtc_plugin_idle` (GUI timer,
currently 100 ms). C hosts using CLAP must pump that API on their serialized main
thread while instances live, and stop/join audio before destruction. Restart and
VST2 I/O-change requests make subsequent blocks fail/silence; stop and rebuild or
reload the plugin rather than reconfiguring inside the callback. CLAP process
errors and VST3 failure results silence a block. VST2 has no process error return.
```sh
make all test gui test-modern-plugins test-gui-modern-plugins
make test-sanitize analyze
```
Original CLAP/VST2/VST3 shared-library fixtures exercise exact in-place and stereo
processing, entry/instance lifetimes, rejected layouts, partial initialization,
CLAP start/process failures, graph replacement rollback, 50 plan retirements per
format, missing modules, v11 save/reopen and GUI add/browser/undo/reopen. Host
allocation/loading/unloading guards remain active while rendering. This evidence
qualifies the subset above, not arbitrary external plugins or physical audio.