Skip to content

Commit

Permalink
Moved MIDI decoder to end of array. Fixed Sound_SetError() so that it
Browse files Browse the repository at this point in the history
works after the first call. Now makes sure there's really sound data to
convert between formats before attempting to do so.
  • Loading branch information
icculus committed Nov 19, 2001
1 parent c07ca63 commit 9eb9aec
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions SDL_sound.c
Expand Up @@ -129,14 +129,14 @@ static decoder_element decoders[] =
{ 0, &__Sound_DecoderFunctions_SHN },
#endif

#if (defined SOUND_SUPPORTS_MIDI)
{ 0, &__Sound_DecoderFunctions_MIDI },
#endif

#if (defined SOUND_SUPPORTS_FLAC)
{ 0, &__Sound_DecoderFunctions_FLAC },
#endif

#if (defined SOUND_SUPPORTS_MIDI)
{ 0, &__Sound_DecoderFunctions_MIDI },
#endif

{ 0, NULL }
};

Expand Down Expand Up @@ -244,11 +244,8 @@ void Sound_ClearError(void)
*/
void Sound_SetError(const char *err)
{
if (err != NULL)
{
SNDDBG(("Sound_SetError(\"%s\");\n", err));
SDL_SetError(err);
} /* if */
SNDDBG(("Sound_SetError(\"%s\");\n", err));
SDL_SetError(err);
} /* Sound_SetError */


Expand Down Expand Up @@ -620,7 +617,7 @@ Uint32 Sound_Decode(Sound_Sample *sample)
sample->flags &= !SOUND_SAMPLEFLAG_EAGAIN;
retval = internal->funcs->read(sample);

if (internal->sdlcvt.needed)
if (retval > 0 && internal->sdlcvt.needed)
{
internal->sdlcvt.len = retval;
Sound_ConvertAudio(&internal->sdlcvt);
Expand Down

0 comments on commit 9eb9aec

Please sign in to comment.