Struct Graph
pub struct Graph<S: GraphSample = f32> { /* private fields */ }Expand description
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.
Implementations§
§impl<S: GraphSample> Graph<S>
impl<S: GraphSample> Graph<S>
pub fn set_event_routes(
&mut self,
connections: &[EventConnection],
) -> Result<(), GraphError>
pub fn set_event_routes( &mut self, connections: &[EventConnection], ) -> Result<(), GraphError>
Select explicit event routing while inactive, replacing default input broadcast. Empty routes deliver no events. Combined audio/event cycles reject before replacing the current routes/order. At most 4096 edges. Event offsets remain unchanged; audio latency delays do not delay events.
§impl<S: GraphSample> Graph<S>
impl<S: GraphSample> Graph<S>
pub fn new( layout: AudioLayout, nodes: Vec<GraphNode<S>>, connections: &[Connection<S>], ) -> Result<Self, GraphError>
pub fn prepare(&mut self, config: ProcessConfig) -> Result<(), PrepareError>
pub fn prepare(&mut self, config: ProcessConfig) -> Result<(), PrepareError>
Prepare all nodes and compensate differing route arrival latencies. Active sessions reject before changes. Other failure deactivates all nodes and leaves graph inactive. No automatic sample conversion, bus expansion, dynamic graph edit or tail draining.
pub fn start_audio(&mut self) -> Result<GraphAudioSession<'_, S>, GraphStatus>
pub fn start_audio(&mut self) -> Result<GraphAudioSession<'_, S>, GraphStatus>
Enter an explicit audio-owner session after control-thread preparation. Start nodes in topological order; failed start rolls earlier nodes back in reverse order and faults the graph until reset. The non-Send guard renders/resets here, then stops all nodes before graph transfer/deactivation. Default portable hooks are no-ops; ordinary process() behavior is unchanged.
pub fn latency_samples(&self) -> u32
pub fn tail(&self) -> Tail
pub fn process(
&mut self,
block: &mut ProcessBlock<'_, '_, '_, S>,
) -> GraphStatus
pub fn process( &mut self, block: &mut ProcessBlock<'_, '_, '_, S>, ) -> GraphStatus
Render all nodes topologically. Unconnected inputs are zero, routes add in declaration order, output channel aliases are handled by input copying. A node fault disables later execution until reset; preceding histories and requested values cannot be rolled back. Panics are the caller’s ABI boundary.
pub fn reset(&mut self)
pub fn reset(&mut self)
Clear all node histories and route delays, re-enabling a faulted graph. Requested parameters are preserved by each node’s reset contract.
pub fn try_reset(&mut self) -> Result<(), GraphStatus>
pub fn try_reset(&mut self) -> Result<(), GraphStatus>
Reset in execution order, remaining faulted on any refusal. Earlier nodes may already have reset; history changes cannot roll back. Route delays and the fault latch clear only after whole success.