Skip to main content

AudioBuses

Struct AudioBuses 

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

Flat named buses under master; music/sfx are available by default. Muting affects gain only; envelopes and stream clocks continue advancing.

Implementations§

Source§

impl AudioBuses

Source

pub fn find(&self, name: &str) -> Option<BusId>

Resolves an existing name.

Source

pub fn add(&mut self, name: &str) -> Result<BusId, AudioError>

Adds a game-defined bus, or returns the existing handle for that name.

Source

pub fn settings_for(&self, id: BusId) -> Result<BusSettings, AudioError>

Reads persistent controls, independent of ducking and parent gain.

Source

pub fn set_volume(&mut self, id: BusId, volume: f32) -> Result<(), AudioError>

Sets a user volume; rejects nonfinite/out-of-range values.

Source

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

Mutes a bus, preserving the stored volume.

Source

pub fn duck( &mut self, id: BusId, gain: f32, duration: Duration, ) -> Result<(), AudioError>

Fades a transient multiplier, e.g. 0.25 while a pause menu covers play. This does not alter the persisted user volume.

Source

pub fn gain(&self, id: BusId) -> Result<f32, AudioError>

Effective bus gain, including master exactly once.

Source

pub fn advance(&mut self, delta: Duration)

Advances every duck envelope by one frame’s wall time.

Source

pub fn settings(&self) -> AudioSettings

Captures user values for serialization into the game’s save container.

Source

pub fn apply_settings( &mut self, settings: &AudioSettings, ) -> Result<(), AudioError>

Atomically applies named settings, creating extra buses when needed. Unlisted buses and all transient duck envelopes retain their values.

Trait Implementations§

Source§

impl Default for AudioBuses

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> Component for T
where T: Send + Sync + 'static,

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, 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.