AUDIO
Source snapshot · 12 October 2026

API reference / ravet_graph::Graph

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>

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>

pub fn new( layout: AudioLayout, nodes: Vec<GraphNode<S>>, connections: &[Connection<S>], ) -> Result<Self, GraphError>

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>

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

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)

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>

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.

pub fn deactivate(&mut self)

Trait Implementations§

§

impl<S: GraphSample> Drop for Graph<S>

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<S = f32> !RefUnwindSafe for Graph<S>

§

impl<S = f32> !Sync for Graph<S>

§

impl<S = f32> !UnwindSafe for Graph<S>

§

impl<S> Freeze for Graph<S>

§

impl<S> Send for Graph<S>

§

impl<S> Unpin for Graph<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Graph<S>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.