AUDIO
Source snapshot · 11 November 2026

Explicit trusted VST3 instances

Ownership and trust

Unsafe instances::Provider::from_raw establishes exact table/code/thread trust; unsafe load explicitly trusts the selected module and dependencies. The SDK provider requires the original platform main thread. Rust parent libraries and child instances are neither Send nor Sync. Children borrow their parent, so safe code cannot retire a parent while its children remain alive. Preparation, activation, stopping and retirement belong on main, outside audio callbacks. The native provider rejects foreign control reentry while changing an owner. All mutable CONTROL operations across a parent require every borrowed audio scope to have joined. Prepare/start multiple children before lending their independent scopes; joining one does not permit mutation while another remains borrowed.

Instance::with_audio lends one non-cloneable Send, non-Sync capability to an exclusive scope. Move it into one joined std::thread::scope worker; the first native process binds it to that worker. The token cannot escape into a static thread or outer thread scope. Native end runs on main after joined workers on normal return or unwind. Forgetting the audio value still ends the native scope. The capability has no interface ownership or destructor. An unexpected failed native end poisons and retains the native child instead of attempting destructive cleanup against an unproved audio owner. This exceptional retention can persist until process exit; it is not an automatic recovery mechanism.

Consuming parent retirement reports complete, failed native context clearing, or ProcessPinned; consuming child retirement reports complete or the first native cleanup failure. Other rejection returns the exact owner for an explicit retry. Best-effort Drop performs one legal control retirement and discards its result; it never repeats a consumed native cleanup.

Factories declaring non-discardable components are pinned before the first native creation attempt, including failed or throwing attempts. Closing their last facade returns the consuming ProcessPinned outcome; the exact module, factory, host context and reservation survive until OS process exit. V2 reopens a known canonical path or symlink alias using that same core without repeating module entry or context installation. V1 cannot adopt pinned cores. Known active paths reject before loading, and factory identity rejects duplicate context ownership. Different paths that return the same factory are still checked after loading; the provider does not prove every possible loader alias harmless.

The provider executable and host callback code must also remain loaded until process exit when pinning or exceptional retained ownership is possible. Native module retention does not retain an independently unloaded provider DLL. Trusted foreign code has unrestricted process access; crashes, arbitrary allocation, memory validity and native side effects are not isolated or rolled back.