pub struct MixerHandle { /* private fields */ }Expand description
The game’s half of the mixer: starts, changes and stops voices.
Implementations§
Source§impl MixerHandle
impl MixerHandle
Sourcepub fn set_effects(&mut self, bus: BusId, effects: &[Effect]) -> Result<()>
pub fn set_effects(&mut self, bus: BusId, effects: &[Effect]) -> Result<()>
Replaces a bus’s chain. Preparation may allocate; installation is atomic and sample scheduled. An empty slice removes the chain and its tail immediately.
Sourcepub fn set_effect(
&mut self,
bus: BusId,
slot: usize,
effect: Effect,
fade: Fade,
) -> Result<()>
pub fn set_effect( &mut self, bus: BusId, slot: usize, effect: Effect, fade: Fade, ) -> Result<()>
Ramps all numeric settings of an existing matching slot in place. Type or capacity mismatches and dependency cycles are reported asynchronously. Changing the sidechain key is immediate; gain reduction uses attack/release.
Source§impl MixerHandle
impl MixerHandle
Sourcepub fn set_routing(&mut self, settings: &[BusRouting]) -> Result<RoutingId>
pub fn set_routing(&mut self, settings: &[BusRouting]) -> Result<RoutingId>
Replace the named-bus routing graph/settings atomically. Empty settings restore legacy flat routing. Preparation allocates; render does not. Audio-only validation is synchronous; actual sidechain dependencies are revalidated on application. Poll the returned ID’s outcome. Each unpolled edit consumes one credit, up to MixerConfig::queue, including retired data.
Source§impl MixerHandle
impl MixerHandle
pub fn sample_rate(&self) -> u32
pub fn channels(&self) -> usize
Sourcepub fn voice_status(&self, voice: VoiceId) -> Option<VoiceStatus>
pub fn voice_status(&self, voice: VoiceId) -> Option<VoiceStatus>
A voice’s state and position as of the mixer’s last render, read without
blocking. None if the mixer has not started the voice yet, or if it ended and
its slot went to another voice; MixerHandle::poll_event reports endings.
Sourcepub fn pause(&mut self, voice: VoiceId, fade: Fade) -> Result<()>
pub fn pause(&mut self, voice: VoiceId, fade: Fade) -> Result<()>
Pauses a voice, fading it out first. It keeps its position, fades and loop.
Sourcepub fn resume(&mut self, voice: VoiceId, fade: Fade) -> Result<()>
pub fn resume(&mut self, voice: VoiceId, fade: Fade) -> Result<()>
Resumes a paused voice, fading it in.
Sourcepub fn pause_bus(&mut self, bus: BusId, fade: Fade) -> Result<()>
pub fn pause_bus(&mut self, bus: BusId, fade: Fade) -> Result<()>
Pauses voices directly assigned to a bus; BusId::MASTER pauses all.
A paused group also gates routed input/freezes its inserts, but does not
recursively freeze child sources. Use mute for advancing silent playback.
Voices started directly on a paused bus wait for it to resume.
pub fn resume_bus(&mut self, bus: BusId, fade: Fade) -> Result<()>
Sourcepub fn at(&mut self, frame: u64) -> Commands<'_>
pub fn at(&mut self, frame: u64) -> Commands<'_>
Commands that apply exactly at output frame frame, or at the next render if
it has passed.
pub fn play(&mut self, sound: impl Into<Sound>, play: &Play) -> Result<VoiceId>
pub fn stop(&mut self, voice: VoiceId, fade: Fade) -> Result<()>
pub fn stop_all(&mut self, fade: Fade) -> Result<()>
pub fn set_gain(&mut self, voice: VoiceId, gain: f32, fade: Fade) -> Result<()>
Sourcepub fn set_pan(&mut self, voice: VoiceId, pan: f32, fade: Fade) -> Result<()>
pub fn set_pan(&mut self, voice: VoiceId, pan: f32, fade: Fade) -> Result<()>
Set legacy pan. A point emitter uses its direction instead.
pub fn set_rate(&mut self, voice: VoiceId, rate: f32, fade: Fade) -> Result<()>
pub fn set_pitch( &mut self, voice: VoiceId, semitones: f32, fade: Fade, ) -> Result<()>
Sourcepub fn set_position(
&mut self,
voice: VoiceId,
position: [f32; 2],
fade: Fade,
) -> Result<()>
pub fn set_position( &mut self, voice: VoiceId, position: [f32; 2], fade: Fade, ) -> Result<()>
Moves a voice to position relative to the listener, ramping its pan and
distance gain over the fade so a moving sound does not zipper. A fade of about
one game frame suits positions updated every frame.
A 3D emitter ignores 2D pan/position commands; update it with set_emitter.
Sourcepub fn set_emitter(
&mut self,
voice: VoiceId,
emitter: Emitter,
fade: Fade,
) -> Result<()>
pub fn set_emitter( &mut self, voice: VoiceId, emitter: Emitter, fade: Fade, ) -> Result<()>
Enable/update permanent point-source mode. Stereo collapses immediately to (L+R)/2; fade ramps direction, attenuation and Doppler, not that conversion.
Sourcepub fn set_listener(&mut self, listener: Listener, fade: Fade) -> Result<()>
pub fn set_listener(&mut self, listener: Listener, fade: Fade) -> Result<()>
Schedule a global listener update; placement is recomputed on application.
Sourcepub fn latency(&self) -> u64
pub fn latency(&self) -> u64
Output frames by which the master limiter’s look-ahead delays the sound: a
change scheduled at frame f is heard at f + latency(). 0 without a limiter.
Sourcepub fn limiter_gain(&self) -> Option<f32>
pub fn limiter_gain(&self) -> Option<f32>
The lowest gain the master limiter applied during the last render, from 0 to 1
(1 when it did not reduce), for meters. None without a limiter.
pub fn set_bus_gain(&mut self, bus: BusId, gain: f32, fade: Fade) -> Result<()>
Sourcepub fn poll_event(&mut self) -> Option<MixerEvent>
pub fn poll_event(&mut self) -> Option<MixerEvent>
Returns the next event, freeing finished voices and retired effect/routing edits on this thread. These queues are independent; combined polling order is not a chronological ordering across event kinds.