Hosted native 32/64 aux buses and owned Graph banks¶
The default-disabled ravet-host/vst3-hosted-audio feature (it enables
vst3-catalogue) adds vst3::instances::hosted_audio. It is an additive,
exact-origin companion: the caller-linked native archive exports
ravet_vst3_hosted_audio_provider_v1, whose 72-byte table (64-bit macOS)
contains pointers to the exact instance ABI-v2 and rich processing-v1 tables.
hosted_audio::Provider::from_raw checks size, version, every entry and both
origins; preparation additionally checks pointer identity against the
Instance's Library and its refreshed processing table. Existing v1/v2, state,
parameter and processing layouts, result domains and f32 entry points are
unchanged. Cargo still links no SDK; see the native build section above.
Catalogue and explicit profile¶
On a stopped child, call refresh_parameters, then refresh_processing, then
refresh_hosted_audio. The returned AudioCatalogue copies every advertised
audio bus in native index order (0..16 per direction): direction, main/aux type,
defaultActive flag, channel count, speaker arrangement bit mask and UTF-8
name. At most one main bus per direction is admitted. Native refresh
invalidates any earlier readiness, so every refresh requires preparation again.
HostedAudioProfile::new(precision, rate, maximum_frames, inputs, outputs)
takes an explicit BusRequest::active(arrangement) or
BusRequest::inactive(arrangement) for EVERY advertised bus; no
defaultActive inference or fallback precision is applied. Rate is finite,
positive and at most 768000 Hz; frames 1..=65536; at most 64 active packed
channels per direction and at least one active channel overall. Mono is the
SDK centre speaker bit (1 << 19), not bit 0.
prepare_hosted32 / prepare_hosted64 refuse a profile of the other precision
locally. Local refusal (shape, missing bus request, stale catalogue) preserves
the prior prepared profile. Once the native call begins, Rust readiness is
cleared first. The native provider negotiates canProcessSampleSize, passes all
advertised arrangements (inactive included) to setBusArrangements, reinspects
counts/types/arrangements, sets up processing, activates the requested buses
and only then publishes; the latency/tail getters follow. Native refusals keep
their original stage (ControlReport::stage, 100..=122) and returned tresult,
for example a kResultFalse from canProcessSampleSize at stage 107.
PackedAudioMap exposes each bus's native index, arrangement, channel count and
packed range. Active channels pack in increasing native index order separately
per direction; inactive buses keep their index (no range) and remain present in
native ProcessData with null sample pointers.
Scoped processing¶
Instance::with_audio lends the same Send/non-Sync/non-Clone HRTB capability.
Audio::process_hosted::<f32 | f64> takes packed input/output slices, the
unchanged W233 Input (points, events, optional context) and an exclusively
borrowed OutputStorage; the returned Output borrows that storage. Precision,
counts, frames, points, events and context are checked before native calls.
f64 samples are never narrowed. Legacy main-f32 entries refuse a hosted
capability before any native call. A native fault silences valid output prefixes
and retires hosted processing for that scope; stopped re-preparation or a fresh
child is required.
Owned Graph bank¶
hosted_audio::graph::Vst3GraphBankBuilder<S> consumes a MAIN
Library<'static> (static caller-linked tables and executable) and the exact
paired parameter/processing/hosted providers. Children retain the Library
through a private Rc; no borrowed lifetime is erased. node /
node_with_setup add up to 128 children; setup runs on MAIN after creation and
before refresh/preparation (for example stopped state recall). build prepares
every child and captures latency/tail FIRST, then starts every child and begins
every native AUDIO lease LAST. Any start/begin failure ends earlier leases in
reverse before stopping and retiring; no node escapes.
Vst3GraphNode<S> implements Processor<S> with the packed layout, cached
latency/tail and no foreign lifecycle calls: prepare admits only the exact rate,
layout and a block no larger than the prepared one. It is Send, not Sync, and
owns only the native AUDIO handle, static tables, copied profile and prepared
buffers. Sidechain/aux buses are ordinary packed node channels, so Graph's
main-only outer configuration is unchanged.
Dropping a node moves its whole bundle into a dedicated one-slot return ring
whose consumer always stays in the process-lifetime MAIN registry (64 banks,
128 children, nonwrapping generations; bound to the platform main thread on
Apple targets). Vst3GraphBankControl is MAIN-only and disposable: dropping it
marks the bank orphaned while the module, children and leases stay retained.
reclaim_vst3_graph_banks(Some(id) | None) gathers returned bundles without
native calls, then for an orphaned fully returned bank ends ALL leases before any
stop or retirement, then retires children and the Library. A forgotten node,
never-joined worker, refused return slot or failed native end keeps the bank
retained with a diagnostic; nothing is guessed to have ended.
Rich lanes¶
LaneOptions (1..=4 complete owned batches per node, processing ABI limits, a
64 MiB per-bank aggregate budget) selects queued mode. On MAIN,
control.submit(child, frames, fill) fills typed InputEvents, InputPoints
and Context and assigns the next exact sequence; the node consumes exactly one
matching head batch per block and never skips or overwrites one. A missing
batch, sequence/owner or frame mismatch refuses before native mutation and faults
the node with a copied diagnostic. control.receive re-validates the batch's
complete rich output on MAIN and recycles it. No Vec/String/Box is constructed or
dropped on AUDIO. Framework events reach a node only through the explicit
translation below; a node without one refuses non-empty framework events
before native execution.
Framework event translation¶
builder.translate(child, FrameworkTranslation) opts one child in to
translating ordinary RAVET events and block-start transport
(hosted_audio::graph::framework, decision 0273).
Shape and capacity are checked when you call translate. build checks
parameter routes and the note bus against the refreshed catalogue after every
child is prepared and before any child starts or any lease begins. A refusal
is BankError::Translation { child, error } and unwinds like any build error.
Each TranslationError names the failing case and route index (duplicate
graph or native ID, reserved native ID, invalid scale, note bus, capacity,
unknown or read-only parameter). Routes are checked against a catalogue
snapshot taken at build; a later plug-in restart that changes parameter
flags is not revalidated.
| Framework input | VST3 input | Rule |
|---|---|---|
ParameterValue |
IParameterChanges point |
Declared ParameterRoute (graph ID, native ID, Normalized or declared Linear { minimum, maximum }) |
NoteOn / NoteOff |
NoteOnEvent / NoteOffEvent |
noteId -1 under Unidentified; refused under RequireIdentified |
NoteWithId |
NoteOnEvent / NoteOffEvent |
ID kept, 0..=i32::MAX |
NoteExpression (not pressure) |
NoteExpressionValueEvent |
expressions declared; ID-only target; volume /4, tuning /240 + 0.5, others unchanged |
NoteExpression::Pressure |
PolyPressureEvent |
poly_pressure declared; concrete channel and key, optional ID (else -1) |
Transport |
ProcessContext |
transport declared; flags exactly for the fields present |
- Routes. No ID equality is inferred. Graph IDs and native IDs are unique,
with at most 2048 routes. A route must name a writable parameter that is not
hidden. Values outside the declared scale refuse. The plug-in still owns
stepped quantization and any nonlinear mapping; declare a
Normalizedroute for those. - Points. Each value becomes one point at its exact sample offset. Points are never sorted or merged.
- A second value for the same native ID at the same offset follows
same_offset.SameOffsetPolicy::Refuse(the default) refuses the block.LastWinsreplaces the earlier value and counts it as ignored. - The native queue admits at most 64 distinct IDs per block
(
MAXIMUM_PARAMETER_IDS), reported as its own refusal. - Admission is bounded per point. The conflict check scans only the trailing equal-offset run (at most 64 points), and the distinct-ID set is kept incrementally. A full 2048-point block costs at most about 2048 x 128 comparisons.
- Notes. The note bus must be selected in
event_inputs. Channels must be within its channel count. Velocity is copied unchanged. Tuning, length,ppqPositionand flags are zero; nothing is derived from transport. The translator is stateless: a note-off without an earlier note-on is passed through, and the plug-in owns voice state. Once expressions or pressure are declared, a malformed target or value refuses even underIgnore; only undeclared capabilities are ignored. - Transport. All-absent transport passes no context. Otherwise
playingandsample_positionmust both be known, because the SDK has no availability flag for either. The sample position is copied exactly. Present tempo, beats, recording, active loop, signature, bar start and beat loop setkTempoValid,kProjectTimeMusicValid,kRecording,kCycleActive,kTimeSigValid,kBarPositionValidandkCycleValid. Discontinuity, pre-roll, tempo increment, bar number and sample loops are validated but not represented.framework::transport_contextexposes this mapping. Withtransportfalse, transport is not passed and is not counted as ignored. - Policies.
unmapped_parametersandunsupportedare eachRefuseorIgnore.unsupportedcovers MIDI, UMP, modulation, gestures, scoped values and release, choke, completion, notes without a route and undeclared expressions. Ignored events are counted: read them on MAIN withcontrol.ignored(child). - Mixed blocks. In queued mode,
MergePolicy::Refuserefuses a block where both the framework and the lane batch carry events or points.FrameworkFirstandLaneFirstmerge by offset, with that source first at equal offsets; cross-source point conflicts refuse. A context from both sources always refuses. A context from only one source is used. - Capacity.
eventsandpointsare each 0..=2048 per block. Merged storage, needed only by the merging policies, must also fit 2048 alongside the lane batch. All of it is allocated on MAIN and counted in the 64 MiB per-bank budget. AUDIO translation allocates, locks and frees nothing.
Every refusal, including capacity overflow, happens before the plug-in runs. The plug-in is not called and its history does not advance.
- Outputs. The block's outputs are silenced and the node returns
ProcessStatus::Silence, not a fault. - No latch. Neither the node nor an enclosing
ravet_graph::Graphlatches. The Graph reportsGraphStatus::Continueand the next valid block runs. - Reason. The reason is a
framework::Refusal, with a distinct variant for each case: invalid event, unmapped parameter, unsupported kind, same offset, event or point capacity, the 64-ID limit, transport, mixed input, two contexts, merge conflict and merged capacity. - Reporting.
control.refused(child)counts refused blocks.control.drain_refusals(child, f)passes up to 16 unread records tof, oldest first. Further refusals are counted but their details are dropped.diagnostic::FRAMEWORK_REFUSEDordiagnostic::MIXED_REFUSEDis set.- In queued mode, the matching lane batch is consumed and
receivereports it asError::Framework(refusal), so sequences stay aligned.
A Graph status does not carry the refusal. Callers that must react to
refusals poll these on MAIN. Native faults, admission refusals and framework
events sent to a node without a translation still fault and latch, and need a
rebuild. Decision 0273 explains why refusals return Silence.
Tests check every mapping and refusal with the mock provider, including exact
sample offsets and 10,000-cycle zero-allocation runs. An actual caller-linked
consumer loads RAVET Gain and Performance VST3 bundles built from the same tree.
A Gain node driven by framework values 1.0 at sample 0 and 3.0 at sample 11
(declared linear 0..4 route) matches the smoothing reference exactly, changing
first at sample 11. A Performance node driven by NoteWithId, volume and pan
expressions, poly pressure, Level values and transport matches a closed-form
voice (maximum error about 1.1e-10 in f32 and 7.5e-18 in f64). A broadcast
Graph chain, Performance into Gain at 0.5, matches the same reference and
reports the expected ignored counts. A refusing Gain node inside a Graph
silences only the refused block. The Graph reports Continue for every block,
output equals input before and after the refusal, and a later gain change is
applied. The mock provider checks the same over seven Graph blocks with two
refusals. 10,000 variable Graph blocks with
translated events perform zero Rust allocations on AUDIO. The reference
Performance voice does not apply pressure or transport, so those reach the
actual modules without an audible check; the mock provider checks their wire
form.
Checked reset¶
Generic hosted VST3 has no guaranteed SDK history reset. Node try_reset returns
ProcessError::RebuildRequired without foreign calls and the node stays
faulted; legacy reset records the same state. Graph::try_reset reports the
original node and error and remains faulted. Rebuild: stop/join workers, drop
the nodes, reclaim on MAIN, and build a fresh bank.
Limits¶
Explicit unsafe table/code/module trust remains the caller's obligation. Rust allocation counting covers Rust only: foreign SDK/C++ heap, crash isolation and real-time deadlines are not established. Evidence is local macOS arm64 with the authored Gain/Performance references and authored native fixtures; no DAW, third-party plug-in or other-platform support follows. Auxiliary buses and all nine rich input event kinds also have actual-module evidence against the RAVET reference VST3 modules; see vst3-reference-modules.md. Framework event translation is described above. Editors for scoped instances and for Graph-bank children, and controller edit gestures, are described below.