MiNT audio driver cleanups for clamping types and channels to supported
authorRyan C. Gordon <icculus@icculus.org>
Fri, 01 Sep 2006 06:32:54 +0000
changeset 200545af7d69f8eb
parent 2004 c27292a690b7
child 2006 b3741f227757
MiNT audio driver cleanups for clamping types and channels to supported
values. int32 support now available in one instance.
src/audio/mint/SDL_mintaudio_dma8.c
src/audio/mint/SDL_mintaudio_gsxb.c
src/audio/mint/SDL_mintaudio_mcsn.c
src/audio/mint/SDL_mintaudio_stfa.c
src/audio/mint/SDL_mintaudio_xbios.c
     1.1 --- a/src/audio/mint/SDL_mintaudio_dma8.c	Fri Sep 01 06:01:03 2006 +0000
     1.2 +++ b/src/audio/mint/SDL_mintaudio_dma8.c	Fri Sep 01 06:32:54 2006 +0000
     1.3 @@ -218,12 +218,17 @@
     1.4      int i, masterprediv, sfreq;
     1.5      unsigned long masterclock;
     1.6  
     1.7 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff));
     1.8 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
     1.9 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    1.10 +    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
    1.11 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    1.12 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
    1.13 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
    1.14      DEBUG_PRINT(("channels=%d, ", spec->channels));
    1.15      DEBUG_PRINT(("freq=%d\n", spec->freq));
    1.16  
    1.17 +    if (spec->channels > 2) {
    1.18 +        spec->channels = 2;  /* no more than stereo! */
    1.19 +    }
    1.20 +
    1.21      /* Check formats available */
    1.22      spec->format = AUDIO_S8;
    1.23  
    1.24 @@ -269,9 +274,10 @@
    1.25      MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
    1.26      spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
    1.27  
    1.28 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff));
    1.29 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
    1.30 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    1.31 +    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
    1.32 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    1.33 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
    1.34 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
    1.35      DEBUG_PRINT(("channels=%d, ", spec->channels));
    1.36      DEBUG_PRINT(("freq=%d\n", spec->freq));
    1.37  
     2.1 --- a/src/audio/mint/SDL_mintaudio_gsxb.c	Fri Sep 01 06:01:03 2006 +0000
     2.2 +++ b/src/audio/mint/SDL_mintaudio_gsxb.c	Fri Sep 01 06:32:54 2006 +0000
     2.3 @@ -208,38 +208,70 @@
     2.4  {
     2.5      long snd_format;
     2.6      int i, resolution, format_signed, format_bigendian;
     2.7 +    SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
     2.8 +    int valid_datatype = 0;
     2.9  
    2.10 -    resolution = spec->format & 0x00ff;
    2.11 -    format_signed = ((spec->format & 0x8000) != 0);
    2.12 -    format_bigendian = ((spec->format & 0x1000) != 0);
    2.13 +    resolution = SDL_AUDIO_BITSIZE(spec->format);
    2.14 +    format_signed = SDL_AUDIO_ISSIGNED(spec->format);
    2.15 +    format_bigendian = SDL_AUDIO_ISBIGENDIAN(spec->format);
    2.16  
    2.17 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff));
    2.18 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
    2.19 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    2.20 +    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", resolution));
    2.21 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    2.22 +    DEBUG_PRINT(("signed=%d, ", format_signed));
    2.23 +    DEBUG_PRINT(("big endian=%d, ", format_bigendian));
    2.24      DEBUG_PRINT(("channels=%d, ", spec->channels));
    2.25      DEBUG_PRINT(("freq=%d\n", spec->freq));
    2.26  
    2.27 -    /* Check formats available */
    2.28 -    snd_format = Sndstatus(SND_QUERYFORMATS);
    2.29 -    switch (resolution) {
    2.30 -    case 8:
    2.31 -        if ((snd_format & SND_FORMAT8) == 0) {
    2.32 -            SDL_SetError("Mint_CheckAudio: 8 bits samples not supported");
    2.33 -            return -1;
    2.34 +    if (spec->channels > 2) {
    2.35 +        spec->channels = 2;  /* no more than stereo! */
    2.36 +    }
    2.37 +
    2.38 +    while ((!valid_datatype) && (test_format)) {
    2.39 +        spec->format = test_format;
    2.40 +        switch (test_format) {
    2.41 +            case AUDIO_U8:
    2.42 +            case AUDIO_S8:
    2.43 +            case AUDIO_U16LSB:
    2.44 +            case AUDIO_S16LSB:
    2.45 +            case AUDIO_U16MSB:
    2.46 +            case AUDIO_S16MSB:
    2.47 +            case AUDIO_S32LSB:
    2.48 +            case AUDIO_S32MSB:
    2.49 +            /* no float support... */
    2.50 +                resolution = SDL_AUDIO_BITSIZE(spec->format);
    2.51 +                format_signed = SDL_AUDIO_ISSIGNED(spec->format);
    2.52 +                format_bigendian = SDL_AUDIO_ISBIGENDIAN(spec->format);
    2.53 +
    2.54 +                /* Check formats available */
    2.55 +                snd_format = Sndstatus(SND_QUERYFORMATS);
    2.56 +                switch (resolution) {
    2.57 +                    case 8:
    2.58 +                        if (snd_format & SND_FORMAT8) {
    2.59 +                            valid_datatype = 1;
    2.60 +                            snd_format = Sndstatus(SND_QUERY8BIT);
    2.61 +                        }
    2.62 +                        break;
    2.63 +                    case 16:
    2.64 +                        if (snd_format & SND_FORMAT16) {
    2.65 +                            valid_datatype = 1;
    2.66 +                            snd_format = Sndstatus(SND_QUERY16BIT);
    2.67 +                        }
    2.68 +                        break;
    2.69 +                    case 32:
    2.70 +                        if (snd_format & SND_FORMAT32) {
    2.71 +                            valid_datatype = 1;
    2.72 +                            snd_format = Sndstatus(SND_QUERY32BIT);
    2.73 +                        }
    2.74 +                        break;
    2.75 +                }
    2.76 +
    2.77 +                break;
    2.78          }
    2.79 -        snd_format = Sndstatus(SND_QUERY8BIT);
    2.80 -        break;
    2.81 -    case 16:
    2.82 -        if ((snd_format & SND_FORMAT16) == 0) {
    2.83 -            SDL_SetError("Mint_CheckAudio: 16 bits samples not supported");
    2.84 -            return -1;
    2.85 -        }
    2.86 -        snd_format = Sndstatus(SND_QUERY16BIT);
    2.87 -        break;
    2.88 -    default:
    2.89 -        SDL_SetError("Mint_CheckAudio: Unsupported sample resolution");
    2.90 -        return -1;
    2.91 -        break;
    2.92 +    }
    2.93 +
    2.94 +    if (!valid_datatype) {
    2.95 +        SDL_SetError("Unsupported audio format");
    2.96 +        return (-1);
    2.97      }
    2.98  
    2.99      /* Check signed/unsigned format */
   2.100 @@ -248,14 +280,14 @@
   2.101              /* Ok */
   2.102          } else if (snd_format & SND_FORMATUNSIGNED) {
   2.103              /* Give unsigned format */
   2.104 -            spec->format = spec->format & (~0x8000);
   2.105 +            spec->format = spec->format & (~SDL_AUDIO_MASK_SIGNED);
   2.106          }
   2.107      } else {
   2.108          if (snd_format & SND_FORMATUNSIGNED) {
   2.109              /* Ok */
   2.110          } else if (snd_format & SND_FORMATSIGNED) {
   2.111              /* Give signed format */
   2.112 -            spec->format |= 0x8000;
   2.113 +            spec->format |= SDL_AUDIO_MASK_SIGNED;
   2.114          }
   2.115      }
   2.116  
   2.117 @@ -264,14 +296,14 @@
   2.118              /* Ok */
   2.119          } else if (snd_format & SND_FORMATLITTLEENDIAN) {
   2.120              /* Give little endian format */
   2.121 -            spec->format = spec->format & (~0x1000);
   2.122 +            spec->format = spec->format & (~SDL_AUDIO_MASK_ENDIAN);
   2.123          }
   2.124      } else {
   2.125          if (snd_format & SND_FORMATLITTLEENDIAN) {
   2.126              /* Ok */
   2.127          } else if (snd_format & SND_FORMATBIGENDIAN) {
   2.128              /* Give big endian format */
   2.129 -            spec->format |= 0x1000;
   2.130 +            spec->format |= SDL_AUDIO_MASK_ENDIAN;
   2.131          }
   2.132      }
   2.133  
   2.134 @@ -296,9 +328,10 @@
   2.135      MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
   2.136      spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
   2.137  
   2.138 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff));
   2.139 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
   2.140 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
   2.141 +    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
   2.142 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
   2.143 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
   2.144 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
   2.145      DEBUG_PRINT(("channels=%d, ", spec->channels));
   2.146      DEBUG_PRINT(("freq=%d\n", spec->freq));
   2.147  
   2.148 @@ -319,7 +352,7 @@
   2.149      Setmontracks(0);
   2.150  
   2.151      /* Select replay format */
   2.152 -    switch (spec->format & 0xff) {
   2.153 +    switch (SDL_AUDIO_BITSIZE(spec->format)) {
   2.154      case 8:
   2.155          if (spec->channels == 2) {
   2.156              channels_mode = STEREO8;
   2.157 @@ -334,6 +367,13 @@
   2.158              channels_mode = MONO16;
   2.159          }
   2.160          break;
   2.161 +    case 32:
   2.162 +        if (spec->channels == 2) {
   2.163 +            channels_mode = STEREO32;
   2.164 +        } else {
   2.165 +            channels_mode = MONO32;
   2.166 +        }
   2.167 +        break;
   2.168      default:
   2.169          channels_mode = STEREO16;
   2.170          break;
     3.1 --- a/src/audio/mint/SDL_mintaudio_mcsn.c	Fri Sep 01 06:01:03 2006 +0000
     3.2 +++ b/src/audio/mint/SDL_mintaudio_mcsn.c	Fri Sep 01 06:32:54 2006 +0000
     3.3 @@ -225,18 +225,23 @@
     3.4      int i;
     3.5      unsigned long masterclock, masterprediv;
     3.6  
     3.7 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff));
     3.8 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
     3.9 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    3.10 +    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
    3.11 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    3.12 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
    3.13 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
    3.14      DEBUG_PRINT(("channels=%d, ", spec->channels));
    3.15      DEBUG_PRINT(("freq=%d\n", spec->freq));
    3.16  
    3.17 +    if (spec->channels > 2) {
    3.18 +        spec->channels = 2;  /* no more than stereo! */
    3.19 +    }
    3.20 +
    3.21      /* Check formats available */
    3.22      MINTAUDIO_freqcount = 0;
    3.23      switch (cookie_mcsn->play) {
    3.24      case MCSN_ST:
    3.25          spec->channels = 1;
    3.26 -        spec->format = 8;       /* FIXME: is it signed or unsigned ? */
    3.27 +        spec->format = AUDIO_S8;     /* FIXME: is it signed or unsigned ? */
    3.28          SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1);
    3.29          break;
    3.30      case MCSN_TT:              /* Also STE, Mega STE */
    3.31 @@ -274,9 +279,9 @@
    3.32                                             (1 << i) - 1, -1);
    3.33              }
    3.34          }
    3.35 -        spec->format |= 0x8000; /* Audio is always signed */
    3.36 -        if ((spec->format & 0x00ff) == 16) {
    3.37 -            spec->format |= 0x1000;     /* Audio is always big endian */
    3.38 +        spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
    3.39 +        if ((SDL_AUDIO_BITSIZE(spec->format)) == 16) {
    3.40 +            spec->format |= SDL_AUDIO_MASK_ENDIAN;   /* Audio is always big endian */
    3.41              spec->channels = 2; /* 16 bits always stereo */
    3.42          }
    3.43          break;
    3.44 @@ -294,9 +299,10 @@
    3.45      MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
    3.46      spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
    3.47  
    3.48 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff));
    3.49 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
    3.50 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    3.51 +    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
    3.52 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    3.53 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
    3.54 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
    3.55      DEBUG_PRINT(("channels=%d, ", spec->channels));
    3.56      DEBUG_PRINT(("freq=%d\n", spec->freq));
    3.57  
    3.58 @@ -321,7 +327,7 @@
    3.59  
    3.60      /* Select replay format */
    3.61      channels_mode = STEREO16;
    3.62 -    switch (spec->format & 0xff) {
    3.63 +    switch (SDL_AUDIO_BITSIZE(spec->format)) {
    3.64      case 8:
    3.65          if (spec->channels == 2) {
    3.66              channels_mode = STEREO8;
     4.1 --- a/src/audio/mint/SDL_mintaudio_stfa.c	Fri Sep 01 06:01:03 2006 +0000
     4.2 +++ b/src/audio/mint/SDL_mintaudio_stfa.c	Fri Sep 01 06:32:54 2006 +0000
     4.3 @@ -206,12 +206,21 @@
     4.4  {
     4.5      int i;
     4.6  
     4.7 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff));
     4.8 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
     4.9 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    4.10 +    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
    4.11 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    4.12 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
    4.13 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
    4.14      DEBUG_PRINT(("channels=%d, ", spec->channels));
    4.15      DEBUG_PRINT(("freq=%d\n", spec->freq));
    4.16  
    4.17 +    if (SDL_AUDIO_BITSIZE(spec->format) > 16) {
    4.18 +        spec->format = AUDIO_S16SYS;  /* clamp out int32/float32 ... */
    4.19 +    }
    4.20 +
    4.21 +    if (spec->channels > 2) {
    4.22 +        spec->channels = 2;  /* no more than stereo! */
    4.23 +    }
    4.24 +
    4.25      /* Check formats available */
    4.26      MINTAUDIO_freqcount = 0;
    4.27      for (i = 0; i < 16; i++) {
    4.28 @@ -230,9 +239,10 @@
    4.29      MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
    4.30      spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
    4.31  
    4.32 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff));
    4.33 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
    4.34 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    4.35 +    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
    4.36 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    4.37 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
    4.38 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
    4.39      DEBUG_PRINT(("channels=%d, ", spec->channels));
    4.40      DEBUG_PRINT(("freq=%d\n", spec->freq));
    4.41  
    4.42 @@ -255,7 +265,7 @@
    4.43      /* Select replay format */
    4.44      cookie_stfa->sound_control =
    4.45          MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
    4.46 -    if ((spec->format & 0xff) == 8) {
    4.47 +    if (SDL_AUDIO_BITSIZE(spec->format) == 8) {
    4.48          cookie_stfa->sound_control |= STFA_FORMAT_8BIT;
    4.49      } else {
    4.50          cookie_stfa->sound_control |= STFA_FORMAT_16BIT;
    4.51 @@ -265,12 +275,12 @@
    4.52      } else {
    4.53          cookie_stfa->sound_control |= STFA_FORMAT_MONO;
    4.54      }
    4.55 -    if ((spec->format & 0x8000) != 0) {
    4.56 +    if (SDL_AUDIO_ISSIGNED(spec->format) != 0) {
    4.57          cookie_stfa->sound_control |= STFA_FORMAT_SIGNED;
    4.58      } else {
    4.59          cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED;
    4.60      }
    4.61 -    if ((spec->format & 0x1000) != 0) {
    4.62 +    if (SDL_AUDIO_ISBIGENDIAN(spec->format) != 0) {
    4.63          cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN;
    4.64      } else {
    4.65          cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN;
     5.1 --- a/src/audio/mint/SDL_mintaudio_xbios.c	Fri Sep 01 06:01:03 2006 +0000
     5.2 +++ b/src/audio/mint/SDL_mintaudio_xbios.c	Fri Sep 01 06:32:54 2006 +0000
     5.3 @@ -359,16 +359,21 @@
     5.4      int i;
     5.5      Uint32 extclock;
     5.6  
     5.7 -    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff));
     5.8 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
     5.9 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    5.10 +    DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
    5.11 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    5.12 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
    5.13 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
    5.14      DEBUG_PRINT(("channels=%d, ", spec->channels));
    5.15      DEBUG_PRINT(("freq=%d\n", spec->freq));
    5.16  
    5.17 -    spec->format |= 0x8000;     /* Audio is always signed */
    5.18 -    if ((spec->format & 0x00ff) == 16) {
    5.19 -        spec->format |= 0x1000; /* Audio is always big endian */
    5.20 +    spec->format |= SDL_AUDIO_MASK_SIGNED;     /* Audio is always signed */
    5.21 +
    5.22 +    /* clamp out int32/float32 */
    5.23 +    if (SDL_AUDIO_BITSIZE(spec->format) >= 16) {
    5.24 +        spec->format = AUDIO_S16MSB; /* Audio is always big endian */
    5.25          spec->channels = 2;     /* 16 bits always stereo */
    5.26 +    } else if (spec->channels > 2) {
    5.27 +        spec->channels = 2;  /* no more than stereo! */
    5.28      }
    5.29  
    5.30      MINTAUDIO_freqcount = 0;
    5.31 @@ -400,9 +405,10 @@
    5.32      MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
    5.33      spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
    5.34  
    5.35 -    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff));
    5.36 -    DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
    5.37 -    DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
    5.38 +    DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
    5.39 +    DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
    5.40 +    DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
    5.41 +    DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
    5.42      DEBUG_PRINT(("channels=%d, ", spec->channels));
    5.43      DEBUG_PRINT(("freq=%d\n", spec->freq));
    5.44  
    5.45 @@ -427,7 +433,7 @@
    5.46  
    5.47      /* Select replay format */
    5.48      channels_mode = STEREO16;
    5.49 -    switch (spec->format & 0xff) {
    5.50 +    switch (SDL_AUDIO_BITSIZE(spec->format)) {
    5.51      case 8:
    5.52          if (spec->channels == 2) {
    5.53              channels_mode = STEREO8;