pub trait SignalNode<T, const BUF_SIZE: usize>: Send + Syncwhere
T: Transcendental,{
Show 26 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,
) -> Result<(), ProcessError>;
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: Sized + 'static { ... }
fn apply_set_parameter(
&mut self,
cmd: &SetParameter,
) -> Result<(), ProcessError> { ... }
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 audio nodes
This trait provides the fundamental operations that every node must implement:
- Port counting
- Parameter access
- Initialization and reset
The actual processing is split into specialized traits:
Sourcefor generatorsProcessorfor processors with inputs/outputsSinkfor consumers
Required Methods§
Sourcefn metadata(&self) -> NodeMetadata
fn metadata(&self) -> NodeMetadata
Get node metadata
Sourcefn get_parameter(&self, id: &ParameterId) -> Option<ParamValue>
fn get_parameter(&self, id: &ParameterId) -> Option<ParamValue>
Get the value of a parameter
Sourcefn set_parameter(
&mut self,
id: &ParameterId,
value: ParamValue,
) -> Result<(), ProcessError>
fn set_parameter( &mut self, id: &ParameterId, value: ParamValue, ) -> Result<(), ProcessError>
Set the value of a parameter
Sourcefn input_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>
fn input_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>
Get input port by index
Sourcefn input_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
fn input_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
Get mutable input port by index
Sourcefn output_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>
fn output_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>
Get output port by index
Sourcefn output_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
fn output_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
Get mutable output port by index
Sourcefn control_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>
fn control_port(&self, index: usize) -> Option<&Port<T, BUF_SIZE>>
Get control port by index
Sourcefn control_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
fn control_port_mut(&mut self, index: usize) -> Option<&mut Port<T, BUF_SIZE>>
Get mutable control port by index
Provided Methods§
Sourcefn node_type_id(&self) -> NodeTypeIdwhere
Self: Sized + 'static,
fn node_type_id(&self) -> NodeTypeIdwhere
Self: Sized + 'static,
Get the node’s type ID
Sourcefn apply_set_parameter(
&mut self,
cmd: &SetParameter,
) -> Result<(), ProcessError>
fn apply_set_parameter( &mut self, cmd: &SetParameter, ) -> Result<(), ProcessError>
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.
Sourcefn num_signal_inputs(&self) -> usize
fn num_signal_inputs(&self) -> usize
Number of signal input ports
Sourcefn num_signal_outputs(&self) -> usize
fn num_signal_outputs(&self) -> usize
Number of signal output ports
Sourcefn num_control_inputs(&self) -> usize
fn num_control_inputs(&self) -> usize
Number of control input ports
Sourcefn num_control_outputs(&self) -> usize
fn num_control_outputs(&self) -> usize
Number of control output ports
Sourcefn num_clock_inputs(&self) -> usize
fn num_clock_inputs(&self) -> usize
Number of clock input ports
Sourcefn num_clock_outputs(&self) -> usize
fn num_clock_outputs(&self) -> usize
Number of clock output ports
Sourcefn num_feedback_ports(&self) -> usize
fn num_feedback_ports(&self) -> usize
Number of feedback ports
Sourcefn num_inputs(&self) -> usize
fn num_inputs(&self) -> usize
Total number of input ports
Sourcefn num_outputs(&self) -> usize
fn num_outputs(&self) -> usize
Total number of output ports