Struct servo_media_audio::graph::AudioGraph
source · pub struct AudioGraph {
graph: StableGraph<Node, Edge>,
dest_id: NodeId,
dests: Vec<NodeId>,
listener_id: NodeId,
}
Fields§
§graph: StableGraph<Node, Edge>
§dest_id: NodeId
§dests: Vec<NodeId>
§listener_id: NodeId
Implementations§
source§impl AudioGraph
impl AudioGraph
pub fn new(channel_count: u8) -> Self
sourcepub(crate) fn add_node(&mut self, node: Box<dyn AudioNodeEngine>) -> NodeId
pub(crate) fn add_node(&mut self, node: Box<dyn AudioNodeEngine>) -> NodeId
Create a node, obtain its id
sourcepub fn add_edge(&mut self, out: PortId<OutputPort>, inp: PortId<InputPort>)
pub fn add_edge(&mut self, out: PortId<OutputPort>, inp: PortId<InputPort>)
Connect an output port to an input port
The edge goes from the output port to the input port, connecting two nodes
sourcepub fn disconnect_all_from(&mut self, node: NodeId)
pub fn disconnect_all_from(&mut self, node: NodeId)
Disconnect all outgoing connections from a node
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect
pub fn disconnect_output(&mut self, out: PortId<OutputPort>)
sourcepub fn disconnect_between(&mut self, from: NodeId, to: NodeId)
pub fn disconnect_between(&mut self, from: NodeId, to: NodeId)
Disconnect connections from a node to another node
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode
sourcepub fn disconnect_output_between(&mut self, out: PortId<OutputPort>, to: NodeId)
pub fn disconnect_output_between(&mut self, out: PortId<OutputPort>, to: NodeId)
Disconnect all outgoing connections from a node’s output to another node
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output
sourcepub fn disconnect_to(&mut self, node: NodeId, inp: PortId<InputPort>)
pub fn disconnect_to(&mut self, node: NodeId, inp: PortId<InputPort>)
Disconnect all outgoing connections from a node to another node’s input
Only used in WebAudio for disconnecting audio params
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationparam
sourcepub fn disconnect_output_between_to(
&mut self,
out: PortId<OutputPort>,
inp: PortId<InputPort>,
)
pub fn disconnect_output_between_to( &mut self, out: PortId<OutputPort>, inp: PortId<InputPort>, )
Disconnect all outgoing connections from a node’s output to another node’s input
https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output-input https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationparam-output
sourcepub fn dest_id(&self) -> NodeId
pub fn dest_id(&self) -> NodeId
Get the id of the destination node in this graph
All graphs have a destination node, with one input port
sourcepub fn add_extra_dest(&mut self, dest: NodeId)
pub fn add_extra_dest(&mut self, dest: NodeId)
Add additional terminator nodes
sourcepub fn listener_id(&self) -> NodeId
pub fn listener_id(&self) -> NodeId
Get the id of the AudioListener in this graph
All graphs have a single listener, with no ports (but nine AudioParams)
N.B. The listener actually has a single output port containing its position data for the block, however this should not be exposed to the DOM.