Mercurial > sdl-ios-xcode
diff src/audio/baudio/SDL_beaudio.cc @ 2001:02108bfd6550
Actually, my silly logic bug was actually correct. :/
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 31 Aug 2006 23:16:48 +0000 |
parents | cbac0f77a799 |
children | adf732f1f016 |
line wrap: on
line diff
--- a/src/audio/baudio/SDL_beaudio.cc Thu Aug 31 23:16:23 2006 +0000 +++ b/src/audio/baudio/SDL_beaudio.cc Thu Aug 31 23:16:48 2006 +0000 @@ -155,6 +155,7 @@ int BE_OpenAudio(_THIS, SDL_AudioSpec * spec) { + int valid_datatype = 0; media_raw_audio_format format; SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format); @@ -163,7 +164,8 @@ format.byte_order = B_MEDIA_LITTLE_ENDIAN; format.frame_rate = (float) spec->freq; format.channel_count = spec->channels; /* !!! FIXME: support > 2? */ - while (test_format) { + while ((!valid_datatype) && (test_format)) { + valid_datatype = 1; spec->format = test_format; switch (test_format) { case AUDIO_S8: @@ -202,6 +204,7 @@ break; default: + valid_datatype = 0; test_format = SDL_NextAudioFormat(); break; } @@ -209,7 +212,7 @@ format.buffer_size = spec->samples; - if (!test_format) { /* shouldn't happen, but just in case... */ + if (!valid_datatype) { /* shouldn't happen, but just in case... */ SDL_SetError("Unsupported audio format"); return (-1); }