Fixed silly logic thing.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 31 Aug 2006 22:22:34 +0000
changeset 1998cbac0f77a799
parent 1997 46319c67b3d7
child 1999 dd4b184b3050
Fixed silly logic thing.
src/audio/amigaos/SDL_ahiaudio.c
src/audio/baudio/SDL_beaudio.cc
     1.1 --- a/src/audio/amigaos/SDL_ahiaudio.c	Thu Aug 31 22:15:07 2006 +0000
     1.2 +++ b/src/audio/amigaos/SDL_ahiaudio.c	Thu Aug 31 22:22:34 2006 +0000
     1.3 @@ -227,16 +227,14 @@
     1.4  {
     1.5  //      int width;
     1.6      SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
     1.7 -    int valid_datatype = 0;
     1.8  
     1.9      D(bug("AHI opening...\n"));
    1.10  
    1.11      /* Determine the audio parameters from the AudioSpec */
    1.12 -    while ((!valid_datatype) && (test_format)) {
    1.13 +    while (test_format) {
    1.14          switch (test_format) {
    1.15              case AUDIO_S8:
    1.16                  D(bug("AUDIO_S8...\n"));
    1.17 -                valid_datatype = 1;
    1.18                  spec->format = AUDIO_S8;
    1.19                  this->hidden->bytespersample = 1;
    1.20                  if (spec->channels < 2)
    1.21 @@ -247,7 +245,6 @@
    1.22  
    1.23              case AUDIO_S16MSB:
    1.24                  D(bug("AUDIO_S16MSB...\n"));
    1.25 -                valid_datatype = 1;
    1.26                  spec->format = AUDIO_S16MSB;
    1.27                  this->hidden->bytespersample = 2;
    1.28                  if (spec->channels < 2)
    1.29 @@ -258,7 +255,6 @@
    1.30  
    1.31              case AUDIO_S32MSB:
    1.32                  D(bug("AUDIO_S32MSB...\n"));
    1.33 -                valid_datatype = 1;
    1.34                  spec->format = AUDIO_S32MSB;
    1.35                  this->hidden->bytespersample = 4;
    1.36                  if (spec->channels < 2)
    1.37 @@ -273,7 +269,7 @@
    1.38          }
    1.39      }
    1.40  
    1.41 -    if (!valid_datatype) { /* shouldn't happen, but just in case... */
    1.42 +    if (!test_format) { /* shouldn't happen, but just in case... */
    1.43          SDL_SetError("Unsupported audio format");
    1.44          return (-1);
    1.45      }
     2.1 --- a/src/audio/baudio/SDL_beaudio.cc	Thu Aug 31 22:15:07 2006 +0000
     2.2 +++ b/src/audio/baudio/SDL_beaudio.cc	Thu Aug 31 22:22:34 2006 +0000
     2.3 @@ -157,55 +157,46 @@
     2.4      {
     2.5          media_raw_audio_format format;
     2.6          SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
     2.7 -        int valid_datatype = 0;
     2.8  
     2.9          /* Parse the audio format and fill the Be raw audio format */
    2.10          memset(&format, '\0', sizeof (media_raw_audio_format));
    2.11          format.byte_order = B_MEDIA_LITTLE_ENDIAN;
    2.12          format.frame_rate = (float) spec->freq;
    2.13          format.channel_count = spec->channels;  /* !!! FIXME: support > 2? */
    2.14 -        while ((!valid_datatype) && (test_format)) {
    2.15 +        while (test_format) {
    2.16              spec->format = test_format;
    2.17              switch (test_format) {
    2.18                  case AUDIO_S8:
    2.19 -                    valid_datatype = 1;
    2.20                      format.format = media_raw_audio_format::B_AUDIO_CHAR;
    2.21                      break;
    2.22  
    2.23                  case AUDIO_U8:
    2.24 -                    valid_datatype = 1;
    2.25                      format.format = media_raw_audio_format::B_AUDIO_UCHAR;
    2.26                      break;
    2.27  
    2.28                  case AUDIO_S16LSB:
    2.29 -                    valid_datatype = 1;
    2.30                      format.format = media_raw_audio_format::B_AUDIO_SHORT;
    2.31                      break;
    2.32  
    2.33                  case AUDIO_S16MSB:
    2.34 -                    valid_datatype = 1;
    2.35                      format.format = media_raw_audio_format::B_AUDIO_SHORT;
    2.36                      format.byte_order = B_MEDIA_BIG_ENDIAN;
    2.37                      break;
    2.38  
    2.39                  case AUDIO_S32LSB:
    2.40 -                    valid_datatype = 1;
    2.41                      format.format = media_raw_audio_format::B_AUDIO_INT;
    2.42                      break;
    2.43  
    2.44                  case AUDIO_S32MSB:
    2.45 -                    valid_datatype = 1;
    2.46                      format.format = media_raw_audio_format::B_AUDIO_INT;
    2.47                      format.byte_order = B_MEDIA_BIG_ENDIAN;
    2.48                      break;
    2.49  
    2.50                  case AUDIO_F32LSB:
    2.51 -                    valid_datatype = 1;
    2.52                      format.format = media_raw_audio_format::B_AUDIO_FLOAT;
    2.53                      break;
    2.54  
    2.55                  case AUDIO_F32MSB:
    2.56 -                    valid_datatype = 1;
    2.57                      format.format = media_raw_audio_format::B_AUDIO_FLOAT;
    2.58                      format.byte_order = B_MEDIA_BIG_ENDIAN;
    2.59                      break;
    2.60 @@ -218,7 +209,7 @@
    2.61  
    2.62          format.buffer_size = spec->samples;
    2.63  
    2.64 -        if (!valid_datatype) { /* shouldn't happen, but just in case... */
    2.65 +        if (!test_format) { /* shouldn't happen, but just in case... */
    2.66              SDL_SetError("Unsupported audio format");
    2.67              return (-1);
    2.68          }