Skip to main content

BusLayout

Struct BusLayout 

Source
#[non_exhaustive]
pub struct BusLayout { pub inputs: Vec<BusConfig>, pub outputs: Vec<BusConfig>, }
Expand description

Describes the audio bus configuration of a plugin.

By convention, the first input bus is the main audio in (effects + analyzers) and any subsequent input buses are sidechain inputs. The first output bus is the main audio out. Format wrappers (CLAP / VST3 / AU / AAX / LV2) rely on this ordering when they translate into format-specific main/aux bus designations, and BusConfig::kind lets call-sites that need it ask the bus directly rather than re-deriving the convention.

Construct via Self::new / Self::mono / Self::stereo + the with_* builders rather than struct literal - #[non_exhaustive] so pre-1.0 future fields don’t break downstream.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§inputs: Vec<BusConfig>§outputs: Vec<BusConfig>

Implementations§

Source§

impl BusLayout

Source

pub fn new() -> Self

Source

pub fn mono() -> Self

Source

pub fn stereo() -> Self

Source

pub fn stereo_and_mono() -> Vec<Self>

The default audio-effect layout set: stereo and mono (stereo first, so it’s the default width). Return this from bus_layouts() for an ordinary in/out effect and the host offers it on both stereo and mono tracks, instead of a stereo-only effect that’s hidden on mono ones. The effect’s process must handle either width - loop over buffer.channels() rather than assuming two.

Source

pub fn stereo_and_mono_output() -> Vec<Self>

The output-only counterpart of Self::stereo_and_mono: stereo and mono output buses with no input, for an instrument that produces audio from MIDI. Offered on both stereo and mono tracks. The instrument’s process must handle either output width - guard any write past the first channel with buffer.num_output_channels().

Source

pub fn with_input(self, name: &'static str, channels: ChannelConfig) -> Self

Append a main audio input bus. First call → main audio in; subsequent calls → sidechain inputs (use Self::with_sidechain_input if you prefer to be explicit).

Source

pub fn with_sidechain_input( self, name: &'static str, channels: ChannelConfig, ) -> Self

Append a sidechain input bus. Equivalent to Self::with_input after the first input has already been added, but lets call sites express intent.

Source

pub fn with_output(self, name: &'static str, channels: ChannelConfig) -> Self

Source

pub fn sidechain_input_indices(&self) -> impl Iterator<Item = usize> + '_

Return the indices of all sidechain input buses.

Source

pub fn total_input_channels(&self) -> u32

Source

pub fn total_output_channels(&self) -> u32

Trait Implementations§

Source§

impl Clone for BusLayout

Source§

fn clone(&self) -> BusLayout

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BusLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BusLayout

Source§

fn default() -> BusLayout

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.