From c6821a917f1b6ed40afb9778e1683ee63f5f2662 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 15 Jul 2007 04:41:22 +0000 Subject: [PATCH] Fixed bug #413 Fixed a bug with the final loop of samples the length of the audio buffer. --- CHANGES | 2 ++ mixer.c | 12 +++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index f5513c68..46d7ee95 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ 1.2.8: +Sam Lantinga - Sat Jul 14 21:39:30 PDT 2007 + * Fixed the final loop of audio samples of a certain size Sam Lantinga - Sat Jul 14 21:05:09 PDT 2007 * Fixed opening Ogg Vorbis files using different C runtimes on Windows Philippe Simons - Sat Jul 14 20:33:17 PDT 2007 diff --git a/mixer.c b/mixer.c index 39494bce..459eabd9 100644 --- a/mixer.c +++ b/mixer.c @@ -226,9 +226,9 @@ static void mix_channels(void *udata, Uint8 *stream, int len) while ( mix_channel[i].looping && index < len ) { int alen = mix_channel[i].chunk->alen; remaining = len - index; - if (remaining > alen) { + if (remaining > alen) { remaining = alen; - } + } mix_input = Mix_DoEffects(i, mix_channel[i].chunk->abuf, remaining); SDL_MixAudio(stream+index, mix_input, remaining, volume); @@ -241,12 +241,10 @@ static void mix_channels(void *udata, Uint8 *stream, int len) index += remaining; } if ( ! mix_channel[i].playing && mix_channel[i].looping ) { - if ( --mix_channel[i].looping ) { - mix_channel[i].samples = mix_channel[i].chunk->abuf; - mix_channel[i].playing = mix_channel[i].chunk->alen; - } + --mix_channel[i].looping; + mix_channel[i].samples = mix_channel[i].chunk->abuf; + mix_channel[i].playing = mix_channel[i].chunk->alen; } - } } }