comparison src/audio/amigaos/SDL_ahiaudio.c @ 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
comparison
equal deleted inserted replaced
2000:8c05b048c32c 2001:02108bfd6550
225 static int 225 static int
226 AHI_OpenAudio(_THIS, SDL_AudioSpec * spec) 226 AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
227 { 227 {
228 // int width; 228 // int width;
229 SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format); 229 SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
230 int valid_datatype = 1;
230 231
231 D(bug("AHI opening...\n")); 232 D(bug("AHI opening...\n"));
232 233
233 /* Determine the audio parameters from the AudioSpec */ 234 /* Determine the audio parameters from the AudioSpec */
234 while (test_format) { 235 while ((!valid_datatype) && (test_format)) {
236 valid_datatype = 1;
235 switch (test_format) { 237 switch (test_format) {
236 case AUDIO_S8: 238 case AUDIO_S8:
237 D(bug("AUDIO_S8...\n")); 239 D(bug("AUDIO_S8...\n"));
238 spec->format = AUDIO_S8; 240 spec->format = AUDIO_S8;
239 this->hidden->bytespersample = 1; 241 this->hidden->bytespersample = 1;
262 else 264 else
263 this->hidden->type = AHIST_S32S; 265 this->hidden->type = AHIST_S32S;
264 break; 266 break;
265 267
266 default: 268 default:
269 valid_datatype = 0;
267 test_format = SDL_NextAudioFormat(); 270 test_format = SDL_NextAudioFormat();
268 break; 271 break;
269 } 272 }
270 } 273 }
271 274
272 if (!test_format) { /* shouldn't happen, but just in case... */ 275 if (!valid_datatype) { /* shouldn't happen, but just in case... */
273 SDL_SetError("Unsupported audio format"); 276 SDL_SetError("Unsupported audio format");
274 return (-1); 277 return (-1);
275 } 278 }
276 279
277 if (spec->channels > 2) { 280 if (spec->channels > 2) {