Skip to main content

MainTrackBuilder

Struct MainTrackBuilder 

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

Configures the main mixer track.

Implementations§

Source§

impl MainTrackBuilder

Source

pub fn new() -> Self

Creates a new MainTrackBuilder with the default settings.

Source

pub fn volume(self, volume: impl Into<Value<Decibels>>) -> Self

Sets the volume of the main mixer track.

Source

pub fn sound_capacity(self, capacity: usize) -> Self

Sets the maximum number of sounds that can be played simultaneously on this track.

Source

pub fn add_effect<B: EffectBuilder>(&mut self, builder: B) -> B::Handle

Adds an effect to the track.

§Examples
use kira::{track::MainTrackBuilder, effect::delay::DelayBuilder};

let mut builder = MainTrackBuilder::new();
let delay_handle = builder.add_effect(DelayBuilder::new());
Source

pub fn with_effect<B: EffectBuilder>(self, builder: B) -> Self

Adds an effect to the track and returns the MainTrackBuilder.

If you need to modify the effect later, use add_effect, which returns the effect handle.

§Examples
use kira::{
	track::MainTrackBuilder,
	effect::{filter::FilterBuilder, reverb::ReverbBuilder},
};

let mut builder = MainTrackBuilder::new()
	.with_effect(FilterBuilder::new())
	.with_effect(ReverbBuilder::new());
Source

pub fn add_built_effect(&mut self, effect: Box<dyn Effect>)

Adds an already built effect into this track.

Box<dyn Effect> values are created when calling build on an effect builder, which gives you an effect handle, as well as this boxed effect, which is the actual audio effect.

This is a lower-level method than Self::add_effect, and you should probably use it rather than this method, unless you have a reason to.

§Examples
use kira::track::MainTrackBuilder;
use kira::effect::{EffectBuilder, delay::DelayBuilder};

let mut builder = MainTrackBuilder::new();
let delay_builder = DelayBuilder::new();
let (effect, delay_handle) = delay_builder.build();
let delay_handle = builder.add_built_effect(effect);
Source

pub fn with_built_effect(self, effect: Box<dyn Effect>) -> Self

Add an already-built effect and return the MainTrackBuilder.

Box<dyn Effect> values are created when calling build on an effect builder, which gives you an effect handle, as well as this boxed effect, which is the actual audio effect.

This is a lower-level method than Self::with_effect, and you should probably use it rather than this method, unless you have a reason to.

§Examples
use kira::{
	track::MainTrackBuilder,
	effect::{filter::FilterBuilder, reverb::ReverbBuilder, EffectBuilder},
};

let (filter_effect, filter_handle) = FilterBuilder::new().build();
let (reverb_effect, reverb_handle) = ReverbBuilder::new().build();
let mut builder = MainTrackBuilder::new()
	.with_built_effect(filter_effect)
	.with_built_effect(reverb_effect);

Trait Implementations§

Source§

impl Default for MainTrackBuilder

Source§

fn default() -> Self

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> 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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

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 = 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.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,