Mercurial > SDL_sound_CoreAudio
diff decoders/mp3.c @ 54:6df2f69e037e
Fixes by Torbj�rn...now the thing actually works! :) See the CHANGELOG
entry for 09242001 for an explanation of what the problem was.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 24 Sep 2001 07:55:22 +0000 |
parents | 6e13fcc178da |
children | b13fafb976be |
line wrap: on
line diff
--- a/decoders/mp3.c Sat Sep 22 16:36:09 2001 +0000 +++ b/decoders/mp3.c Mon Sep 24 07:55:22 2001 +0000 @@ -173,6 +173,11 @@ SMPEG_loop(smpeg, 0); SMPEG_wantedSpec(smpeg, &spec); + /* + * One of the MP3:s I tried wouldn't work unless I added this line + * to tell SMPEG that yes, it may have the spec it wants. + */ + SMPEG_actualSpec(smpeg, &spec); sample->actual.format = spec.format; sample->actual.rate = spec.freq; sample->actual.channels = spec.channels; @@ -197,6 +202,11 @@ Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; SMPEG *smpeg = (SMPEG *) internal->decoder_private; + /* + * We have to clear the buffer because apparently SMPEG_playAudio() + * will mix the decoded audio with whatever's already in it. Nasty. + */ + memset(internal->buffer, 0, internal->buffer_size); retval = SMPEG_playAudio(smpeg, internal->buffer, internal->buffer_size); if (retval < internal->buffer_size) {