comparison SDL_sound.c @ 163:b6d6f994e970

Moved MIDI decoder to end of array. Fixed Sound_SetError() so that it works after the first call. Now makes sure there's really sound data to convert between formats before attempting to do so.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 19 Nov 2001 16:37:22 +0000
parents fa3e593b6a5e
children 9b26ed9eaf04
comparison
equal deleted inserted replaced
162:3ccce5bb41c0 163:b6d6f994e970
127 127
128 #if (defined SOUND_SUPPORTS_SHN) 128 #if (defined SOUND_SUPPORTS_SHN)
129 { 0, &__Sound_DecoderFunctions_SHN }, 129 { 0, &__Sound_DecoderFunctions_SHN },
130 #endif 130 #endif
131 131
132 #if (defined SOUND_SUPPORTS_FLAC)
133 { 0, &__Sound_DecoderFunctions_FLAC },
134 #endif
135
132 #if (defined SOUND_SUPPORTS_MIDI) 136 #if (defined SOUND_SUPPORTS_MIDI)
133 { 0, &__Sound_DecoderFunctions_MIDI }, 137 { 0, &__Sound_DecoderFunctions_MIDI },
134 #endif
135
136 #if (defined SOUND_SUPPORTS_FLAC)
137 { 0, &__Sound_DecoderFunctions_FLAC },
138 #endif 138 #endif
139 139
140 { 0, NULL } 140 { 0, NULL }
141 }; 141 };
142 142
242 /* 242 /*
243 * This is declared in the internal header. 243 * This is declared in the internal header.
244 */ 244 */
245 void Sound_SetError(const char *err) 245 void Sound_SetError(const char *err)
246 { 246 {
247 if (err != NULL) 247 SNDDBG(("Sound_SetError(\"%s\");\n", err));
248 { 248 SDL_SetError(err);
249 SNDDBG(("Sound_SetError(\"%s\");\n", err));
250 SDL_SetError(err);
251 } /* if */
252 } /* Sound_SetError */ 249 } /* Sound_SetError */
253 250
254 251
255 /* 252 /*
256 * -ansi and -pedantic flags prevent use of strcasecmp() on Linux, and 253 * -ansi and -pedantic flags prevent use of strcasecmp() on Linux, and
618 615
619 /* reset EAGAIN. Decoder can flip it back on if it needs to. */ 616 /* reset EAGAIN. Decoder can flip it back on if it needs to. */
620 sample->flags &= !SOUND_SAMPLEFLAG_EAGAIN; 617 sample->flags &= !SOUND_SAMPLEFLAG_EAGAIN;
621 retval = internal->funcs->read(sample); 618 retval = internal->funcs->read(sample);
622 619
623 if (internal->sdlcvt.needed) 620 if (retval > 0 && internal->sdlcvt.needed)
624 { 621 {
625 internal->sdlcvt.len = retval; 622 internal->sdlcvt.len = retval;
626 Sound_ConvertAudio(&internal->sdlcvt); 623 Sound_ConvertAudio(&internal->sdlcvt);
627 retval = internal->sdlcvt.len_cvt; 624 retval = internal->sdlcvt.len_cvt;
628 } /* if */ 625 } /* if */