MCPcopy Create free account
hub / github.com/BillyDM/Firewheel / add_node

Method add_node

crates/firewheel-graph/src/graph.rs:196–222  ·  view source on GitHub ↗

Add a node to the audio graph.

(
        &mut self,
        node: T,
        config: Option<T::Configuration>,
    )

Source from the content-addressed store, hash-verified

194
195 /// Add a node to the audio graph.
196 pub fn add_node<T: AudioNode + 'static>(
197 &mut self,
198 node: T,
199 config: Option<T::Configuration>,
200 ) -> Result<NodeID, NodeError> {
201 let constructor = Constructor::new(node, config);
202 let info: AudioNodeInfoInner = constructor.info()?.into();
203 let call_update_method = info.call_update_method;
204
205 let new_id = NodeID(
206 self.nodes
207 .insert(NodeEntry::new(info, Box::new(constructor))),
208 );
209 self.nodes[new_id.0].id = new_id;
210
211 if call_update_method {
212 self.nodes_to_call_update_method.push(new_id);
213 }
214
215 self.needs_compile = true;
216
217 if let Some(guard) = self.modify_guard_stack.last_mut() {
218 guard.new_nodes.push(new_id);
219 }
220
221 Ok(new_id)
222 }
223
224 /// Add a node to the audio graph which implements the type-erased [`DynAudioNode`] trait.
225 pub fn add_dyn_node<T: DynAudioNode + 'static>(

Callers 2

clap_drop_orderingFunction · 0.45
add_dummy_nodeFunction · 0.45

Calls 4

NodeIDClass · 0.85
infoMethod · 0.45
insertMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected