-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
audioAll things related to audioAll things related to audioenhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core frameworklambda-rs-platformIssues pertaining to the dependency & platform wrappersIssues pertaining to the dependency & platform wrappers
Description
Overview
Implement an audio mixer that combines multiple sound instances into a single
output stream, enabling games to play music, sound effects, and UI sounds
simultaneously.
Current State
Requires basic sound playback. Current design may only support one sound at
a time.
Scope
Goals:
- Mix multiple sound instances together
- Support configurable number of simultaneous sounds
- Per-instance volume applied before mixing
- Master volume applied after mixing
Non-Goals:
- Audio buses/groups (separate issue)
- Effects sends (separate issue)
- Ducking/priority system (separate issue)
Proposed API
pub struct AudioMixer {
max_voices: usize,
master_volume: f32,
}
pub struct AudioMixerBuilder {
// configuration
}
impl AudioMixerBuilder {
pub fn new() -> Self;
pub fn with_max_voices(self, count: usize) -> Self;
pub fn build(self) -> AudioMixer;
}
impl AudioMixer {
pub fn play(&mut self, buffer: &SoundBuffer) -> Option<SoundInstance>;
pub fn active_voice_count(&self) -> usize;
}Acceptance Criteria
- Play at least 32 sounds simultaneously
- Sounds mix without clipping (normalize or limit)
- Finished sounds free their voice slot
- Return None when all voices are in use
- Example playing multiple overlapping sounds
Affected Crates
lambda-rs, lambda-rs-platform
Notes
- Consider voice stealing for when limit is reached
- Sum samples and apply soft limiting to prevent clipping
Metadata
Metadata
Assignees
Labels
audioAll things related to audioAll things related to audioenhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core frameworklambda-rs-platformIssues pertaining to the dependency & platform wrappersIssues pertaining to the dependency & platform wrappers