From 085445b35d35a826d976f62274279d29ca3768ff Mon Sep 17 00:00:00 2001 From: lifning <> Date: Fri, 17 Dec 2021 23:41:07 -0800 Subject: [PATCH] again with feeling --- ferretro_components/src/provided/sdl2/audio_thread.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ferretro_components/src/provided/sdl2/audio_thread.rs b/ferretro_components/src/provided/sdl2/audio_thread.rs index a1c9f5c..139eef7 100644 --- a/ferretro_components/src/provided/sdl2/audio_thread.rs +++ b/ferretro_components/src/provided/sdl2/audio_thread.rs @@ -25,7 +25,11 @@ impl AudioCallback for MySdlAudio { if self.must_resample { todo!("correct software resampling") } - self.reader.pop_slice(data); + let buf_len = data.len(); + let mut remaining = buf_len; + while remaining > 0 { + remaining -= self.reader.pop_slice(&mut data[buf_len - remaining..]); + } } }