Struct AudioGraph

Source
pub struct AudioGraph<C> { /* private fields */ }

Implementations§

Source§

impl<C: 'static> AudioGraph<C>

Source

pub fn max_block_frames(&self) -> usize

Source

pub fn graph_in_node(&self) -> NodeID

The ID of the graph input node

Source

pub fn graph_out_node(&self) -> NodeID

The ID of the graph output node

Source

pub fn add_node( &mut self, num_inputs: usize, num_outputs: usize, node: impl AudioNode<C>, ) -> NodeID

Add a new [Node] the the audio graph.

This will return the globally unique ID assigned to this node.

Source

pub fn node(&self, node_id: NodeID) -> Option<&Box<dyn AudioNode<C>>>

Get an immutable reference to the node.

This will return None if a node with the given ID does not exist in the graph.

Source

pub fn node_mut( &mut self, node_id: NodeID, ) -> Option<&mut Box<dyn AudioNode<C>>>

Get a mutable reference to the node.

This will return None if a node with the given ID does not exist in the graph.

Source

pub fn node_info(&self, node_id: NodeID) -> Option<&NodeEntry<NodeWeight<C>>>

Get info about a node.

This will return None if a node with the given ID does not exist in the graph.

Source

pub fn remove_node(&mut self, node_id: NodeID) -> Result<Vec<EdgeID>, ()>

Remove the given node from the graph.

This will automatically remove all edges from the graph that were connected to this node.

On success, this returns a list of all edges that were removed from the graph as a result of removing this node.

This will return an error if a node with the given ID does not exist in the graph, or if the ID is of the graph input or graph output node.

Source

pub fn nodes<'a>(&'a self) -> impl Iterator<Item = &'a NodeEntry<NodeWeight<C>>>

Get a list of all the existing nodes in the graph.

Source

pub fn edges<'a>(&'a self) -> impl Iterator<Item = &'a Edge>

Get a list of all the existing edges in the graph.

Source

pub fn set_num_inputs( &mut self, node_id: NodeID, num_inputs: usize, ) -> Result<Vec<EdgeID>, ()>

Set the number of input ports for a particular node in the graph.

This will return an error if a node with the given ID does not exist in the graph, or if the ID is of the graph input node.

Source

pub fn set_num_outputs( &mut self, node_id: NodeID, num_outputs: usize, ) -> Result<Vec<EdgeID>, ()>

Set the number of output ports for a particular node in the graph.

This will return an error if a node with the given ID does not exist in the graph, or if the ID is of the graph output node.

Source

pub fn add_edge( &mut self, src_node: NodeID, src_port: impl Into<OutPortIdx>, dst_node: NodeID, dst_port: impl Into<InPortIdx>, check_for_cycles: bool, ) -> Result<EdgeID, AddEdgeError>

Add an Edge (port connection) to the graph.

  • src_node_id - The ID of the source node.
  • src_port_idx - The index of the source port. This must be an output port on the source node.
  • dst_node_id - The ID of the destination node.
  • dst_port_idx - The index of the destination port. This must be an input port on the destination node.
  • check_for_cycles - If true, then this will run a check to see if adding this edge will create a cycle in the graph, and return an error if it does.

If successful, this returns the globally unique identifier assigned to this edge.

If this returns an error, then the audio graph has not been modified.

Source

pub fn remove_edge(&mut self, edge_id: EdgeID) -> bool

Remove the given Edge (port connection) from the graph.

If the edge did not exist in the graph, then false will be returned.

Source

pub fn edge(&self, edge_id: EdgeID) -> Option<&Edge>

Get information about the given Edge

Source

pub fn cycle_detected(&mut self) -> bool

Auto Trait Implementations§

§

impl<C> Freeze for AudioGraph<C>

§

impl<C> !RefUnwindSafe for AudioGraph<C>

§

impl<C> !Send for AudioGraph<C>

§

impl<C> !Sync for AudioGraph<C>

§

impl<C> Unpin for AudioGraph<C>

§

impl<C> !UnwindSafe for AudioGraph<C>

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> 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<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, 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.