pub struct AudioGraph { /* private fields */ }Expand description
Clip chain -> track bus -> master bus graph with deterministic latency aggregation.
Each bus is delayed to the longest clip-and-track latency before the mix, so output is input
delayed by exactly Self::latency_samples regardless of where lookahead sits.
Implementations§
Source§impl AudioGraph
impl AudioGraph
Sourcepub fn new(layout: ChannelLayout, buses: usize) -> Self
pub fn new(layout: ChannelLayout, buses: usize) -> Self
Creates one clip chain and one track bus per input bus.
Sourcepub const fn layout(&self) -> ChannelLayout
pub const fn layout(&self) -> ChannelLayout
Channel layout every bus and the master run in.
Sourcepub fn buses(&self) -> usize
pub fn buses(&self) -> usize
Number of input buses, each with its own clip chain and track bus.
Sourcepub fn clip_chain_mut(&mut self, bus: usize) -> Option<&mut ProcessorChain>
pub fn clip_chain_mut(&mut self, bus: usize) -> Option<&mut ProcessorChain>
Mutable clip effect chain of bus; None past the last bus.
Sourcepub fn track_bus_mut(&mut self, bus: usize) -> Option<&mut ProcessorChain>
pub fn track_bus_mut(&mut self, bus: usize) -> Option<&mut ProcessorChain>
Mutable track effect chain of bus; None past the last bus.
Sourcepub fn master_mut(&mut self) -> &mut ProcessorChain
pub fn master_mut(&mut self) -> &mut ProcessorChain
Mutable master effect chain.
Sourcepub fn prepare(&mut self, sample_rate: u32, max_block: usize)
pub fn prepare(&mut self, sample_rate: u32, max_block: usize)
Prepares every allocation before realtime processing.
Sourcepub fn latency_samples(&self) -> u32
pub fn latency_samples(&self) -> u32
Maximum bus latency plus master latency.
Sourcepub fn process(
&mut self,
ctx: &ProcessCtx,
inputs: &[&[f32]],
outputs: &mut [&mut [f32]],
)
pub fn process( &mut self, ctx: &ProcessCtx, inputs: &[&[f32]], outputs: &mut [&mut [f32]], )
Mixes flattened planar bus inputs (bus0-L, bus0-R, bus1-L, ...) over the shortest output
channel. Short buses are padded with silence and long blocks run in pieces. With missing
channels or no Self::prepare, the outputs are silenced.
Sourcepub fn save_state(&self) -> AudioGraphState
pub fn save_state(&self) -> AudioGraphState
Captures every chain’s history and the alignment delays.
Sourcepub fn load_state(
&mut self,
state: &AudioGraphState,
) -> Result<(), GraphStateError>
pub fn load_state( &mut self, state: &AudioGraphState, ) -> Result<(), GraphStateError>
Restores a state saved by a graph of the same buses, chains and preparation, atomically.
§Errors
Returns where and why the state was refused.