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
impl RouterControl
Sourcepub fn remote_connections(&self) -> &[String]
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
impl RouterControl
Sourcepub fn config(&self) -> SinkConfig
pub fn config(&self) -> SinkConfig
The router’s rate and channels.
Sourcepub fn add_source(
&mut self,
id: &str,
render: RenderFn,
) -> Result<(), RouterError>
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).
Sourcepub fn add_input(
&mut self,
id: &str,
frames: usize,
) -> Result<RouterInput, RouterError>
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.
Sourcepub fn add_tap(
&mut self,
id: &str,
frames: usize,
) -> Result<RouterTap, RouterError>
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.
Sourcepub fn add_bus(&mut self, input: &str, output: &str) -> Result<(), RouterError>
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.
Sourcepub fn remove(&mut self, id: &str) -> Result<(), RouterError>
pub fn remove(&mut self, id: &str) -> Result<(), RouterError>
Removes an endpoint (either name removes a bus) and every route that touches it.
Sourcepub fn set_routes(&mut self, routes: Vec<Route>) -> Result<(), RouterError>
pub fn set_routes(&mut self, routes: Vec<Route>) -> Result<(), RouterError>
Replaces every route. Nothing changes if one is refused.
Sourcepub fn connect(&mut self, route: Route) -> Result<(), RouterError>
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).
Sourcepub fn disconnect(&mut self, from: &str, to: &str) -> Result<(), RouterError>
pub fn disconnect(&mut self, from: &str, to: &str) -> Result<(), RouterError>
Removes the route from from to to, if there is one.
Sourcepub fn endpoints(&self) -> impl Iterator<Item = (&str, EndpointKind)>
pub fn endpoints(&self) -> impl Iterator<Item = (&str, EndpointKind)>
The endpoints, by id.
Sourcepub fn kind(&self, id: &str) -> Option<EndpointKind>
pub fn kind(&self, id: &str) -> Option<EndpointKind>
The kind of endpoint id.
Sourcepub fn set_muted(&mut self, id: &str, muted: bool) -> Result<(), RouterError>
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).
Sourcepub fn set_solo(&mut self, id: &str, solo: bool) -> Result<(), RouterError>
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.
Sourcepub fn set_limit(
&mut self,
id: &str,
ceiling_db: Option<f32>,
) -> Result<(), RouterError>
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.
Trait Implementations§
Source§impl Executor for RouterControl
impl Executor for RouterControl
Source§fn apply(&mut self, graph: &Graph) -> Result<(), RouteError>
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.