src/audio/SDL_mixer.c
changeset 5536 05af1b9ff46d
parent 5535 96594ac5fd1a
child 6138 4c64952a58fb
     1.1 --- a/src/audio/SDL_mixer.c	Fri Apr 08 13:03:26 2011 -0700
     1.2 +++ b/src/audio/SDL_mixer.c	Fri Apr 08 13:16:33 2011 -0700
     1.3 @@ -26,9 +26,6 @@
     1.4  #include "SDL_timer.h"
     1.5  #include "SDL_audio.h"
     1.6  #include "SDL_sysaudio.h"
     1.7 -#include "SDL_mixer_MMX.h"
     1.8 -#include "SDL_mixer_MMX_VC.h"
     1.9 -#include "SDL_mixer_m68k.h"
    1.10  
    1.11  /* This table is used to add two sound values together and pin
    1.12   * the value to avoid overflow.  (used with permission from ARDI)
    1.13 @@ -121,95 +118,55 @@
    1.14  
    1.15      case AUDIO_S8:
    1.16          {
    1.17 -#if defined(SDL_BUGGY_MMX_MIXERS) /* buggy, so we're disabling them. --ryan. */
    1.18 -#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
    1.19 -            if (SDL_HasMMX()) {
    1.20 -                SDL_MixAudio_MMX_S8((char *) dst, (char *) src,
    1.21 -                                    (unsigned int) len, (int) volume);
    1.22 -            } else
    1.23 -#elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
    1.24 -            if (SDL_HasMMX()) {
    1.25 -                SDL_MixAudio_MMX_S8_VC((char *) dst, (char *) src,
    1.26 -                                       (unsigned int) len, (int) volume);
    1.27 -            } else
    1.28 -#endif
    1.29 -#endif
    1.30 -#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
    1.31 -                SDL_MixAudio_m68k_S8((char *) dst, (char *) src,
    1.32 -                                     (unsigned long) len, (long) volume);
    1.33 -#else
    1.34 -            {
    1.35 -                Sint8 *dst8, *src8;
    1.36 -                Sint8 src_sample;
    1.37 -                int dst_sample;
    1.38 -                const int max_audioval = ((1 << (8 - 1)) - 1);
    1.39 -                const int min_audioval = -(1 << (8 - 1));
    1.40 +            Sint8 *dst8, *src8;
    1.41 +            Sint8 src_sample;
    1.42 +            int dst_sample;
    1.43 +            const int max_audioval = ((1 << (8 - 1)) - 1);
    1.44 +            const int min_audioval = -(1 << (8 - 1));
    1.45  
    1.46 -                src8 = (Sint8 *) src;
    1.47 -                dst8 = (Sint8 *) dst;
    1.48 -                while (len--) {
    1.49 -                    src_sample = *src8;
    1.50 -                    ADJUST_VOLUME(src_sample, volume);
    1.51 -                    dst_sample = *dst8 + src_sample;
    1.52 -                    if (dst_sample > max_audioval) {
    1.53 -                        *dst8 = max_audioval;
    1.54 -                    } else if (dst_sample < min_audioval) {
    1.55 -                        *dst8 = min_audioval;
    1.56 -                    } else {
    1.57 -                        *dst8 = dst_sample;
    1.58 -                    }
    1.59 -                    ++dst8;
    1.60 -                    ++src8;
    1.61 +            src8 = (Sint8 *) src;
    1.62 +            dst8 = (Sint8 *) dst;
    1.63 +            while (len--) {
    1.64 +                src_sample = *src8;
    1.65 +                ADJUST_VOLUME(src_sample, volume);
    1.66 +                dst_sample = *dst8 + src_sample;
    1.67 +                if (dst_sample > max_audioval) {
    1.68 +                    *dst8 = max_audioval;
    1.69 +                } else if (dst_sample < min_audioval) {
    1.70 +                    *dst8 = min_audioval;
    1.71 +                } else {
    1.72 +                    *dst8 = dst_sample;
    1.73                  }
    1.74 +                ++dst8;
    1.75 +                ++src8;
    1.76              }
    1.77 -#endif
    1.78          }
    1.79          break;
    1.80  
    1.81      case AUDIO_S16LSB:
    1.82          {
    1.83 -#if defined(SDL_BUGGY_MMX_MIXERS) /* buggy, so we're disabling them. --ryan. */
    1.84 -#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
    1.85 -            if (SDL_HasMMX()) {
    1.86 -                SDL_MixAudio_MMX_S16((char *) dst, (char *) src,
    1.87 -                                     (unsigned int) len, (int) volume);
    1.88 -            } else
    1.89 -#elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
    1.90 -            if (SDL_HasMMX()) {
    1.91 -                SDL_MixAudio_MMX_S16_VC((char *) dst, (char *) src,
    1.92 -                                        (unsigned int) len, (int) volume);
    1.93 -            } else
    1.94 -#endif
    1.95 -#endif
    1.96 -#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
    1.97 -                SDL_MixAudio_m68k_S16LSB((short *) dst, (short *) src,
    1.98 -                                         (unsigned long) len, (long) volume);
    1.99 -#else
   1.100 -            {
   1.101 -                Sint16 src1, src2;
   1.102 -                int dst_sample;
   1.103 -                const int max_audioval = ((1 << (16 - 1)) - 1);
   1.104 -                const int min_audioval = -(1 << (16 - 1));
   1.105 +            Sint16 src1, src2;
   1.106 +            int dst_sample;
   1.107 +            const int max_audioval = ((1 << (16 - 1)) - 1);
   1.108 +            const int min_audioval = -(1 << (16 - 1));
   1.109  
   1.110 -                len /= 2;
   1.111 -                while (len--) {
   1.112 -                    src1 = ((src[1]) << 8 | src[0]);
   1.113 -                    ADJUST_VOLUME(src1, volume);
   1.114 -                    src2 = ((dst[1]) << 8 | dst[0]);
   1.115 -                    src += 2;
   1.116 -                    dst_sample = src1 + src2;
   1.117 -                    if (dst_sample > max_audioval) {
   1.118 -                        dst_sample = max_audioval;
   1.119 -                    } else if (dst_sample < min_audioval) {
   1.120 -                        dst_sample = min_audioval;
   1.121 -                    }
   1.122 -                    dst[0] = dst_sample & 0xFF;
   1.123 -                    dst_sample >>= 8;
   1.124 -                    dst[1] = dst_sample & 0xFF;
   1.125 -                    dst += 2;
   1.126 +            len /= 2;
   1.127 +            while (len--) {
   1.128 +                src1 = ((src[1]) << 8 | src[0]);
   1.129 +                ADJUST_VOLUME(src1, volume);
   1.130 +                src2 = ((dst[1]) << 8 | dst[0]);
   1.131 +                src += 2;
   1.132 +                dst_sample = src1 + src2;
   1.133 +                if (dst_sample > max_audioval) {
   1.134 +                    dst_sample = max_audioval;
   1.135 +                } else if (dst_sample < min_audioval) {
   1.136 +                    dst_sample = min_audioval;
   1.137                  }
   1.138 +                dst[0] = dst_sample & 0xFF;
   1.139 +                dst_sample >>= 8;
   1.140 +                dst[1] = dst_sample & 0xFF;
   1.141 +                dst += 2;
   1.142              }
   1.143 -#endif
   1.144          }
   1.145          break;
   1.146