### Overview Add streaming playback for large audio files (music, ambient tracks) that decodes audio on-the-fly instead of loading entire files into memory. ### Current State Sound loading loads entire files into memory. Large music files (5+ minutes) would consume excessive RAM. ### Scope **Goals:** - Stream audio from file during playback - Buffer decoded audio in small chunks - Support seeking within streamed audio - Support OGG and WAV streaming **Non-Goals:** - Network audio streaming - Gapless playback between tracks ### Proposed API ```rust pub struct StreamingSound { // internal decoder + buffer } impl StreamingSound { pub fn from_file(path: &Path) -> Result<Self, AudioError>; pub fn play(&mut self); pub fn pause(&mut self); pub fn stop(&mut self); pub fn seek(&mut self, position_seconds: f32); pub fn position(&self) -> f32; pub fn duration(&self) -> f32; pub fn set_volume(&mut self, volume: f32); pub fn set_looping(&mut self, looping: bool); } ``` ### Acceptance Criteria - [ ] Stream a 5+ minute audio file with <10MB memory usage - [ ] Seeking works without audible glitches - [ ] Looping works without gaps - [ ] CPU usage remains reasonable during playback - [ ] Example streaming background music ### Affected Crates lambda-rs, lambda-rs-platform ### Notes - Buffer size tradeoff: larger = more latency, smaller = more CPU - Consider 100-200ms buffer as default - Decoder runs on separate thread or async task
Activity