Skip to main content

MixerNode

Struct MixerNode 

Source
pub struct MixerNode<const BUF_SIZE: usize> {
Show 17 fields pub master_volume: f32, pub smoothing: f32, pub channels: Vec<ChannelState>, pub channel_names: HashMap<String, usize>, pub buses: Vec<Vec<f32>>, pub sends: Vec<Vec<SendConfig>>, pub current_master_volume: f32, pub buffer_size: usize, pub sample_rate: f32, pub control_values: Vec<f32>, pub param_ids: HashMap<String, ParameterId>, pub after_param_change_closure: fn(&mut Self, &str, f32), pub id: NodeId, pub input_ports: Vec<Port<f32, BUF_SIZE>>, pub output_ports: Vec<Port<f32, BUF_SIZE>>, pub control_ports: Vec<Port<f32, BUF_SIZE>>, pub state: NodeState<f32, BUF_SIZE>,
}
Expand description

Mixer node with multiple channels and aux sends

Fields§

§master_volume: f32

Master volume (0.0 - 2.0)

§smoothing: f32

Smoothing factor (0.0 - 1.0)

§channels: Vec<ChannelState>

Channels

§channel_names: HashMap<String, usize>

Channel names for parameter lookup

§buses: Vec<Vec<f32>>

Aux buses (each bus accumulates signals from sends)

§sends: Vec<Vec<SendConfig>>

Send configurations per channel

§current_master_volume: f32

Current master volume with smoothing

§buffer_size: usize

Buffer size for buses (updated each block)

§sample_rate: f32

Sample rate

§control_values: Vec<f32>

Control input values (updated from graph)

§param_ids: HashMap<String, ParameterId>

Parameter IDs for automation

§after_param_change_closure: fn(&mut Self, &str, f32)

Optional hook called after a parameter changes

§id: NodeId

Node ID

§input_ports: Vec<Port<f32, BUF_SIZE>>

Audio input ports

§output_ports: Vec<Port<f32, BUF_SIZE>>

Audio output ports

§control_ports: Vec<Port<f32, BUF_SIZE>>

Control ports

§state: NodeState<f32, BUF_SIZE>

Node state

Implementations§

Source§

impl<const BUF_SIZE: usize> MixerNode<BUF_SIZE>

Source

pub fn new(num_channels: usize, num_buses: usize) -> Self

Create a new mixer with specified number of channels and buses

Source

pub fn num_inputs(&self) -> usize

Number of audio inputs (channels)

Source

pub fn num_outputs(&self) -> usize

Number of audio outputs (master L/R + buses)

Source

pub fn get_param(&self, name: &str) -> Option<ParamValue>

Get parameter value by name (convenience wrapper)

Source

pub fn set_param(&mut self, name: &str, value: ParamValue) -> ProcessResult<()>

Set parameter value by name (convenience wrapper)

Source

pub fn add_channel(&mut self, config: ChannelConfig) -> usize

Add a channel

Source

pub fn remove_channel(&mut self, index: usize) -> Result<(), ProcessError>

Remove a channel by index

Source

pub fn add_send( &mut self, channel_index: usize, send: SendConfig, ) -> Result<(), ProcessError>

Add a send from a channel to a bus

Source

pub fn clear_sends(&mut self, channel_index: usize) -> Result<(), ProcessError>

Clear sends for a channel

Source

pub fn set_channel_volume( &mut self, channel_index: usize, volume: f32, ) -> Result<(), ProcessError>

Set channel volume

Source

pub fn set_channel_pan( &mut self, channel_index: usize, pan: f32, ) -> Result<(), ProcessError>

Set channel pan

Source

pub fn set_channel_mute( &mut self, channel_index: usize, mute: bool, ) -> Result<(), ProcessError>

Set channel mute

Source

pub fn set_master_volume(&mut self, volume: f32)

Set master volume

Source

pub fn set_smoothing(&mut self, factor: f32)

Set smoothing factor

Trait Implementations§

Source§

impl<const BUF_SIZE: usize> Node<f32, BUF_SIZE> for MixerNode<BUF_SIZE>

Source§

fn metadata(&self) -> NodeMetadata

Get node metadata
Source§

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

Get the node’s type ID
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<f32, BUF_SIZE>>

Get input port by index
Source§

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

Get mutable input port by index
Source§

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

Get output port by index
Source§

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

Get mutable output port by index
Source§

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

Get control port by index
Source§

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

Get mutable control port by index
Source§

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

Get node state
Source§

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

Get mutable node state
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 apply_set_parameter( &mut self, cmd: &SetParameter, ) -> Result<(), ProcessError>

Apply a SetParameter command to this node. Read more
Source§

fn resolve_resources(&mut self, _resources: &mut ResourceRegistry<T>)

Resolve named shared resources (tape loops, etc.) from the registry, acquiring the capability handle matching this node’s role.
Source§

fn num_inputs(&self) -> usize

Total number of input ports
Source§

fn num_outputs(&self) -> usize

Total number of output ports
Source§

impl<const BUF_SIZE: usize> Router<f32, BUF_SIZE> for MixerNode<BUF_SIZE>

Source§

fn route( &mut self, ctx: &RenderContext, _inputs: &[&[f32; BUF_SIZE]], ) -> ProcessResult<()>

Route one block. Read more
Source§

fn num_route_inputs(&self) -> usize

Number of input ports for routing.
Source§

fn num_route_outputs(&self) -> usize

Number of output ports for routing.
Source§

fn set_connection( &mut self, from: usize, to: usize, gain: f32, ) -> ProcessResult<()>

Set up a connection: route input from to output to with gain coefficient gain.
Source§

fn remove_connection(&mut self, from: usize, to: usize) -> ProcessResult<()>

Remove a connection (zero the coefficient).
Source§

fn routing_matrix(&self) -> Vec<Vec<(usize, f32)>>

Get the current routing matrix: for each output — a list of inputs with gains.

Auto Trait Implementations§

§

impl<const BUF_SIZE: usize> !RefUnwindSafe for MixerNode<BUF_SIZE>

§

impl<const BUF_SIZE: usize> !UnwindSafe for MixerNode<BUF_SIZE>

§

impl<const BUF_SIZE: usize> Freeze for MixerNode<BUF_SIZE>

§

impl<const BUF_SIZE: usize> Send for MixerNode<BUF_SIZE>

§

impl<const BUF_SIZE: usize> Sync for MixerNode<BUF_SIZE>

§

impl<const BUF_SIZE: usize> Unpin for MixerNode<BUF_SIZE>

§

impl<const BUF_SIZE: usize> UnsafeUnpin for MixerNode<BUF_SIZE>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V