Skip to main content

RouterControl

Struct RouterControl 

Source
pub struct RouterControl { /* private fields */ }
Expand description

The control side: endpoints, routes, mute, solo and limiters. Every change takes effect at the audio side’s next block.

Implementations§

Source§

impl RouterControl

Source

pub fn remote_connections(&self) -> &[String]

The ids of the connections the last Executor::apply left alone because an end is not here.

Source§

impl RouterControl

Source

pub fn config(&self) -> SinkConfig

The router’s rate and channels.

Source

pub fn tidy(&self)

Drops what the audio side handed back. Every other call does this too.

Source

pub fn add_source( &mut self, id: &str, render: RenderFn, ) -> Result<(), RouterError>

Adds a source rendered on the audio thread once per block, routed or not (so its clock keeps running).

Source

pub fn add_input( &mut self, id: &str, frames: usize, ) -> Result<RouterInput, RouterError>

Adds an input fed from another thread, with room for frames frames. Missing samples play as silence.

Source

pub fn add_tap( &mut self, id: &str, frames: usize, ) -> Result<RouterTap, RouterError>

Adds a tap read from another thread, with room for frames frames.

Source

pub fn add_bus(&mut self, input: &str, output: &str) -> Result<(), RouterError>

Adds a bus: routes into input are summed, and the sum leaves from output.

Source

pub fn remove(&mut self, id: &str) -> Result<(), RouterError>

Removes an endpoint (either name removes a bus) and every route that touches it.

Source

pub fn set_routes(&mut self, routes: Vec<Route>) -> Result<(), RouterError>

Replaces every route. Nothing changes if one is refused.

Source

pub fn connect(&mut self, route: Route) -> Result<(), RouterError>

Adds one route (replacing the gain of the same two endpoints if they are routed already).

Source

pub fn disconnect(&mut self, from: &str, to: &str) -> Result<(), RouterError>

Removes the route from from to to, if there is one.

Source

pub fn routes(&self) -> &[Route]

The routes.

Source

pub fn endpoints(&self) -> impl Iterator<Item = (&str, EndpointKind)>

The endpoints, by id.

Source

pub fn kind(&self, id: &str) -> Option<EndpointKind>

The kind of endpoint id.

Source

pub fn set_muted(&mut self, id: &str, muted: bool) -> Result<(), RouterError>

Mutes or unmutes everything that leaves id (a source, an input or a bus output).

Source

pub fn set_solo(&mut self, id: &str, solo: bool) -> Result<(), RouterError>

Solos id: at each destination it feeds, the inputs that are not soloed go silent.

Source

pub fn set_limit( &mut self, id: &str, ceiling_db: Option<f32>, ) -> Result<(), RouterError>

Puts a limiter with a ceiling of ceiling_db on destination id (a bus input, a tap or the device), or takes it off.

Source

pub fn level(&self, id: &str) -> Option<f32>

The peak of the last block at endpoint id (linear; after its mix and limiter for a destination).

Source

pub fn frames(&self) -> u64

Frames the audio side has rendered.

Trait Implementations§

Source§

impl Executor for RouterControl

Source§

fn apply(&mut self, graph: &Graph) -> Result<(), RouteError>

Routes every enabled connection whose two ports are endpoints of this router (the port id is the endpoint id), with the connection’s gain. The graph owns the routes between its ports: those it no longer has go, and routes with an end the graph does not know (the router’s own wiring, such as a bus to the device) stay. Connections with an end elsewhere are left for a remote executor and listed by RouterControl::remote_connections. A refused graph leaves the router as it was.

Auto Trait Implementations§

§

impl Forget for RouterControl

§

impl Freeze for RouterControl
where *const ArcInner<ArrayQueue<Msg>> is !null: Freeze, PhantomData<ArcInner<ArrayQueue<Msg>>>: Freeze, *const ArcInner<ArrayQueue<Garbage>> is !null: Freeze, PhantomData<ArcInner<ArrayQueue<Garbage>>>: Freeze, *const ArcInner<Shared> is !null: Freeze, PhantomData<ArcInner<Shared>>: Freeze, *const LeafNode<String, Endpoint> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, Endpoint)>>: Freeze, *const LeafNode<usize, (String, String)> is !null: Freeze, PhantomData<Box<(usize, (String, String))>>: Freeze, *const u8 is !null: Freeze, PhantomData<usize>: Freeze, PhantomData<Route>: Freeze, *const LeafNode<String, SetValZST> is !null: Freeze, PhantomData<Box<(String, SetValZST)>>: Freeze, *const LeafNode<String, f32> is !null: Freeze, PhantomData<Box<(String, f32)>>: Freeze, PhantomData<String>: Freeze,

§

impl Move for RouterControl

§

impl RefUnwindSafe for RouterControl

§

impl Send for RouterControl
where Arc<ArrayQueue<Msg>>: Send, Arc<ArrayQueue<Garbage>>: Send, Arc<Shared>: Send, NodeRef<Owned, String, Endpoint, LeafOrInternal>: Send, BoxRaw<(String, Endpoint)>: Send, NodeRef<Owned, usize, (String, String), LeafOrInternal>: Send, BoxRaw<(usize, (String, String))>: Send, RawVecInner: Send, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Send, BoxRaw<(String, SetValZST)>: Send, NodeRef<Owned, String, f32, LeafOrInternal>: Send, BoxRaw<(String, f32)>: Send,

§

impl Sync for RouterControl
where Arc<ArrayQueue<Msg>>: Sync, Arc<ArrayQueue<Garbage>>: Sync, Arc<Shared>: Sync, NodeRef<Owned, String, Endpoint, LeafOrInternal>: Sync, BoxRaw<(String, Endpoint)>: Sync, NodeRef<Owned, usize, (String, String), LeafOrInternal>: Sync, BoxRaw<(usize, (String, String))>: Sync, RawVecInner: Sync, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Sync, BoxRaw<(String, SetValZST)>: Sync, NodeRef<Owned, String, f32, LeafOrInternal>: Sync, BoxRaw<(String, f32)>: Sync,

§

impl Unpin for RouterControl
where Arc<ArrayQueue<Msg>>: Unpin, Arc<ArrayQueue<Garbage>>: Unpin, Arc<Shared>: Unpin, *const LeafNode<String, Endpoint> is !null: Unpin, Box<(String, Endpoint)>: Unpin, *const LeafNode<usize, (String, String)> is !null: Unpin, Box<(usize, (String, String))>: Unpin, *const u8 is !null: Unpin, *const LeafNode<String, SetValZST> is !null: Unpin, Box<(String, SetValZST)>: Unpin, *const LeafNode<String, f32> is !null: Unpin, Box<(String, f32)>: Unpin,

§

impl UnsafeUnpin for RouterControl
where *const ArcInner<ArrayQueue<Msg>> is !null: UnsafeUnpin, PhantomData<ArcInner<ArrayQueue<Msg>>>: UnsafeUnpin, *const ArcInner<ArrayQueue<Garbage>> is !null: UnsafeUnpin, PhantomData<ArcInner<ArrayQueue<Garbage>>>: UnsafeUnpin, *const ArcInner<Shared> is !null: UnsafeUnpin, PhantomData<ArcInner<Shared>>: UnsafeUnpin, *const LeafNode<String, Endpoint> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, Endpoint)>>: UnsafeUnpin, *const LeafNode<usize, (String, String)> is !null: UnsafeUnpin, PhantomData<Box<(usize, (String, String))>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, PhantomData<Route>: UnsafeUnpin, *const LeafNode<String, SetValZST> is !null: UnsafeUnpin, PhantomData<Box<(String, SetValZST)>>: UnsafeUnpin, *const LeafNode<String, f32> is !null: UnsafeUnpin, PhantomData<Box<(String, f32)>>: UnsafeUnpin, PhantomData<String>: UnsafeUnpin,

§

impl UnwindSafe for RouterControl

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.