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

source

pub fn new(channel_count: u8) -> Self

source

pub(crate) fn add_node(&mut self, node: Box<dyn AudioNodeEngine>) -> NodeId

Create a node, obtain its id

source

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

source

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

source

pub fn disconnect_output(&mut self, out: PortId<OutputPort>)

source

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

source

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

source

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

source

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

source

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

source

pub fn add_extra_dest(&mut self, dest: NodeId)

Add additional terminator nodes

source

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.

source

pub fn process(&mut self, info: &BlockInfo) -> Chunk

For a given block, process all the data on this graph

source

pub(crate) fn node_mut( &self, ix: NodeId, ) -> RefMut<'_, Box<dyn AudioNodeEngine>>

Obtain a mutable reference to a node

Auto Trait Implementations§

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.