comparison src/audio/amigaos/SDL_ahiaudio.c @ 1998:cbac0f77a799

Fixed silly logic thing.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 31 Aug 2006 22:22:34 +0000
parents f25d771fe6f2
children 02108bfd6550
comparison
equal deleted inserted replaced
1997:46319c67b3d7 1998:cbac0f77a799
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 = 0;
231 230
232 D(bug("AHI opening...\n")); 231 D(bug("AHI opening...\n"));
233 232
234 /* Determine the audio parameters from the AudioSpec */ 233 /* Determine the audio parameters from the AudioSpec */
235 while ((!valid_datatype) && (test_format)) { 234 while (test_format) {
236 switch (test_format) { 235 switch (test_format) {
237 case AUDIO_S8: 236 case AUDIO_S8:
238 D(bug("AUDIO_S8...\n")); 237 D(bug("AUDIO_S8...\n"));
239 valid_datatype = 1;
240 spec->format = AUDIO_S8; 238 spec->format = AUDIO_S8;
241 this->hidden->bytespersample = 1; 239 this->hidden->bytespersample = 1;
242 if (spec->channels < 2) 240 if (spec->channels < 2)
243 this->hidden->type = AHIST_M8S; 241 this->hidden->type = AHIST_M8S;
244 else 242 else
245 this->hidden->type = AHIST_S8S; 243 this->hidden->type = AHIST_S8S;
246 break; 244 break;
247 245
248 case AUDIO_S16MSB: 246 case AUDIO_S16MSB:
249 D(bug("AUDIO_S16MSB...\n")); 247 D(bug("AUDIO_S16MSB...\n"));
250 valid_datatype = 1;
251 spec->format = AUDIO_S16MSB; 248 spec->format = AUDIO_S16MSB;
252 this->hidden->bytespersample = 2; 249 this->hidden->bytespersample = 2;
253 if (spec->channels < 2) 250 if (spec->channels < 2)
254 this->hidden->type = AHIST_M16S; 251 this->hidden->type = AHIST_M16S;
255 else 252 else
256 this->hidden->type = AHIST_S16S; 253 this->hidden->type = AHIST_S16S;
257 break; 254 break;
258 255
259 case AUDIO_S32MSB: 256 case AUDIO_S32MSB:
260 D(bug("AUDIO_S32MSB...\n")); 257 D(bug("AUDIO_S32MSB...\n"));
261 valid_datatype = 1;
262 spec->format = AUDIO_S32MSB; 258 spec->format = AUDIO_S32MSB;
263 this->hidden->bytespersample = 4; 259 this->hidden->bytespersample = 4;
264 if (spec->channels < 2) 260 if (spec->channels < 2)
265 this->hidden->type = AHIST_M32S; 261 this->hidden->type = AHIST_M32S;
266 else 262 else
271 test_format = SDL_NextAudioFormat(); 267 test_format = SDL_NextAudioFormat();
272 break; 268 break;
273 } 269 }
274 } 270 }
275 271
276 if (!valid_datatype) { /* shouldn't happen, but just in case... */ 272 if (!test_format) { /* shouldn't happen, but just in case... */
277 SDL_SetError("Unsupported audio format"); 273 SDL_SetError("Unsupported audio format");
278 return (-1); 274 return (-1);
279 } 275 }
280 276
281 if (spec->channels > 2) { 277 if (spec->channels > 2) {