src/audio/SDL_mixer.c
changeset 1895 c121d94672cb
parent 1442 e3242177fe4a
child 1982 3b4ce57c6215
     1.1 --- a/src/audio/SDL_mixer.c	Thu Jul 06 18:01:37 2006 +0000
     1.2 +++ b/src/audio/SDL_mixer.c	Mon Jul 10 21:04:37 2006 +0000
     1.3 @@ -35,224 +35,227 @@
     1.4   * the value to avoid overflow.  (used with permission from ARDI)
     1.5   * Changed to use 0xFE instead of 0xFF for better sound quality.
     1.6   */
     1.7 -static const Uint8 mix8[] =
     1.8 -{
     1.9 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.10 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.11 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.12 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.13 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.14 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.15 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.16 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.17 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.18 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.19 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.20 -  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03,
    1.21 -  0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
    1.22 -  0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
    1.23 -  0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24,
    1.24 -  0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
    1.25 -  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
    1.26 -  0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
    1.27 -  0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
    1.28 -  0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B,
    1.29 -  0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
    1.30 -  0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71,
    1.31 -  0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
    1.32 -  0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
    1.33 -  0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92,
    1.34 -  0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D,
    1.35 -  0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8,
    1.36 -  0xA9, 0xAA, 0xAB, 0xAC, 0xAD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xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
    1.51 -  0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
    1.52 -  0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
    1.53 -  0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
    1.54 -  0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
    1.55 -  0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE
    1.56 +static const Uint8 mix8[] = {
    1.57 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.58 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.59 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.60 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.61 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.62 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.63 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.64 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.65 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.66 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.67 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1.68 +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03,
    1.69 +    0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
    1.70 +    0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
    1.71 +    0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24,
    1.72 +    0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
    1.73 +    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
    1.74 +    0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
    1.75 +    0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
    1.76 +    0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B,
    1.77 +    0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
    1.78 +    0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71,
    1.79 +    0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
    1.80 +    0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
    1.81 +    0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92,
    1.82 +    0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 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E, 0xFE,
    1.97 +    0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
    1.98 +    0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
    1.99 +    0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
   1.100 +    0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
   1.101 +    0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
   1.102 +    0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
   1.103 +    0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE
   1.104  };
   1.105  
   1.106  /* The volume ranges from 0 - 128 */
   1.107  #define ADJUST_VOLUME(s, v)	(s = (s*v)/SDL_MIX_MAXVOLUME)
   1.108  #define ADJUST_VOLUME_U8(s, v)	(s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
   1.109  
   1.110 -void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume)
   1.111 +void
   1.112 +SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume)
   1.113  {
   1.114 -	Uint16 format;
   1.115 +    Uint16 format;
   1.116  
   1.117 -	if ( volume == 0 ) {
   1.118 -		return;
   1.119 -	}
   1.120 -	/* Mix the user-level audio format */
   1.121 -	if ( current_audio ) {
   1.122 -		if ( current_audio->convert.needed ) {
   1.123 -			format = current_audio->convert.src_format;
   1.124 -		} else {
   1.125 -			format = current_audio->spec.format;
   1.126 -		}
   1.127 -	} else {
   1.128 -  		/* HACK HACK HACK */
   1.129 -		format = AUDIO_S16;
   1.130 -	}
   1.131 -	switch (format) {
   1.132 +    if (volume == 0) {
   1.133 +        return;
   1.134 +    }
   1.135 +    /* Mix the user-level audio format */
   1.136 +    if (current_audio) {
   1.137 +        if (current_audio->convert.needed) {
   1.138 +            format = current_audio->convert.src_format;
   1.139 +        } else {
   1.140 +            format = current_audio->spec.format;
   1.141 +        }
   1.142 +    } else {
   1.143 +        /* HACK HACK HACK */
   1.144 +        format = AUDIO_S16;
   1.145 +    }
   1.146 +    switch (format) {
   1.147  
   1.148 -		case AUDIO_U8: {
   1.149 +    case AUDIO_U8:
   1.150 +        {
   1.151  #if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
   1.152 -			SDL_MixAudio_m68k_U8((char*)dst,(char*)src,(unsigned long)len,(long)volume,(char *)mix8);
   1.153 +            SDL_MixAudio_m68k_U8((char *) dst, (char *) src,
   1.154 +                                 (unsigned long) len, (long) volume,
   1.155 +                                 (char *) mix8);
   1.156  #else
   1.157 -			Uint8 src_sample;
   1.158 +            Uint8 src_sample;
   1.159  
   1.160 -			while ( len-- ) {
   1.161 -				src_sample = *src;
   1.162 -				ADJUST_VOLUME_U8(src_sample, volume);
   1.163 -				*dst = mix8[*dst+src_sample];
   1.164 -				++dst;
   1.165 -				++src;
   1.166 -			}
   1.167 +            while (len--) {
   1.168 +                src_sample = *src;
   1.169 +                ADJUST_VOLUME_U8(src_sample, volume);
   1.170 +                *dst = mix8[*dst + src_sample];
   1.171 +                ++dst;
   1.172 +                ++src;
   1.173 +            }
   1.174  #endif
   1.175 -		}
   1.176 -		break;
   1.177 +        }
   1.178 +        break;
   1.179  
   1.180 -		case AUDIO_S8: {
   1.181 +    case AUDIO_S8:
   1.182 +        {
   1.183  #if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
   1.184 -			if (SDL_HasMMX())
   1.185 -			{
   1.186 -				SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   1.187 -			}
   1.188 -			else
   1.189 +            if (SDL_HasMMX()) {
   1.190 +                SDL_MixAudio_MMX_S8((char *) dst, (char *) src,
   1.191 +                                    (unsigned int) len, (int) volume);
   1.192 +            } else
   1.193  #elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
   1.194 -			if (SDL_HasMMX())
   1.195 -			{
   1.196 -				SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   1.197 -			}
   1.198 -			else
   1.199 +            if (SDL_HasMMX()) {
   1.200 +                SDL_MixAudio_MMX_S8_VC((char *) dst, (char *) src,
   1.201 +                                       (unsigned int) len, (int) volume);
   1.202 +            } else
   1.203  #endif
   1.204  #if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
   1.205 -			SDL_MixAudio_m68k_S8((char*)dst,(char*)src,(unsigned long)len,(long)volume);
   1.206 +                SDL_MixAudio_m68k_S8((char *) dst, (char *) src,
   1.207 +                                     (unsigned long) len, (long) volume);
   1.208  #else
   1.209 -			{
   1.210 -			Sint8 *dst8, *src8;
   1.211 -			Sint8 src_sample;
   1.212 -			int dst_sample;
   1.213 -			const int max_audioval = ((1<<(8-1))-1);
   1.214 -			const int min_audioval = -(1<<(8-1));
   1.215 +            {
   1.216 +                Sint8 *dst8, *src8;
   1.217 +                Sint8 src_sample;
   1.218 +                int dst_sample;
   1.219 +                const int max_audioval = ((1 << (8 - 1)) - 1);
   1.220 +                const int min_audioval = -(1 << (8 - 1));
   1.221  
   1.222 -			src8 = (Sint8 *)src;
   1.223 -			dst8 = (Sint8 *)dst;
   1.224 -			while ( len-- ) {
   1.225 -				src_sample = *src8;
   1.226 -				ADJUST_VOLUME(src_sample, volume);
   1.227 -				dst_sample = *dst8 + src_sample;
   1.228 -				if ( dst_sample > max_audioval ) {
   1.229 -					*dst8 = max_audioval;
   1.230 -				} else
   1.231 -				if ( dst_sample < min_audioval ) {
   1.232 -					*dst8 = min_audioval;
   1.233 -				} else {
   1.234 -					*dst8 = dst_sample;
   1.235 -				}
   1.236 -				++dst8;
   1.237 -				++src8;
   1.238 -			}
   1.239 -			}
   1.240 +                src8 = (Sint8 *) src;
   1.241 +                dst8 = (Sint8 *) dst;
   1.242 +                while (len--) {
   1.243 +                    src_sample = *src8;
   1.244 +                    ADJUST_VOLUME(src_sample, volume);
   1.245 +                    dst_sample = *dst8 + src_sample;
   1.246 +                    if (dst_sample > max_audioval) {
   1.247 +                        *dst8 = max_audioval;
   1.248 +                    } else if (dst_sample < min_audioval) {
   1.249 +                        *dst8 = min_audioval;
   1.250 +                    } else {
   1.251 +                        *dst8 = dst_sample;
   1.252 +                    }
   1.253 +                    ++dst8;
   1.254 +                    ++src8;
   1.255 +                }
   1.256 +            }
   1.257  #endif
   1.258 -		}
   1.259 -		break;
   1.260 +        }
   1.261 +        break;
   1.262  
   1.263 -		case AUDIO_S16LSB: {
   1.264 +    case AUDIO_S16LSB:
   1.265 +        {
   1.266  #if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
   1.267 -			if (SDL_HasMMX())
   1.268 -			{
   1.269 -				SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   1.270 -			}
   1.271 -                        else
   1.272 +            if (SDL_HasMMX()) {
   1.273 +                SDL_MixAudio_MMX_S16((char *) dst, (char *) src,
   1.274 +                                     (unsigned int) len, (int) volume);
   1.275 +            } else
   1.276  #elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
   1.277 -			if (SDL_HasMMX())
   1.278 -			{
   1.279 -				SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   1.280 -			}
   1.281 -			else
   1.282 +            if (SDL_HasMMX()) {
   1.283 +                SDL_MixAudio_MMX_S16_VC((char *) dst, (char *) src,
   1.284 +                                        (unsigned int) len, (int) volume);
   1.285 +            } else
   1.286  #endif
   1.287  #if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
   1.288 -			SDL_MixAudio_m68k_S16LSB((short*)dst,(short*)src,(unsigned long)len,(long)volume);
   1.289 +                SDL_MixAudio_m68k_S16LSB((short *) dst, (short *) src,
   1.290 +                                         (unsigned long) len, (long) volume);
   1.291  #else
   1.292 -			{
   1.293 -			Sint16 src1, src2;
   1.294 -			int dst_sample;
   1.295 -			const int max_audioval = ((1<<(16-1))-1);
   1.296 -			const int min_audioval = -(1<<(16-1));
   1.297 +            {
   1.298 +                Sint16 src1, src2;
   1.299 +                int dst_sample;
   1.300 +                const int max_audioval = ((1 << (16 - 1)) - 1);
   1.301 +                const int min_audioval = -(1 << (16 - 1));
   1.302  
   1.303 -			len /= 2;
   1.304 -			while ( len-- ) {
   1.305 -				src1 = ((src[1])<<8|src[0]);
   1.306 -				ADJUST_VOLUME(src1, volume);
   1.307 -				src2 = ((dst[1])<<8|dst[0]);
   1.308 -				src += 2;
   1.309 -				dst_sample = src1+src2;
   1.310 -				if ( dst_sample > max_audioval ) {
   1.311 -					dst_sample = max_audioval;
   1.312 -				} else
   1.313 -				if ( dst_sample < min_audioval ) {
   1.314 -					dst_sample = min_audioval;
   1.315 -				}
   1.316 -				dst[0] = dst_sample&0xFF;
   1.317 -				dst_sample >>= 8;
   1.318 -				dst[1] = dst_sample&0xFF;
   1.319 -				dst += 2;
   1.320 -			}
   1.321 -			}
   1.322 +                len /= 2;
   1.323 +                while (len--) {
   1.324 +                    src1 = ((src[1]) << 8 | src[0]);
   1.325 +                    ADJUST_VOLUME(src1, volume);
   1.326 +                    src2 = ((dst[1]) << 8 | dst[0]);
   1.327 +                    src += 2;
   1.328 +                    dst_sample = src1 + src2;
   1.329 +                    if (dst_sample > max_audioval) {
   1.330 +                        dst_sample = max_audioval;
   1.331 +                    } else if (dst_sample < min_audioval) {
   1.332 +                        dst_sample = min_audioval;
   1.333 +                    }
   1.334 +                    dst[0] = dst_sample & 0xFF;
   1.335 +                    dst_sample >>= 8;
   1.336 +                    dst[1] = dst_sample & 0xFF;
   1.337 +                    dst += 2;
   1.338 +                }
   1.339 +            }
   1.340  #endif
   1.341 -		}
   1.342 -		break;
   1.343 +        }
   1.344 +        break;
   1.345  
   1.346 -		case AUDIO_S16MSB: {
   1.347 +    case AUDIO_S16MSB:
   1.348 +        {
   1.349  #if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
   1.350 -			SDL_MixAudio_m68k_S16MSB((short*)dst,(short*)src,(unsigned long)len,(long)volume);
   1.351 +            SDL_MixAudio_m68k_S16MSB((short *) dst, (short *) src,
   1.352 +                                     (unsigned long) len, (long) volume);
   1.353  #else
   1.354 -			Sint16 src1, src2;
   1.355 -			int dst_sample;
   1.356 -			const int max_audioval = ((1<<(16-1))-1);
   1.357 -			const int min_audioval = -(1<<(16-1));
   1.358 +            Sint16 src1, src2;
   1.359 +            int dst_sample;
   1.360 +            const int max_audioval = ((1 << (16 - 1)) - 1);
   1.361 +            const int min_audioval = -(1 << (16 - 1));
   1.362  
   1.363 -			len /= 2;
   1.364 -			while ( len-- ) {
   1.365 -				src1 = ((src[0])<<8|src[1]);
   1.366 -				ADJUST_VOLUME(src1, volume);
   1.367 -				src2 = ((dst[0])<<8|dst[1]);
   1.368 -				src += 2;
   1.369 -				dst_sample = src1+src2;
   1.370 -				if ( dst_sample > max_audioval ) {
   1.371 -					dst_sample = max_audioval;
   1.372 -				} else
   1.373 -				if ( dst_sample < min_audioval ) {
   1.374 -					dst_sample = min_audioval;
   1.375 -				}
   1.376 -				dst[1] = dst_sample&0xFF;
   1.377 -				dst_sample >>= 8;
   1.378 -				dst[0] = dst_sample&0xFF;
   1.379 -				dst += 2;
   1.380 -			}
   1.381 +            len /= 2;
   1.382 +            while (len--) {
   1.383 +                src1 = ((src[0]) << 8 | src[1]);
   1.384 +                ADJUST_VOLUME(src1, volume);
   1.385 +                src2 = ((dst[0]) << 8 | dst[1]);
   1.386 +                src += 2;
   1.387 +                dst_sample = src1 + src2;
   1.388 +                if (dst_sample > max_audioval) {
   1.389 +                    dst_sample = max_audioval;
   1.390 +                } else if (dst_sample < min_audioval) {
   1.391 +                    dst_sample = min_audioval;
   1.392 +                }
   1.393 +                dst[1] = dst_sample & 0xFF;
   1.394 +                dst_sample >>= 8;
   1.395 +                dst[0] = dst_sample & 0xFF;
   1.396 +                dst += 2;
   1.397 +            }
   1.398  #endif
   1.399 -		}
   1.400 -		break;
   1.401 +        }
   1.402 +        break;
   1.403  
   1.404 -		default: /* If this happens... FIXME! */
   1.405 -			SDL_SetError("SDL_MixAudio(): unknown audio format");
   1.406 -			return;
   1.407 -	}
   1.408 +    default:                   /* If this happens... FIXME! */
   1.409 +        SDL_SetError("SDL_MixAudio(): unknown audio format");
   1.410 +        return;
   1.411 +    }
   1.412  }
   1.413  
   1.414 +/* vi: set ts=4 sw=4 expandtab: */