pub enum Command {
AddNode {
id: NodeId,
},
RemoveNode {
id: NodeId,
},
Connect {
src: NodeId,
dst: NodeId,
slot: usize,
},
Disconnect {
dst: NodeId,
slot: usize,
},
UpdateParam {
node: NodeId,
param_index: usize,
new_param: Param,
},
SetOutputNode {
id: NodeId,
},
SetMute {
muted: bool,
},
ClearGraph,
}Expand description
All mutations the control thread can request.
Commands are sent from the control thread (UI, MIDI handler, etc.) to the real-time audio thread via an SPSC ring buffer. The audio thread drains commands at the start of each processing block.
§Design
- Lock-free: Commands are sent via SPSC ring buffer (no locks)
- Bounded: Max
MAX_COMMANDS_PER_TICKprocessed per audio block - Clone: Commands are cloned when sent (cheap - no heap allocations)
- Real-time safe: All command processing is bounded and allocation-free
§Example
use aether_core::command::Command;
use aether_core::arena::NodeId;
// Control thread sends commands
let cmd = Command::AddNode {
id: NodeId { index: 0, generation: 1 }
};
// Audio thread receives and processes
match cmd {
Command::AddNode { id } => {
// Add node to graph
}
_ => {}
}§Command Processing
Commands are processed in FIFO order. The audio thread processes up to
MAX_COMMANDS_PER_TICK commands per block to bound latency impact.
§See Also
Scheduler::process_block- Drains commandsDspGraph- Executes commands
Variants§
AddNode
Add a new node to the graph.
The node must already exist in the arena. This command makes it visible to the scheduler for processing.
§Fields
id- Node ID in the arena
§Example
use aether_core::command::Command;
use aether_core::arena::NodeId;
let cmd = Command::AddNode {
id: NodeId { index: 0, generation: 1 }
};RemoveNode
Remove a node from the graph and release its buffer.
The node is removed from the processing order and its output buffer is returned to the pool. All connections to/from this node are automatically disconnected.
§Fields
id- Node ID to remove
§Example
use aether_core::command::Command;
use aether_core::arena::NodeId;
let cmd = Command::RemoveNode {
id: NodeId { index: 0, generation: 1 }
};Connect
Connect output of src to input slot slot of dst.
Creates an audio connection between two nodes. The output of src
will be routed to input slot slot of dst. If the slot is already
connected, the old connection is replaced.
§Fields
src- Source node ID (output)dst- Destination node ID (input)slot- Input slot index (0 to MAX_INPUTS-1)
§Example
use aether_core::command::Command;
use aether_core::arena::NodeId;
let osc = NodeId { index: 0, generation: 1 };
let filter = NodeId { index: 1, generation: 1 };
// Connect oscillator output to filter input slot 0
let cmd = Command::Connect {
src: osc,
dst: filter,
slot: 0,
};Disconnect
Disconnect input slot slot of dst.
Removes the connection to the specified input slot. The slot will receive silence (None) in subsequent processing.
§Fields
dst- Destination node IDslot- Input slot index to disconnect
§Example
use aether_core::command::Command;
use aether_core::arena::NodeId;
let filter = NodeId { index: 1, generation: 1 };
// Disconnect input slot 0
let cmd = Command::Disconnect {
dst: filter,
slot: 0,
};UpdateParam
Update a parameter with a new smoothed value.
Changes a node parameter with automatic smoothing to avoid clicks. The parameter will ramp from its current value to the new target over the configured smoothing time.
§Fields
node- Node ID to updateparam_index- Parameter index (0-based)new_param- New parameter with target value and smoothing
§Example
use aether_core::command::Command;
use aether_core::arena::NodeId;
use aether_core::param::Param;
let filter = NodeId { index: 1, generation: 1 };
// Update filter cutoff to 1000 Hz
let cmd = Command::UpdateParam {
node: filter,
param_index: 0,
new_param: Param::new(1000.0),
};SetOutputNode
Swap the output node.
Designates a new node as the graph output. The output node’s buffer is copied to the final output buffer each processing block.
§Fields
id- Node ID to use as output
§Example
use aether_core::command::Command;
use aether_core::arena::NodeId;
let master = NodeId { index: 5, generation: 1 };
let cmd = Command::SetOutputNode { id: master };SetMute
Mute / unmute all audio output.
When muted, the output buffer is filled with silence regardless of graph processing. Processing continues normally - only the final output is silenced.
§Fields
muted- true to mute, false to unmute
§Example
use aether_core::command::Command;
// Mute output
let cmd = Command::SetMute { muted: true };
// Unmute output
let cmd = Command::SetMute { muted: false };ClearGraph
Remove all nodes and edges — silence the graph.
Clears the entire graph, removing all nodes and connections. All buffers are released back to the pool. The graph is left in an empty state.
§Example
use aether_core::command::Command;
let cmd = Command::ClearGraph;Trait Implementations§
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more