pub struct DspGraph {
pub arena: Arena<NodeRecord>,
pub buffers: BufferPool,
pub execution_order: Vec<NodeId>,
pub levels: Vec<Vec<NodeId>>,
pub output_node: Option<NodeId>,
/* private fields */
}Expand description
The DSP graph. Lives on the RT thread after initial construction.
Fields§
§arena: Arena<NodeRecord>§buffers: BufferPool§execution_order: Vec<NodeId>Topologically sorted execution order. Rebuilt on structural mutations.
levels: Vec<Vec<NodeId>>BFS wave levels: each inner Vec contains nodes that can execute in parallel. Level[i] nodes all depend only on nodes in levels 0..i.
output_node: Option<NodeId>The node whose output buffer is sent to the DAC.
Implementations§
Source§impl DspGraph
impl DspGraph
pub fn new() -> Self
Sourcepub fn add_node(&mut self, processor: Box<dyn DspNode>) -> Option<NodeId>
pub fn add_node(&mut self, processor: Box<dyn DspNode>) -> Option<NodeId>
Add a node to the graph. Returns its NodeId.
Sourcepub fn remove_node(&mut self, id: NodeId) -> bool
pub fn remove_node(&mut self, id: NodeId) -> bool
Remove a node, releasing its buffer.
Sourcepub fn connect(&mut self, src: NodeId, dst: NodeId, slot: usize) -> bool
pub fn connect(&mut self, src: NodeId, dst: NodeId, slot: usize) -> bool
Connect src output → dst input[slot].
Sourcepub fn disconnect(&mut self, dst: NodeId, slot: usize) -> bool
pub fn disconnect(&mut self, dst: NodeId, slot: usize) -> bool
Disconnect dst input[slot].
pub fn set_output_node(&mut self, id: NodeId)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DspGraph
impl !RefUnwindSafe for DspGraph
impl Send for DspGraph
impl !Sync for DspGraph
impl Unpin for DspGraph
impl UnsafeUnpin for DspGraph
impl !UnwindSafe for DspGraph
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