Restore, failure and recovery¶
Restore reserves and copies all source streams before the first mutating call.
It calls component setState, controller setComponentState with an independent
zero-position copy of component bytes, then controller setState when own bytes
were supplied. Optional unsupported controller-own state still receives
setComponentState. Raw read-only sources may overlap each other, but neither may
alias metadata, diagnostics or protected native owner/stream/scratch storage.
Caller-declared pointers must actually denote live typed memory; the provider does
not isolate unrestricted foreign code in another address space.
Successful restore invalidates the old prepared profile. Call prepare explicitly
before start. If using the parameter companion, explicitly
refresh and prepare_parameters instead. No automatic bus negotiation, parameter cache refresh, restart-flag
clearing or processing synchronization occurs. For an exclusively owned child:
use ravet_host::vst3::instances::state::CaptureCapacity;
// `state` is the exact trusted companion; `child` is stopped on main.
let saved = child.capture_state(state, CaptureCapacity::new(4096, 4096)?)?.snapshot;
child.restore_state(state, &saved)?;
child.prepare(profile)?;
child.start()?;
Compound restore can partially commit before a later refusal. Any failed foreign restore or sticky stream fault poisons further preparation, processing and state operations, even if the plug-in returned SDK success after a rejected stream operation. There is no rollback or retry. Joined stop and retirement remain safe; retire the child and create a fresh one for recovery. This state fault is distinct from unproved audio-end ownership, which requires exceptional native retention. Malformed post-restore reports also fail closed because they cannot prove no mutation occurred. A genuine preflight refusal preserves the previous profile.
Reports identify the failed component/controller stage. returned_status() is
the original returned SDK code only when a call actually returned; a caught
exception has threw()==true and no returned status. Sticky stream faults remain
separate from that code, preserving an actual SDK zero alongside a swallowed
stream failure. controller_capture_status() is meaningful on successful capture
alongside the snapshot's controller mode. Getter failure does not automatically
poison a stopped child; setter failure does.