Merge pull request #126 from gwilymk/fix-crash-when-looping-stereo

Fix crash when stereo sound loops
This commit is contained in:
Gwilym Kuiper 2021-10-29 15:50:43 +01:00 committed by GitHub
commit a514625122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,7 +147,7 @@ impl MixerBuffer {
if (channel.pos + playback_speed * SOUND_BUFFER_SIZE).floor() >= channel.data.len() {
// TODO: This should probably play what's left rather than skip the last bit
if channel.should_loop {
channel.pos -= channel.data.len();
channel.pos = 0.into();
} else {
channel.is_done = true;
continue;