Crate ravet_ graph
Expand description
Prepared acyclic native f32/f64 routing over owned portable processors.
Graph editing/preparation allocate on control threads; rendering/reset use
prepared scratch and delay storage. This scheduler is not a Processor
implementation: a later node’s fault cannot roll back earlier node histories
or parameters. Such faults silence host output and disable the graph until
reset. Invalid outer blocks reject before any node execution.
Structs§
- Connection
- Parallel connections add in declaration order. Gains must be finite.
- Convolution
Transition - Audio-owned transition. Between construction and drop,
processandresetperform no allocation, deallocation, locking, I/O or panic: every engine handed back first has queue capacity reserved (or the one deferred slot), and a completed fade whose engine has nowhere to go keeps that engine as a silent, unprocessed outgoing owner until a later block boundary can return it. - Convolution
Transition Control - Unique control/worker endpoint. Prepare engines, offer them, and take or drop
returned engines here, never on the audio thread.
Sendwhen the engine is. - Crossfade
Policy - Explicit crossfade between old and new engines. Both engines process the same
input for
framesframes starting at the block boundary where the transition starts; each output sample isS(old) * y_old + S(new) * y_newevaluated in the native sample type.frames == 0is an explicit cut: the old engine is retired at that boundary without running. The new engine starts from its own prepared (zero) history; there is no history transfer between engines. - Dynamic
Graph - Audio-owned active graph with one prepared FIFO replacement per valid block. Process/reset never destroy graphs; retired ownership returns to control. Construct and drop both endpoints only outside callbacks. Each graph keeps its own 64 MiB cap; total in-flight graph/node memory is consumer-budgeted.
- Dynamic
Graph Audio Session - Owner-confined dynamic graph session. Stop/drop before engine transfer/drop; do not forget/leak this guard. Retirement remains control-owned.
- Dynamic
Graph Status - Event
Connection - Directed event connection. Duplicate connections deliberately duplicate events. Equal-time ordering follows connection declaration then source event order.
- Graph
- Static graph, at most 128 nodes and 4096 connections. No feedback cycles. Preparation bounds total scratch/delay to 64 MiB (16,777,216 f32 or 8,388,608 f64 values), path latency to 65536 samples, maximum block 65536 and events 1024. Events broadcast by default; explicit filtered routes can include generated node/host events. Storage counts audio and event scratch together. Event offsets are not delayed by audio latency compensation.
- Graph
Audio Session - Borrowed audio-owner graph session; stop/drop before returning the graph to control. Do not forget/leak this guard. Its non-Send/non-Sync marker confines normal Rust rendering/reset/stop to the starting owner. Panics remain caller ABI policy; hooks retain implementor callback obligations.
- Graph
Control - Unique control endpoint. Prepare/offer graphs and reclaim/drop retired graphs outside audio callbacks. Pending and retired queues each have 1..4 slots.
- Graph
Node - Node processor ownership, layout and stable product-defined identity.
- Graph
Offer Error - Rejected graph ownership remains on the control thread.
- Mono
Duplicator - One prepared control object shared by reference and 1..64 separate native histories. The factory returns inactive kernels; successful kernels may own additional caller-defined storage outside the checked 4MiB kernel-Vec payload cap. Effect-only, no events/auxiliary/generated events; construction/preparation are CONTROL. Bypass returns exact dry input and freezes all histories.
- Mono
Factory Failure - Original controls/factory, exact successfully constructed kernel prefix and first factory error. Effects already performed by the factory do not roll back.
- NodeId
- Returned
Engine - An engine handed back for reuse or disposal on the control thread.
- Transition
Continuity - Optional continuity policies for
convolution_transition_with_continuity.TransitionContinuity::NONE(also theDefault) gives exactly the behaviour ofconvolution_transition. - Transition
Offer Error - Refused offer with ownership of the unchanged engine.
- Transition
Options - Fixed transition configuration.
- Transition
Report - One audio-side event delivered to the control owner.
- Transition
Setup Error - Refused construction with ownership of the unchanged initial engine.
- Transition
Status - Per-block audio-side status.
- Typed
Chain - Typed, effect-only serial Graph with 1..8 sealed concrete stages.
- Typed
Chain Audio Session - Canonical non-Send audio-session guard with typed readonly access and bypass.
Finish/drop before CONTROL mutation, extraction or transfer. Do not forget it:
a forgotten guard leaves the audio owner live (see
TypedChain), which is misuse and not a supported way to hand the chain to another thread. - Typed
Chain Failure - No processor is prepared or consumed on an ordinary constructor refusal.
Enums§
- Alignment
Policy - Optional latency alignment between the outgoing and incoming engines (see
convolution_transition_with_continuity). - Crossfade
Law - Crossfade gain law. For fade position
kin0..frames(frames since the fade started) lett = (k + 1) as f64 / frames as f64; the last faded frame hast == 1, so its gains are(0, 1)to rounding (cos(pi/2)is about 6.1e-17 in f64). Gains are computed in f64 once per frame and rounded once to the sample type; in f32 the two rounded gains can differ from their f64 sum by one unit in the last place. - Destination
- Event
Endpoint - Host input/output (according to edge direction), or one stable graph node.
- Event
Filter - Explicit event selection, without protocol conversion or parameter remapping.
- Graph
Error - Graph
Offer Failure - A proposed graph cannot enter the bounded handoff.
- Graph
Status - A node failure can follow successful earlier node execution. Outer errors have node=None and do not execute nodes. All faults clear host outputs.
- Graph
Swap Status - Result of the block-boundary handoff attempt, separate from graph DSP status.
- Latency
Policy - Whether engines with a different algorithmic latency are accepted.
- MidFade
Policy - What happens to a proposal while a fade is in progress.
- Mono
Factory Error - Priming
Policy - Optional history priming of the incoming engine (see
convolution_transition_with_continuity). - Return
Reason - Why an engine was returned to the control owner.
- Source
- Transition
Event - Audio-side transition event.
- Transition
Offer Failure - Why an offer was refused. The caller keeps the engine.
- Transition
Setup Failure - Why construction was refused.
- Typed
Chain Error - Constructor admission failures. The failure retains the exact original tuple.
Constants§
- MAXIMUM_
GRAPH_ EVENTS - Maximum prepared input or generated output events per graph/node block. Queue capacities elsewhere may be larger; they do not raise this render limit.
- TRANSITION_
MAXIMUM_ ALIGNMENT_ FRAMES - Largest accepted
AlignmentPolicy::DelayLowermaximum difference in frames. - TRANSITION_
MAXIMUM_ CONTINUITY_ BYTES - Largest accepted continuity storage (history ring plus both delay lines) in bytes of samples, checked before any allocation.
- TRANSITION_
MAXIMUM_ FADE_ FRAMES - Largest accepted crossfade length in frames.
- TRANSITION_
MAXIMUM_ PRIMING_ FRAMES - Largest accepted
PrimingPolicy::Historylength in frames. - TRANSITION_
REPORT_ CAPACITY - Transition report queue capacity.
- TRANSITION_
RETURN_ CAPACITY - Returned-engine queue capacity (retired, refused and superseded engines).
Traits§
- Graph
Sample - Sealed native graph precision through foundation’s
Samplecontract. Route multiplication and summation retain the selected sample type. - Shared
Mono Kernel - Foreign mono kernel obligations match Processor: finite work, no callback allocation/locks/I/O, prepare failures inactive.
- StageAt
- Statically indexed concrete stage type. Unsupported indices do not implement this trait.
- Stage
Tuple - Sealed heterogeneous processor tuples of arity 1..8. Private-construction permits keep internal owner/wrapper operations inaccessible even when a generic caller has this public supertrait bound.
- Transition
Engine - Sealed set of transitionable engines:
Convolver32,Convolver64,ConvolutionBank32andConvolutionBank64. A single engine is one channel. - Transition
Sample - Sealed native transition precision (
f32orf64).
Functions§
- convolution_
transition - Construct the control and audio endpoints around a prepared initial engine
(CONTROL: allocates three bounded queues, one channel of sample scratch and
per-frame gain scratch).
maximum_frames(1..=initial maximum) bounds every audio call and every later offer. A refusal returns the initial engine unchanged. - convolution_
transition_ with_ continuity convolution_transitionwith explicitTransitionContinuitypolicies (CONTROL). Additionally prepares, before returning, a history ring ofchannels * framessamples forPrimingPolicy::Historyand two delay lines ofchannels * (maximum_difference + maximum_frames)samples forAlignmentPolicy::DelayLower. All lengths and the total (TRANSITION_MAXIMUM_CONTINUITY_BYTES) are checked before any allocation, storage is reserved fallibly, and a refusal returns the initial engine unchanged.TransitionContinuity::NONEallocates nothing extra and behaves exactly likeconvolution_transition.