pub struct MainTrackBuilder { /* private fields */ }Expand description
Configures the main mixer track.
Implementations§
Source§impl MainTrackBuilder
impl MainTrackBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new MainTrackBuilder with the default settings.
Sourcepub fn volume(self, volume: impl Into<Value<Decibels>>) -> Self
pub fn volume(self, volume: impl Into<Value<Decibels>>) -> Self
Sets the volume of the main mixer track.
Sourcepub fn sound_capacity(self, capacity: usize) -> Self
pub fn sound_capacity(self, capacity: usize) -> Self
Sets the maximum number of sounds that can be played simultaneously on this track.
Sourcepub fn add_effect<B: EffectBuilder>(&mut self, builder: B) -> B::Handle
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());Sourcepub fn with_effect<B: EffectBuilder>(self, builder: B) -> Self
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());Sourcepub fn add_built_effect(&mut self, effect: Box<dyn Effect>)
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);Sourcepub fn with_built_effect(self, effect: Box<dyn Effect>) -> Self
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);