Skip to main content

Node

Trait Node 

Source
pub trait Node<T: Transcendental, const BUF_SIZE: usize> {
Show 29 methods // Required methods fn metadata(&self) -> NodeMetadata; fn init(&mut self, sample_rate: f32); fn reset(&mut self); fn get_parameter(&self, id: &ParameterId) -> Option<ParamValue>; fn set_parameter( &mut self, id: &ParameterId, value: ParamValue, ) -> ProcessResult<()>; fn id(&self) -> NodeId; fn set_id(&mut self, id: NodeId); fn input_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>; fn input_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>; fn output_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>; fn output_port_mut( &mut self, index: usize, ) -> Option<&mut Port<T, BUF_SIZE>>; fn control_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>; fn control_port_mut( &mut self, index: usize, ) -> Option<&mut Port<T, BUF_SIZE>>; fn state(&self) -> &NodeState<T, BUF_SIZE>; fn state_mut(&mut self) -> &mut NodeState<T, BUF_SIZE>; // Provided methods fn node_type_id(&self) -> NodeTypeId where Self: 'static + Sized { ... } fn apply_set_parameter(&mut self, cmd: &SetParameter) -> ProcessResult<()> { ... } fn resolve_resources(&mut self, _buffers: &BufferRegistry<T>) { ... } fn as_io_node_mut(&mut self) -> Option<&mut dyn IoNode<T, BUF_SIZE>> { ... } fn as_active_node_mut(&mut self) -> Option<&mut dyn ActiveNode<T, BUF_SIZE>> { ... } fn num_signal_inputs(&self) -> usize { ... } fn num_signal_outputs(&self) -> usize { ... } fn num_control_inputs(&self) -> usize { ... } fn num_control_outputs(&self) -> usize { ... } fn num_clock_inputs(&self) -> usize { ... } fn num_clock_outputs(&self) -> usize { ... } fn num_feedback_ports(&self) -> usize { ... } fn num_inputs(&self) -> usize { ... } fn num_outputs(&self) -> usize { ... }
}
Expand description

Base trait for all signal nodes

This trait provides the fundamental operations that every node must implement:

  • Port counting
  • Parameter access
  • Initialization and reset
  • Optional telemetry sender

The actual processing is split into specialized traits:

  • Source for generators
  • Processor for processors with inputs/outputs
  • Sink for consumers

Required Methods§

Source

fn metadata(&self) -> NodeMetadata

Get node metadata

Source

fn init(&mut self, sample_rate: f32)

Initialize the node with a sample rate

Source

fn reset(&mut self)

Reset the node to its initial state

Source

fn get_parameter(&self, id: &ParameterId) -> Option<ParamValue>

Get the value of a parameter

Source

fn set_parameter( &mut self, id: &ParameterId, value: ParamValue, ) -> ProcessResult<()>

Set the value of a parameter

Source

fn id(&self) -> NodeId

Get node ID

Source

fn set_id(&mut self, id: NodeId)

Set node ID

Source

fn input_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>

Get input port by index

Source

fn input_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>

Get mutable input port by index

Source

fn output_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>

Get output port by index

Source

fn output_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>

Get mutable output port by index

Source

fn control_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>

Get control port by index

Source

fn control_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>

Get mutable control port by index

Source

fn state(&self) -> &NodeState<T, BUF_SIZE>

Get node state

Source

fn state_mut(&mut self) -> &mut NodeState<T, BUF_SIZE>

Get mutable node state

Provided Methods§

Source

fn node_type_id(&self) -> NodeTypeId
where Self: 'static + Sized,

Get the node’s type ID

Source

fn apply_set_parameter(&mut self, cmd: &SetParameter) -> ProcessResult<()>

Apply a SetParameter command to this node.

Routes the command to the appropriate port based on cmd.port. Falls back to set_parameter() when the port is not found.

Source

fn resolve_resources(&mut self, _buffers: &BufferRegistry<T>)

Resolve named resource buffers (tape loops, etc.) from the registry.

Source

fn as_io_node_mut(&mut self) -> Option<&mut dyn IoNode<T, BUF_SIZE>>

Downcast to IoNode if this node implements it.

Source

fn as_active_node_mut(&mut self) -> Option<&mut dyn ActiveNode<T, BUF_SIZE>>

Downcast to ActiveNode if this node implements it.

Source

fn num_signal_inputs(&self) -> usize

Number of signal input ports

Source

fn num_signal_outputs(&self) -> usize

Number of signal output ports

Source

fn num_control_inputs(&self) -> usize

Number of control input ports

Source

fn num_control_outputs(&self) -> usize

Number of control output ports

Source

fn num_clock_inputs(&self) -> usize

Number of clock input ports

Source

fn num_clock_outputs(&self) -> usize

Number of clock output ports

Source

fn num_feedback_ports(&self) -> usize

Number of feedback ports

Source

fn num_inputs(&self) -> usize

Total number of input ports

Source

fn num_outputs(&self) -> usize

Total number of output ports

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Transcendental, const BUF_SIZE: usize> Node<T, BUF_SIZE> for NodeVariant<T, BUF_SIZE>