Skip to content

Commit

Permalink
Fixed bug #413
Browse files Browse the repository at this point in the history
Fixed a bug with the final loop of samples the length of the audio buffer.
  • Loading branch information
slouken committed Jul 15, 2007
1 parent c21dee6 commit c6821a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions 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
Expand Down
12 changes: 5 additions & 7 deletions mixer.c
Expand Up @@ -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);
Expand All @@ -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;
}

}
}
}
Expand Down

0 comments on commit c6821a9

Please sign in to comment.