pub struct GraphBuilder<T: Transcendental, const BUF_SIZE: usize> { /* private fields */ }Expand description
Mutable builder for an immutable signal graph.
Implementations§
Source§impl<T: Transcendental, const BUF_SIZE: usize> GraphBuilder<T, BUF_SIZE>
impl<T: Transcendental, const BUF_SIZE: usize> GraphBuilder<T, BUF_SIZE>
Sourcepub fn add_node(&mut self, type_name: &str, params: &Params) -> usize
pub fn add_node(&mut self, type_name: &str, params: &Params) -> usize
Add a node by type name.
Returns the index of the newly added node.
Sourcepub fn add_node_with_id(
&mut self,
type_name: &str,
params: &Params,
id: u32,
) -> usize
pub fn add_node_with_id( &mut self, type_name: &str, params: &Params, id: u32, ) -> usize
Add a node with an explicit NodeId.
Sourcepub fn add_node_with_name(
&mut self,
type_name: &str,
params: &Params,
id: u32,
name: String,
) -> usize
pub fn add_node_with_name( &mut self, type_name: &str, params: &Params, id: u32, name: String, ) -> usize
Add a node with an explicit NodeId and a human-readable name
(typically sourced from the JSON name field). The name becomes the
program/anchor name in the compiled graph, used by SetParameter routing.
Sourcepub fn add_routing_entry(
&mut self,
idx: usize,
from: usize,
to: usize,
gain: f32,
)
pub fn add_routing_entry( &mut self, idx: usize, from: usize, to: usize, gain: f32, )
Store a routing matrix entry to be applied at build time.
Sourcepub fn add_resource(&mut self, resource: GraphResource)
pub fn add_resource(&mut self, resource: GraphResource)
Register a named resource (tape loop, buffer, etc.).
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes added to the builder so far.
Sourcepub fn set_sample_rate(&mut self, sr: f32)
pub fn set_sample_rate(&mut self, sr: f32)
Set the sample rate for this builder.
Sourcepub fn set_parent_ref(&mut self, parent: ActorRef<CommandEnum>)
pub fn set_parent_ref(&mut self, parent: ActorRef<CommandEnum>)
Set the parent RackCase actor reference (Graph → parent ClockTick).
Sourcepub fn connect_signal(
&mut self,
from_node: usize,
from_port: usize,
to_node: usize,
to_port: usize,
)
pub fn connect_signal( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )
Connect signal ports.
Sourcepub fn connect_control(
&mut self,
from_node: usize,
from_port: usize,
to_node: usize,
to_port: usize,
)
pub fn connect_control( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )
Connect control ports (modulation values).
Sourcepub fn connect_clock(
&mut self,
from_node: usize,
from_port: usize,
to_node: usize,
to_port: usize,
)
pub fn connect_clock( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )
Connect clock ports (timing events).
Sourcepub fn connect_feedback(
&mut self,
from_node: usize,
from_port: usize,
to_node: usize,
to_port: usize,
)
pub fn connect_feedback( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )
Connect feedback ports (delay lines, state carryover).
Sourcepub fn build_ir(self, registry: &Registry<T>) -> Result<GraphIr, BuildError>
pub fn build_ir(self, registry: &Registry<T>) -> Result<GraphIr, BuildError>
Build a rill_lang::graph_ir::GraphIr using the built-in Registry.
This is the new execution path. It looks up each node type in the registry, constructs placeholder IRs, and performs topological sort. Actual compilation to executable programs happens in a future phase.
Sourcepub fn ast_from_def(
&self,
registry: &Registry<T>,
) -> Result<Program, BuildError>
pub fn ast_from_def( &self, registry: &Registry<T>, ) -> Result<Program, BuildError>
Convert the graph to an rill-lang AST Program.
Each graph node becomes an Expr::Apply with parameters ordered
according to the builtin’s BuiltinSig::param_names. Nodes are
chained via BinOp::Seq according to their signal connections.
Only simple chain topologies are supported (fan-out/fan-in will
return BuildError::UnsupportedTopology).
Sourcepub fn compile_def<const BUF: usize>(
&self,
registry: &Registry<T>,
sample_rate: f32,
) -> Result<CompiledGraphEngine<T, BUF>, BuildError>
pub fn compile_def<const BUF: usize>( &self, registry: &Registry<T>, sample_rate: f32, ) -> Result<CompiledGraphEngine<T, BUF>, BuildError>
Compile directly from the graph definition to a CompiledGraphEngine.
Calls ast_from_def followed by rill-lang compilation.