pub struct NodeRecord {
pub processor: Box<dyn DspNode>,
pub inputs: [Option<NodeId>; 8],
pub output_buffer: BufferId,
pub params: ParamBlock,
}Expand description
Graph-level node record. Stored in the arena.
Each node in the DSP graph is represented by a NodeRecord stored in the
arena. The record contains the DSP processor, input connections, output
buffer, and parameters.
§Structure
- processor: The DSP implementation (boxed trait object)
- inputs: Array of input connections (NodeId or None)
- output_buffer: Buffer ID where this node writes output
- params: Parameter block for smoothed parameter automation
§Memory Layout
The processor is heap-allocated (Box) at node creation time, not during audio processing. All other fields are inline in the arena slot.
§Example
use aether_core::node::{NodeRecord, DspNode};
use aether_core::buffer_pool::{BufferPool, BufferId};
use aether_core::param::ParamBlock;
use aether_core::{BUFFER_SIZE, MAX_INPUTS};
// Custom node implementation
struct Gain { gain: f32 }
impl DspNode for Gain {
fn process(
&mut self,
inputs: &[Option<&[f32; BUFFER_SIZE]>; MAX_INPUTS],
output: &mut [f32; BUFFER_SIZE],
_params: &mut ParamBlock,
_sample_rate: f32,
) {
if let Some(input) = inputs[0] {
for (i, out) in output.iter_mut().enumerate() {
*out = input[i] * self.gain;
}
}
}
fn type_name(&self) -> &'static str {
"Gain"
}
}
// Create node record
let mut pool = BufferPool::new(10);
let buffer = pool.acquire().unwrap();
let processor = Box::new(Gain { gain: 0.5 });
let record = NodeRecord::new(processor, buffer);§Lifecycle
- Creation: Allocated in arena when
AddNodecommand is processed - Processing:
processor.process()called each audio block - Removal: Dropped when
RemoveNodecommand is processed
§See Also
Fields§
§processor: Box<dyn DspNode>The DSP implementation (boxed, allocated at node creation time — not in RT).
inputs: [Option<NodeId>; 8]Input connections: each slot holds the NodeId of the upstream node.
output_buffer: BufferIdThe buffer this node writes its output into.
params: ParamBlockParameter block for this node.
Implementations§
Auto Trait Implementations§
impl Freeze for NodeRecord
impl !RefUnwindSafe for NodeRecord
impl Send for NodeRecord
impl !Sync for NodeRecord
impl Unpin for NodeRecord
impl UnsafeUnpin for NodeRecord
impl !UnwindSafe for NodeRecord
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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