src/audio/SDL_audiotypecvt.c
changeset 10575 bb99dede0675
parent 9998 f67cf37e9cd4
child 10608 8661c956c368
     1.1 --- a/src/audio/SDL_audiotypecvt.c	Thu Nov 03 11:10:52 2016 -0400
     1.2 +++ b/src/audio/SDL_audiotypecvt.c	Sat Nov 05 02:34:38 2016 -0400
     1.3 @@ -1,4 +1,3 @@
     1.4 -/* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
     1.5  /*
     1.6    Simple DirectMedia Layer
     1.7    Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
     1.8 @@ -23,15993 +22,396 @@
     1.9  #include "../SDL_internal.h"
    1.10  #include "SDL_audio.h"
    1.11  #include "SDL_audio_c.h"
    1.12 -
    1.13 -#ifndef DEBUG_CONVERT
    1.14 -#define DEBUG_CONVERT 0
    1.15 -#endif
    1.16 -
    1.17 -
    1.18 -/* If you can guarantee your data and need space, you can eliminate code... */
    1.19 -
    1.20 -/* Just build the arbitrary resamplers if you're saving code space. */
    1.21 -#ifndef LESS_RESAMPLERS
    1.22 -#define LESS_RESAMPLERS 0
    1.23 -#endif
    1.24 -
    1.25 -/* Don't build any resamplers if you're REALLY saving code space. */
    1.26 -#ifndef NO_RESAMPLERS
    1.27 -#define NO_RESAMPLERS 0
    1.28 -#endif
    1.29 -
    1.30 -/* Don't build any type converters if you're saving code space. */
    1.31 -#ifndef NO_CONVERTERS
    1.32 -#define NO_CONVERTERS 0
    1.33 -#endif
    1.34 -
    1.35 -
    1.36 -/* *INDENT-OFF* */
    1.37 +#include "SDL_assert.h"
    1.38  
    1.39  #define DIVBY127 0.0078740157480315f
    1.40  #define DIVBY32767 3.05185094759972e-05f
    1.41  #define DIVBY2147483647 4.6566128752458e-10f
    1.42  
    1.43 -#if !NO_CONVERTERS
    1.44 +void SDLCALL
    1.45 +SDL_Convert_S8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
    1.46 +{
    1.47 +    const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
    1.48 +    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
    1.49 +    int i;
    1.50  
    1.51 -static void SDLCALL
    1.52 -SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
    1.53 -{
    1.54 -    int i;
    1.55 -    const Uint8 *src;
    1.56 -    Sint8 *dst;
    1.57 +    LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32");
    1.58  
    1.59 -#if DEBUG_CONVERT
    1.60 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n");
    1.61 -#endif
    1.62 -
    1.63 -    src = (const Uint8 *) cvt->buf;
    1.64 -    dst = (Sint8 *) cvt->buf;
    1.65 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
    1.66 -        const Sint8 val = ((*src) ^ 0x80);
    1.67 -        *dst = ((Sint8) val);
    1.68 +    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
    1.69 +        *dst = (((float) ((Sint8) *src)) * DIVBY127);
    1.70      }
    1.71  
    1.72 +    cvt->len_cvt *= 4;
    1.73      if (cvt->filters[++cvt->filter_index]) {
    1.74 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
    1.75 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
    1.76      }
    1.77  }
    1.78  
    1.79 -static void SDLCALL
    1.80 -SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
    1.81 +void SDLCALL
    1.82 +SDL_Convert_U8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
    1.83  {
    1.84 +    const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
    1.85 +    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
    1.86      int i;
    1.87 -    const Uint8 *src;
    1.88 -    Uint16 *dst;
    1.89  
    1.90 -#if DEBUG_CONVERT
    1.91 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n");
    1.92 -#endif
    1.93 +    LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32");
    1.94  
    1.95 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
    1.96 -    dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
    1.97      for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
    1.98 -        const Uint16 val = (((Uint16) *src) << 8);
    1.99 -        *dst = SDL_SwapLE16(val);
   1.100 +        *dst = ((((float) *src) * DIVBY127) - 1.0f);
   1.101 +    }
   1.102 +
   1.103 +    cvt->len_cvt *= 4;
   1.104 +    if (cvt->filters[++cvt->filter_index]) {
   1.105 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
   1.106 +    }
   1.107 +}
   1.108 +
   1.109 +void SDLCALL
   1.110 +SDL_Convert_S16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
   1.111 +{
   1.112 +    const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.113 +    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.114 +    int i;
   1.115 +
   1.116 +    LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32");
   1.117 +
   1.118 +    for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) {
   1.119 +        *dst = (((float) *src) * DIVBY32767);
   1.120      }
   1.121  
   1.122      cvt->len_cvt *= 2;
   1.123      if (cvt->filters[++cvt->filter_index]) {
   1.124 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
   1.125 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
   1.126      }
   1.127  }
   1.128  
   1.129 -static void SDLCALL
   1.130 -SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.131 +void SDLCALL
   1.132 +SDL_Convert_U16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
   1.133  {
   1.134 +    const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.135 +    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.136      int i;
   1.137 -    const Uint8 *src;
   1.138 -    Sint16 *dst;
   1.139  
   1.140 -#if DEBUG_CONVERT
   1.141 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n");
   1.142 -#endif
   1.143 +    LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32");
   1.144  
   1.145 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.146 -    dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.147 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.148 -        const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
   1.149 -        *dst = ((Sint16) SDL_SwapLE16(val));
   1.150 +    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
   1.151 +        *dst = ((((float) *src) * DIVBY32767) - 1.0f);
   1.152      }
   1.153  
   1.154      cvt->len_cvt *= 2;
   1.155      if (cvt->filters[++cvt->filter_index]) {
   1.156 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
   1.157 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
   1.158      }
   1.159  }
   1.160  
   1.161 -static void SDLCALL
   1.162 -SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.163 +void SDLCALL
   1.164 +SDL_Convert_S32_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
   1.165  {
   1.166 +    const Uint32 *src = (const Uint32 *) cvt->buf;
   1.167 +    float *dst = (float *) cvt->buf;
   1.168      int i;
   1.169 -    const Uint8 *src;
   1.170 -    Uint16 *dst;
   1.171  
   1.172 -#if DEBUG_CONVERT
   1.173 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n");
   1.174 -#endif
   1.175 +    LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32");
   1.176  
   1.177 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.178 -    dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.179 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.180 -        const Uint16 val = (((Uint16) *src) << 8);
   1.181 -        *dst = SDL_SwapBE16(val);
   1.182 +    for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) {
   1.183 +        *dst = (((float) *src) * DIVBY2147483647);
   1.184      }
   1.185  
   1.186 -    cvt->len_cvt *= 2;
   1.187      if (cvt->filters[++cvt->filter_index]) {
   1.188 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
   1.189 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
   1.190      }
   1.191  }
   1.192  
   1.193 -static void SDLCALL
   1.194 -SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.195 +void SDLCALL
   1.196 +SDL_Convert_F32_to_S8(SDL_AudioCVT *cvt, SDL_AudioFormat format)
   1.197  {
   1.198 +    const float *src = (const float *) cvt->buf;
   1.199 +    Sint8 *dst = (Sint8 *) cvt->buf;
   1.200      int i;
   1.201 -    const Uint8 *src;
   1.202 -    Sint16 *dst;
   1.203  
   1.204 -#if DEBUG_CONVERT
   1.205 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n");
   1.206 -#endif
   1.207 +    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8");
   1.208  
   1.209 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.210 -    dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.211 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.212 -        const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
   1.213 -        *dst = ((Sint16) SDL_SwapBE16(val));
   1.214 +    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
   1.215 +        *dst = (Sint8) (*src * 127.0f);
   1.216      }
   1.217  
   1.218 -    cvt->len_cvt *= 2;
   1.219 +    cvt->len_cvt /= 4;
   1.220      if (cvt->filters[++cvt->filter_index]) {
   1.221 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
   1.222 +        cvt->filters[cvt->filter_index](cvt, AUDIO_S8);
   1.223      }
   1.224  }
   1.225  
   1.226 -static void SDLCALL
   1.227 -SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.228 +void SDLCALL
   1.229 +SDL_Convert_F32_to_U8(SDL_AudioCVT *cvt, SDL_AudioFormat format)
   1.230  {
   1.231 +    const float *src = (const float *) cvt->buf;
   1.232 +    Uint8 *dst = (Uint8 *) cvt->buf;
   1.233      int i;
   1.234 -    const Uint8 *src;
   1.235 -    Sint32 *dst;
   1.236  
   1.237 -#if DEBUG_CONVERT
   1.238 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n");
   1.239 -#endif
   1.240 +    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8");
   1.241  
   1.242 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.243 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
   1.244 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.245 -        const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
   1.246 -        *dst = ((Sint32) SDL_SwapLE32(val));
   1.247 +    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
   1.248 +        *dst = (Uint8) ((*src + 1.0f) * 127.0f);
   1.249      }
   1.250  
   1.251 -    cvt->len_cvt *= 4;
   1.252 +    cvt->len_cvt /= 4;
   1.253      if (cvt->filters[++cvt->filter_index]) {
   1.254 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
   1.255 +        cvt->filters[cvt->filter_index](cvt, AUDIO_U8);
   1.256      }
   1.257  }
   1.258  
   1.259 -static void SDLCALL
   1.260 -SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.261 +void SDLCALL
   1.262 +SDL_Convert_F32_to_S16(SDL_AudioCVT *cvt, SDL_AudioFormat format)
   1.263  {
   1.264 +    const float *src = (const float *) cvt->buf;
   1.265 +    Sint16 *dst = (Sint16 *) cvt->buf;
   1.266      int i;
   1.267 -    const Uint8 *src;
   1.268 -    Sint32 *dst;
   1.269  
   1.270 -#if DEBUG_CONVERT
   1.271 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n");
   1.272 -#endif
   1.273 +    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16");
   1.274  
   1.275 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.276 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
   1.277 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.278 -        const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
   1.279 -        *dst = ((Sint32) SDL_SwapBE32(val));
   1.280 -    }
   1.281 -
   1.282 -    cvt->len_cvt *= 4;
   1.283 -    if (cvt->filters[++cvt->filter_index]) {
   1.284 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
   1.285 -    }
   1.286 -}
   1.287 -
   1.288 -static void SDLCALL
   1.289 -SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.290 -{
   1.291 -    int i;
   1.292 -    const Uint8 *src;
   1.293 -    float *dst;
   1.294 -
   1.295 -#if DEBUG_CONVERT
   1.296 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n");
   1.297 -#endif
   1.298 -
   1.299 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.300 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
   1.301 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.302 -        const float val = ((((float) *src) * DIVBY127) - 1.0f);
   1.303 -        *dst = SDL_SwapFloatLE(val);
   1.304 -    }
   1.305 -
   1.306 -    cvt->len_cvt *= 4;
   1.307 -    if (cvt->filters[++cvt->filter_index]) {
   1.308 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
   1.309 -    }
   1.310 -}
   1.311 -
   1.312 -static void SDLCALL
   1.313 -SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.314 -{
   1.315 -    int i;
   1.316 -    const Uint8 *src;
   1.317 -    float *dst;
   1.318 -
   1.319 -#if DEBUG_CONVERT
   1.320 -    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n");
   1.321 -#endif
   1.322 -
   1.323 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.324 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
   1.325 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.326 -        const float val = ((((float) *src) * DIVBY127) - 1.0f);
   1.327 -        *dst = SDL_SwapFloatBE(val);
   1.328 -    }
   1.329 -
   1.330 -    cvt->len_cvt *= 4;
   1.331 -    if (cvt->filters[++cvt->filter_index]) {
   1.332 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
   1.333 -    }
   1.334 -}
   1.335 -
   1.336 -static void SDLCALL
   1.337 -SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.338 -{
   1.339 -    int i;
   1.340 -    const Uint8 *src;
   1.341 -    Uint8 *dst;
   1.342 -
   1.343 -#if DEBUG_CONVERT
   1.344 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n");
   1.345 -#endif
   1.346 -
   1.347 -    src = (const Uint8 *) cvt->buf;
   1.348 -    dst = (Uint8 *) cvt->buf;
   1.349 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
   1.350 -        const Uint8 val = ((((Sint8) *src)) ^ 0x80);
   1.351 -        *dst = val;
   1.352 -    }
   1.353 -
   1.354 -    if (cvt->filters[++cvt->filter_index]) {
   1.355 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
   1.356 -    }
   1.357 -}
   1.358 -
   1.359 -static void SDLCALL
   1.360 -SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.361 -{
   1.362 -    int i;
   1.363 -    const Uint8 *src;
   1.364 -    Uint16 *dst;
   1.365 -
   1.366 -#if DEBUG_CONVERT
   1.367 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n");
   1.368 -#endif
   1.369 -
   1.370 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.371 -    dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.372 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.373 -        const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
   1.374 -        *dst = SDL_SwapLE16(val);
   1.375 -    }
   1.376 -
   1.377 -    cvt->len_cvt *= 2;
   1.378 -    if (cvt->filters[++cvt->filter_index]) {
   1.379 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
   1.380 -    }
   1.381 -}
   1.382 -
   1.383 -static void SDLCALL
   1.384 -SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.385 -{
   1.386 -    int i;
   1.387 -    const Uint8 *src;
   1.388 -    Sint16 *dst;
   1.389 -
   1.390 -#if DEBUG_CONVERT
   1.391 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n");
   1.392 -#endif
   1.393 -
   1.394 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.395 -    dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.396 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.397 -        const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
   1.398 -        *dst = ((Sint16) SDL_SwapLE16(val));
   1.399 -    }
   1.400 -
   1.401 -    cvt->len_cvt *= 2;
   1.402 -    if (cvt->filters[++cvt->filter_index]) {
   1.403 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
   1.404 -    }
   1.405 -}
   1.406 -
   1.407 -static void SDLCALL
   1.408 -SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.409 -{
   1.410 -    int i;
   1.411 -    const Uint8 *src;
   1.412 -    Uint16 *dst;
   1.413 -
   1.414 -#if DEBUG_CONVERT
   1.415 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n");
   1.416 -#endif
   1.417 -
   1.418 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.419 -    dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.420 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.421 -        const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
   1.422 -        *dst = SDL_SwapBE16(val);
   1.423 -    }
   1.424 -
   1.425 -    cvt->len_cvt *= 2;
   1.426 -    if (cvt->filters[++cvt->filter_index]) {
   1.427 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
   1.428 -    }
   1.429 -}
   1.430 -
   1.431 -static void SDLCALL
   1.432 -SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.433 -{
   1.434 -    int i;
   1.435 -    const Uint8 *src;
   1.436 -    Sint16 *dst;
   1.437 -
   1.438 -#if DEBUG_CONVERT
   1.439 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n");
   1.440 -#endif
   1.441 -
   1.442 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.443 -    dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.444 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.445 -        const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
   1.446 -        *dst = ((Sint16) SDL_SwapBE16(val));
   1.447 -    }
   1.448 -
   1.449 -    cvt->len_cvt *= 2;
   1.450 -    if (cvt->filters[++cvt->filter_index]) {
   1.451 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
   1.452 -    }
   1.453 -}
   1.454 -
   1.455 -static void SDLCALL
   1.456 -SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.457 -{
   1.458 -    int i;
   1.459 -    const Uint8 *src;
   1.460 -    Sint32 *dst;
   1.461 -
   1.462 -#if DEBUG_CONVERT
   1.463 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n");
   1.464 -#endif
   1.465 -
   1.466 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.467 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
   1.468 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.469 -        const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
   1.470 -        *dst = ((Sint32) SDL_SwapLE32(val));
   1.471 -    }
   1.472 -
   1.473 -    cvt->len_cvt *= 4;
   1.474 -    if (cvt->filters[++cvt->filter_index]) {
   1.475 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
   1.476 -    }
   1.477 -}
   1.478 -
   1.479 -static void SDLCALL
   1.480 -SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.481 -{
   1.482 -    int i;
   1.483 -    const Uint8 *src;
   1.484 -    Sint32 *dst;
   1.485 -
   1.486 -#if DEBUG_CONVERT
   1.487 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n");
   1.488 -#endif
   1.489 -
   1.490 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.491 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
   1.492 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.493 -        const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
   1.494 -        *dst = ((Sint32) SDL_SwapBE32(val));
   1.495 -    }
   1.496 -
   1.497 -    cvt->len_cvt *= 4;
   1.498 -    if (cvt->filters[++cvt->filter_index]) {
   1.499 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
   1.500 -    }
   1.501 -}
   1.502 -
   1.503 -static void SDLCALL
   1.504 -SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.505 -{
   1.506 -    int i;
   1.507 -    const Uint8 *src;
   1.508 -    float *dst;
   1.509 -
   1.510 -#if DEBUG_CONVERT
   1.511 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n");
   1.512 -#endif
   1.513 -
   1.514 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.515 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
   1.516 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.517 -        const float val = (((float) ((Sint8) *src)) * DIVBY127);
   1.518 -        *dst = SDL_SwapFloatLE(val);
   1.519 -    }
   1.520 -
   1.521 -    cvt->len_cvt *= 4;
   1.522 -    if (cvt->filters[++cvt->filter_index]) {
   1.523 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
   1.524 -    }
   1.525 -}
   1.526 -
   1.527 -static void SDLCALL
   1.528 -SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.529 -{
   1.530 -    int i;
   1.531 -    const Uint8 *src;
   1.532 -    float *dst;
   1.533 -
   1.534 -#if DEBUG_CONVERT
   1.535 -    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n");
   1.536 -#endif
   1.537 -
   1.538 -    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.539 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
   1.540 -    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
   1.541 -        const float val = (((float) ((Sint8) *src)) * DIVBY127);
   1.542 -        *dst = SDL_SwapFloatBE(val);
   1.543 -    }
   1.544 -
   1.545 -    cvt->len_cvt *= 4;
   1.546 -    if (cvt->filters[++cvt->filter_index]) {
   1.547 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
   1.548 -    }
   1.549 -}
   1.550 -
   1.551 -static void SDLCALL
   1.552 -SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.553 -{
   1.554 -    int i;
   1.555 -    const Uint16 *src;
   1.556 -    Uint8 *dst;
   1.557 -
   1.558 -#if DEBUG_CONVERT
   1.559 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n");
   1.560 -#endif
   1.561 -
   1.562 -    src = (const Uint16 *) cvt->buf;
   1.563 -    dst = (Uint8 *) cvt->buf;
   1.564 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.565 -        const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8));
   1.566 -        *dst = val;
   1.567 +    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
   1.568 +        *dst = (Sint16) (*src * 32767.0f);
   1.569      }
   1.570  
   1.571      cvt->len_cvt /= 2;
   1.572      if (cvt->filters[++cvt->filter_index]) {
   1.573 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
   1.574 +        cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS);
   1.575      }
   1.576  }
   1.577  
   1.578 -static void SDLCALL
   1.579 -SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.580 +void SDLCALL
   1.581 +SDL_Convert_F32_to_U16(SDL_AudioCVT *cvt, SDL_AudioFormat format)
   1.582  {
   1.583 +    const float *src = (const float *) cvt->buf;
   1.584 +    Uint16 *dst = (Uint16 *) cvt->buf;
   1.585      int i;
   1.586 -    const Uint16 *src;
   1.587 -    Sint8 *dst;
   1.588  
   1.589 -#if DEBUG_CONVERT
   1.590 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n");
   1.591 -#endif
   1.592 +    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16");
   1.593  
   1.594 -    src = (const Uint16 *) cvt->buf;
   1.595 -    dst = (Sint8 *) cvt->buf;
   1.596 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.597 -        const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8));
   1.598 -        *dst = ((Sint8) val);
   1.599 +    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
   1.600 +        *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
   1.601      }
   1.602  
   1.603      cvt->len_cvt /= 2;
   1.604      if (cvt->filters[++cvt->filter_index]) {
   1.605 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
   1.606 +        cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS);
   1.607      }
   1.608  }
   1.609  
   1.610 -static void SDLCALL
   1.611 -SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.612 +void SDLCALL
   1.613 +SDL_Convert_F32_to_S32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
   1.614  {
   1.615 +    const float *src = (const float *) cvt->buf;
   1.616 +    Sint32 *dst = (Sint32 *) cvt->buf;
   1.617      int i;
   1.618 -    const Uint16 *src;
   1.619 -    Sint16 *dst;
   1.620  
   1.621 -#if DEBUG_CONVERT
   1.622 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n");
   1.623 -#endif
   1.624 +    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32");
   1.625  
   1.626 -    src = (const Uint16 *) cvt->buf;
   1.627 -    dst = (Sint16 *) cvt->buf;
   1.628 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.629 -        const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
   1.630 -        *dst = ((Sint16) SDL_SwapLE16(val));
   1.631 +    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
   1.632 +        *dst = (Sint32) (*src * 2147483647.0);
   1.633      }
   1.634  
   1.635      if (cvt->filters[++cvt->filter_index]) {
   1.636 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
   1.637 +        cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
   1.638      }
   1.639  }
   1.640  
   1.641 -static void SDLCALL
   1.642 -SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.643 +void
   1.644 +SDL_Upsample_Arbitrary(SDL_AudioCVT *cvt, const int channels)
   1.645  {
   1.646 +    const int srcsize = cvt->len_cvt - (64 * channels);
   1.647 +    const int dstsize = (int) (((double)(cvt->len_cvt/(channels*4))) * cvt->rate_incr) * (channels*4);
   1.648 +    register int eps = 0;
   1.649 +    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
   1.650 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
   1.651 +    const float *target = ((const float *) cvt->buf);
   1.652 +    const size_t cpy = sizeof (float) * channels;
   1.653 +    float last_sample[8];
   1.654 +    float sample[8];
   1.655      int i;
   1.656 -    const Uint16 *src;
   1.657 -    Uint16 *dst;
   1.658  
   1.659  #if DEBUG_CONVERT
   1.660 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n");
   1.661 +    fprintf(stderr, "Upsample arbitrary (x%f), %d channels.\n", cvt->rate_incr, channels);
   1.662  #endif
   1.663  
   1.664 -    src = (const Uint16 *) cvt->buf;
   1.665 -    dst = (Uint16 *) cvt->buf;
   1.666 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.667 -        const Uint16 val = SDL_SwapLE16(*src);
   1.668 -        *dst = SDL_SwapBE16(val);
   1.669 -    }
   1.670 +    SDL_assert(channels <= 8);
   1.671  
   1.672 -    if (cvt->filters[++cvt->filter_index]) {
   1.673 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
   1.674 -    }
   1.675 -}
   1.676 +    SDL_memcpy(sample, src, cpy);
   1.677 +    SDL_memcpy(last_sample, src, cpy);
   1.678  
   1.679 -static void SDLCALL
   1.680 -SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.681 -{
   1.682 -    int i;
   1.683 -    const Uint16 *src;
   1.684 -    Sint16 *dst;
   1.685 -
   1.686 -#if DEBUG_CONVERT
   1.687 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n");
   1.688 -#endif
   1.689 -
   1.690 -    src = (const Uint16 *) cvt->buf;
   1.691 -    dst = (Sint16 *) cvt->buf;
   1.692 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.693 -        const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
   1.694 -        *dst = ((Sint16) SDL_SwapBE16(val));
   1.695 -    }
   1.696 -
   1.697 -    if (cvt->filters[++cvt->filter_index]) {
   1.698 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
   1.699 -    }
   1.700 -}
   1.701 -
   1.702 -static void SDLCALL
   1.703 -SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.704 -{
   1.705 -    int i;
   1.706 -    const Uint16 *src;
   1.707 -    Sint32 *dst;
   1.708 -
   1.709 -#if DEBUG_CONVERT
   1.710 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n");
   1.711 -#endif
   1.712 -
   1.713 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.714 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.715 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
   1.716 -        const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
   1.717 -        *dst = ((Sint32) SDL_SwapLE32(val));
   1.718 -    }
   1.719 -
   1.720 -    cvt->len_cvt *= 2;
   1.721 -    if (cvt->filters[++cvt->filter_index]) {
   1.722 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
   1.723 -    }
   1.724 -}
   1.725 -
   1.726 -static void SDLCALL
   1.727 -SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.728 -{
   1.729 -    int i;
   1.730 -    const Uint16 *src;
   1.731 -    Sint32 *dst;
   1.732 -
   1.733 -#if DEBUG_CONVERT
   1.734 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n");
   1.735 -#endif
   1.736 -
   1.737 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.738 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.739 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
   1.740 -        const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
   1.741 -        *dst = ((Sint32) SDL_SwapBE32(val));
   1.742 -    }
   1.743 -
   1.744 -    cvt->len_cvt *= 2;
   1.745 -    if (cvt->filters[++cvt->filter_index]) {
   1.746 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
   1.747 -    }
   1.748 -}
   1.749 -
   1.750 -static void SDLCALL
   1.751 -SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.752 -{
   1.753 -    int i;
   1.754 -    const Uint16 *src;
   1.755 -    float *dst;
   1.756 -
   1.757 -#if DEBUG_CONVERT
   1.758 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n");
   1.759 -#endif
   1.760 -
   1.761 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.762 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.763 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
   1.764 -        const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
   1.765 -        *dst = SDL_SwapFloatLE(val);
   1.766 -    }
   1.767 -
   1.768 -    cvt->len_cvt *= 2;
   1.769 -    if (cvt->filters[++cvt->filter_index]) {
   1.770 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
   1.771 -    }
   1.772 -}
   1.773 -
   1.774 -static void SDLCALL
   1.775 -SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.776 -{
   1.777 -    int i;
   1.778 -    const Uint16 *src;
   1.779 -    float *dst;
   1.780 -
   1.781 -#if DEBUG_CONVERT
   1.782 -    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n");
   1.783 -#endif
   1.784 -
   1.785 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.786 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.787 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
   1.788 -        const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
   1.789 -        *dst = SDL_SwapFloatBE(val);
   1.790 -    }
   1.791 -
   1.792 -    cvt->len_cvt *= 2;
   1.793 -    if (cvt->filters[++cvt->filter_index]) {
   1.794 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
   1.795 -    }
   1.796 -}
   1.797 -
   1.798 -static void SDLCALL
   1.799 -SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.800 -{
   1.801 -    int i;
   1.802 -    const Uint16 *src;
   1.803 -    Uint8 *dst;
   1.804 -
   1.805 -#if DEBUG_CONVERT
   1.806 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n");
   1.807 -#endif
   1.808 -
   1.809 -    src = (const Uint16 *) cvt->buf;
   1.810 -    dst = (Uint8 *) cvt->buf;
   1.811 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.812 -        const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8));
   1.813 -        *dst = val;
   1.814 -    }
   1.815 -
   1.816 -    cvt->len_cvt /= 2;
   1.817 -    if (cvt->filters[++cvt->filter_index]) {
   1.818 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
   1.819 -    }
   1.820 -}
   1.821 -
   1.822 -static void SDLCALL
   1.823 -SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.824 -{
   1.825 -    int i;
   1.826 -    const Uint16 *src;
   1.827 -    Sint8 *dst;
   1.828 -
   1.829 -#if DEBUG_CONVERT
   1.830 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n");
   1.831 -#endif
   1.832 -
   1.833 -    src = (const Uint16 *) cvt->buf;
   1.834 -    dst = (Sint8 *) cvt->buf;
   1.835 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.836 -        const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8));
   1.837 -        *dst = ((Sint8) val);
   1.838 -    }
   1.839 -
   1.840 -    cvt->len_cvt /= 2;
   1.841 -    if (cvt->filters[++cvt->filter_index]) {
   1.842 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
   1.843 -    }
   1.844 -}
   1.845 -
   1.846 -static void SDLCALL
   1.847 -SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.848 -{
   1.849 -    int i;
   1.850 -    const Uint16 *src;
   1.851 -    Uint16 *dst;
   1.852 -
   1.853 -#if DEBUG_CONVERT
   1.854 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n");
   1.855 -#endif
   1.856 -
   1.857 -    src = (const Uint16 *) cvt->buf;
   1.858 -    dst = (Uint16 *) cvt->buf;
   1.859 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.860 -        const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
   1.861 -        *dst = SDL_SwapLE16(val);
   1.862 -    }
   1.863 -
   1.864 -    if (cvt->filters[++cvt->filter_index]) {
   1.865 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
   1.866 -    }
   1.867 -}
   1.868 -
   1.869 -static void SDLCALL
   1.870 -SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.871 -{
   1.872 -    int i;
   1.873 -    const Uint16 *src;
   1.874 -    Uint16 *dst;
   1.875 -
   1.876 -#if DEBUG_CONVERT
   1.877 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n");
   1.878 -#endif
   1.879 -
   1.880 -    src = (const Uint16 *) cvt->buf;
   1.881 -    dst = (Uint16 *) cvt->buf;
   1.882 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.883 -        const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
   1.884 -        *dst = SDL_SwapBE16(val);
   1.885 -    }
   1.886 -
   1.887 -    if (cvt->filters[++cvt->filter_index]) {
   1.888 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
   1.889 -    }
   1.890 -}
   1.891 -
   1.892 -static void SDLCALL
   1.893 -SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.894 -{
   1.895 -    int i;
   1.896 -    const Uint16 *src;
   1.897 -    Sint16 *dst;
   1.898 -
   1.899 -#if DEBUG_CONVERT
   1.900 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n");
   1.901 -#endif
   1.902 -
   1.903 -    src = (const Uint16 *) cvt->buf;
   1.904 -    dst = (Sint16 *) cvt->buf;
   1.905 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
   1.906 -        const Sint16 val = ((Sint16) SDL_SwapLE16(*src));
   1.907 -        *dst = ((Sint16) SDL_SwapBE16(val));
   1.908 -    }
   1.909 -
   1.910 -    if (cvt->filters[++cvt->filter_index]) {
   1.911 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
   1.912 -    }
   1.913 -}
   1.914 -
   1.915 -static void SDLCALL
   1.916 -SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.917 -{
   1.918 -    int i;
   1.919 -    const Uint16 *src;
   1.920 -    Sint32 *dst;
   1.921 -
   1.922 -#if DEBUG_CONVERT
   1.923 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n");
   1.924 -#endif
   1.925 -
   1.926 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.927 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.928 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
   1.929 -        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
   1.930 -        *dst = ((Sint32) SDL_SwapLE32(val));
   1.931 -    }
   1.932 -
   1.933 -    cvt->len_cvt *= 2;
   1.934 -    if (cvt->filters[++cvt->filter_index]) {
   1.935 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
   1.936 -    }
   1.937 -}
   1.938 -
   1.939 -static void SDLCALL
   1.940 -SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.941 -{
   1.942 -    int i;
   1.943 -    const Uint16 *src;
   1.944 -    Sint32 *dst;
   1.945 -
   1.946 -#if DEBUG_CONVERT
   1.947 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n");
   1.948 -#endif
   1.949 -
   1.950 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.951 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.952 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
   1.953 -        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
   1.954 -        *dst = ((Sint32) SDL_SwapBE32(val));
   1.955 -    }
   1.956 -
   1.957 -    cvt->len_cvt *= 2;
   1.958 -    if (cvt->filters[++cvt->filter_index]) {
   1.959 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
   1.960 -    }
   1.961 -}
   1.962 -
   1.963 -static void SDLCALL
   1.964 -SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.965 -{
   1.966 -    int i;
   1.967 -    const Uint16 *src;
   1.968 -    float *dst;
   1.969 -
   1.970 -#if DEBUG_CONVERT
   1.971 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n");
   1.972 -#endif
   1.973 -
   1.974 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.975 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
   1.976 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
   1.977 -        const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
   1.978 -        *dst = SDL_SwapFloatLE(val);
   1.979 -    }
   1.980 -
   1.981 -    cvt->len_cvt *= 2;
   1.982 -    if (cvt->filters[++cvt->filter_index]) {
   1.983 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
   1.984 -    }
   1.985 -}
   1.986 -
   1.987 -static void SDLCALL
   1.988 -SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
   1.989 -{
   1.990 -    int i;
   1.991 -    const Uint16 *src;
   1.992 -    float *dst;
   1.993 -
   1.994 -#if DEBUG_CONVERT
   1.995 -    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n");
   1.996 -#endif
   1.997 -
   1.998 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
   1.999 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1000 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1001 -        const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
  1.1002 -        *dst = SDL_SwapFloatBE(val);
  1.1003 -    }
  1.1004 -
  1.1005 -    cvt->len_cvt *= 2;
  1.1006 -    if (cvt->filters[++cvt->filter_index]) {
  1.1007 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
  1.1008 -    }
  1.1009 -}
  1.1010 -
  1.1011 -static void SDLCALL
  1.1012 -SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1013 -{
  1.1014 -    int i;
  1.1015 -    const Uint16 *src;
  1.1016 -    Uint8 *dst;
  1.1017 -
  1.1018 -#if DEBUG_CONVERT
  1.1019 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n");
  1.1020 -#endif
  1.1021 -
  1.1022 -    src = (const Uint16 *) cvt->buf;
  1.1023 -    dst = (Uint8 *) cvt->buf;
  1.1024 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1025 -        const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8));
  1.1026 -        *dst = val;
  1.1027 -    }
  1.1028 -
  1.1029 -    cvt->len_cvt /= 2;
  1.1030 -    if (cvt->filters[++cvt->filter_index]) {
  1.1031 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
  1.1032 -    }
  1.1033 -}
  1.1034 -
  1.1035 -static void SDLCALL
  1.1036 -SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1037 -{
  1.1038 -    int i;
  1.1039 -    const Uint16 *src;
  1.1040 -    Sint8 *dst;
  1.1041 -
  1.1042 -#if DEBUG_CONVERT
  1.1043 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n");
  1.1044 -#endif
  1.1045 -
  1.1046 -    src = (const Uint16 *) cvt->buf;
  1.1047 -    dst = (Sint8 *) cvt->buf;
  1.1048 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1049 -        const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8));
  1.1050 -        *dst = ((Sint8) val);
  1.1051 -    }
  1.1052 -
  1.1053 -    cvt->len_cvt /= 2;
  1.1054 -    if (cvt->filters[++cvt->filter_index]) {
  1.1055 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
  1.1056 -    }
  1.1057 -}
  1.1058 -
  1.1059 -static void SDLCALL
  1.1060 -SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1061 -{
  1.1062 -    int i;
  1.1063 -    const Uint16 *src;
  1.1064 -    Uint16 *dst;
  1.1065 -
  1.1066 -#if DEBUG_CONVERT
  1.1067 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n");
  1.1068 -#endif
  1.1069 -
  1.1070 -    src = (const Uint16 *) cvt->buf;
  1.1071 -    dst = (Uint16 *) cvt->buf;
  1.1072 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1073 -        const Uint16 val = SDL_SwapBE16(*src);
  1.1074 -        *dst = SDL_SwapLE16(val);
  1.1075 -    }
  1.1076 -
  1.1077 -    if (cvt->filters[++cvt->filter_index]) {
  1.1078 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
  1.1079 -    }
  1.1080 -}
  1.1081 -
  1.1082 -static void SDLCALL
  1.1083 -SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1084 -{
  1.1085 -    int i;
  1.1086 -    const Uint16 *src;
  1.1087 -    Sint16 *dst;
  1.1088 -
  1.1089 -#if DEBUG_CONVERT
  1.1090 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n");
  1.1091 -#endif
  1.1092 -
  1.1093 -    src = (const Uint16 *) cvt->buf;
  1.1094 -    dst = (Sint16 *) cvt->buf;
  1.1095 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1096 -        const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
  1.1097 -        *dst = ((Sint16) SDL_SwapLE16(val));
  1.1098 -    }
  1.1099 -
  1.1100 -    if (cvt->filters[++cvt->filter_index]) {
  1.1101 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
  1.1102 -    }
  1.1103 -}
  1.1104 -
  1.1105 -static void SDLCALL
  1.1106 -SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1107 -{
  1.1108 -    int i;
  1.1109 -    const Uint16 *src;
  1.1110 -    Sint16 *dst;
  1.1111 -
  1.1112 -#if DEBUG_CONVERT
  1.1113 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n");
  1.1114 -#endif
  1.1115 -
  1.1116 -    src = (const Uint16 *) cvt->buf;
  1.1117 -    dst = (Sint16 *) cvt->buf;
  1.1118 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1119 -        const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
  1.1120 -        *dst = ((Sint16) SDL_SwapBE16(val));
  1.1121 -    }
  1.1122 -
  1.1123 -    if (cvt->filters[++cvt->filter_index]) {
  1.1124 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
  1.1125 -    }
  1.1126 -}
  1.1127 -
  1.1128 -static void SDLCALL
  1.1129 -SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1130 -{
  1.1131 -    int i;
  1.1132 -    const Uint16 *src;
  1.1133 -    Sint32 *dst;
  1.1134 -
  1.1135 -#if DEBUG_CONVERT
  1.1136 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n");
  1.1137 -#endif
  1.1138 -
  1.1139 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1140 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1141 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1142 -        const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
  1.1143 -        *dst = ((Sint32) SDL_SwapLE32(val));
  1.1144 -    }
  1.1145 -
  1.1146 -    cvt->len_cvt *= 2;
  1.1147 -    if (cvt->filters[++cvt->filter_index]) {
  1.1148 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
  1.1149 -    }
  1.1150 -}
  1.1151 -
  1.1152 -static void SDLCALL
  1.1153 -SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1154 -{
  1.1155 -    int i;
  1.1156 -    const Uint16 *src;
  1.1157 -    Sint32 *dst;
  1.1158 -
  1.1159 -#if DEBUG_CONVERT
  1.1160 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n");
  1.1161 -#endif
  1.1162 -
  1.1163 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1164 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1165 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1166 -        const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
  1.1167 -        *dst = ((Sint32) SDL_SwapBE32(val));
  1.1168 -    }
  1.1169 -
  1.1170 -    cvt->len_cvt *= 2;
  1.1171 -    if (cvt->filters[++cvt->filter_index]) {
  1.1172 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
  1.1173 -    }
  1.1174 -}
  1.1175 -
  1.1176 -static void SDLCALL
  1.1177 -SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1178 -{
  1.1179 -    int i;
  1.1180 -    const Uint16 *src;
  1.1181 -    float *dst;
  1.1182 -
  1.1183 -#if DEBUG_CONVERT
  1.1184 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n");
  1.1185 -#endif
  1.1186 -
  1.1187 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1188 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1189 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1190 -        const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
  1.1191 -        *dst = SDL_SwapFloatLE(val);
  1.1192 -    }
  1.1193 -
  1.1194 -    cvt->len_cvt *= 2;
  1.1195 -    if (cvt->filters[++cvt->filter_index]) {
  1.1196 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
  1.1197 -    }
  1.1198 -}
  1.1199 -
  1.1200 -static void SDLCALL
  1.1201 -SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1202 -{
  1.1203 -    int i;
  1.1204 -    const Uint16 *src;
  1.1205 -    float *dst;
  1.1206 -
  1.1207 -#if DEBUG_CONVERT
  1.1208 -    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n");
  1.1209 -#endif
  1.1210 -
  1.1211 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1212 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1213 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1214 -        const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
  1.1215 -        *dst = SDL_SwapFloatBE(val);
  1.1216 -    }
  1.1217 -
  1.1218 -    cvt->len_cvt *= 2;
  1.1219 -    if (cvt->filters[++cvt->filter_index]) {
  1.1220 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
  1.1221 -    }
  1.1222 -}
  1.1223 -
  1.1224 -static void SDLCALL
  1.1225 -SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1226 -{
  1.1227 -    int i;
  1.1228 -    const Uint16 *src;
  1.1229 -    Uint8 *dst;
  1.1230 -
  1.1231 -#if DEBUG_CONVERT
  1.1232 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n");
  1.1233 -#endif
  1.1234 -
  1.1235 -    src = (const Uint16 *) cvt->buf;
  1.1236 -    dst = (Uint8 *) cvt->buf;
  1.1237 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1238 -        const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8));
  1.1239 -        *dst = val;
  1.1240 -    }
  1.1241 -
  1.1242 -    cvt->len_cvt /= 2;
  1.1243 -    if (cvt->filters[++cvt->filter_index]) {
  1.1244 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
  1.1245 -    }
  1.1246 -}
  1.1247 -
  1.1248 -static void SDLCALL
  1.1249 -SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1250 -{
  1.1251 -    int i;
  1.1252 -    const Uint16 *src;
  1.1253 -    Sint8 *dst;
  1.1254 -
  1.1255 -#if DEBUG_CONVERT
  1.1256 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n");
  1.1257 -#endif
  1.1258 -
  1.1259 -    src = (const Uint16 *) cvt->buf;
  1.1260 -    dst = (Sint8 *) cvt->buf;
  1.1261 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1262 -        const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8));
  1.1263 -        *dst = ((Sint8) val);
  1.1264 -    }
  1.1265 -
  1.1266 -    cvt->len_cvt /= 2;
  1.1267 -    if (cvt->filters[++cvt->filter_index]) {
  1.1268 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
  1.1269 -    }
  1.1270 -}
  1.1271 -
  1.1272 -static void SDLCALL
  1.1273 -SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1274 -{
  1.1275 -    int i;
  1.1276 -    const Uint16 *src;
  1.1277 -    Uint16 *dst;
  1.1278 -
  1.1279 -#if DEBUG_CONVERT
  1.1280 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n");
  1.1281 -#endif
  1.1282 -
  1.1283 -    src = (const Uint16 *) cvt->buf;
  1.1284 -    dst = (Uint16 *) cvt->buf;
  1.1285 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1286 -        const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
  1.1287 -        *dst = SDL_SwapLE16(val);
  1.1288 -    }
  1.1289 -
  1.1290 -    if (cvt->filters[++cvt->filter_index]) {
  1.1291 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
  1.1292 -    }
  1.1293 -}
  1.1294 -
  1.1295 -static void SDLCALL
  1.1296 -SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1297 -{
  1.1298 -    int i;
  1.1299 -    const Uint16 *src;
  1.1300 -    Sint16 *dst;
  1.1301 -
  1.1302 -#if DEBUG_CONVERT
  1.1303 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n");
  1.1304 -#endif
  1.1305 -
  1.1306 -    src = (const Uint16 *) cvt->buf;
  1.1307 -    dst = (Sint16 *) cvt->buf;
  1.1308 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1309 -        const Sint16 val = ((Sint16) SDL_SwapBE16(*src));
  1.1310 -        *dst = ((Sint16) SDL_SwapLE16(val));
  1.1311 -    }
  1.1312 -
  1.1313 -    if (cvt->filters[++cvt->filter_index]) {
  1.1314 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
  1.1315 -    }
  1.1316 -}
  1.1317 -
  1.1318 -static void SDLCALL
  1.1319 -SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1320 -{
  1.1321 -    int i;
  1.1322 -    const Uint16 *src;
  1.1323 -    Uint16 *dst;
  1.1324 -
  1.1325 -#if DEBUG_CONVERT
  1.1326 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n");
  1.1327 -#endif
  1.1328 -
  1.1329 -    src = (const Uint16 *) cvt->buf;
  1.1330 -    dst = (Uint16 *) cvt->buf;
  1.1331 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
  1.1332 -        const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
  1.1333 -        *dst = SDL_SwapBE16(val);
  1.1334 -    }
  1.1335 -
  1.1336 -    if (cvt->filters[++cvt->filter_index]) {
  1.1337 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
  1.1338 -    }
  1.1339 -}
  1.1340 -
  1.1341 -static void SDLCALL
  1.1342 -SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1343 -{
  1.1344 -    int i;
  1.1345 -    const Uint16 *src;
  1.1346 -    Sint32 *dst;
  1.1347 -
  1.1348 -#if DEBUG_CONVERT
  1.1349 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n");
  1.1350 -#endif
  1.1351 -
  1.1352 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1353 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1354 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1355 -        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
  1.1356 -        *dst = ((Sint32) SDL_SwapLE32(val));
  1.1357 -    }
  1.1358 -
  1.1359 -    cvt->len_cvt *= 2;
  1.1360 -    if (cvt->filters[++cvt->filter_index]) {
  1.1361 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
  1.1362 -    }
  1.1363 -}
  1.1364 -
  1.1365 -static void SDLCALL
  1.1366 -SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1367 -{
  1.1368 -    int i;
  1.1369 -    const Uint16 *src;
  1.1370 -    Sint32 *dst;
  1.1371 -
  1.1372 -#if DEBUG_CONVERT
  1.1373 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n");
  1.1374 -#endif
  1.1375 -
  1.1376 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1377 -    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1378 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1379 -        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
  1.1380 -        *dst = ((Sint32) SDL_SwapBE32(val));
  1.1381 -    }
  1.1382 -
  1.1383 -    cvt->len_cvt *= 2;
  1.1384 -    if (cvt->filters[++cvt->filter_index]) {
  1.1385 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
  1.1386 -    }
  1.1387 -}
  1.1388 -
  1.1389 -static void SDLCALL
  1.1390 -SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1391 -{
  1.1392 -    int i;
  1.1393 -    const Uint16 *src;
  1.1394 -    float *dst;
  1.1395 -
  1.1396 -#if DEBUG_CONVERT
  1.1397 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n");
  1.1398 -#endif
  1.1399 -
  1.1400 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1401 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1402 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1403 -        const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
  1.1404 -        *dst = SDL_SwapFloatLE(val);
  1.1405 -    }
  1.1406 -
  1.1407 -    cvt->len_cvt *= 2;
  1.1408 -    if (cvt->filters[++cvt->filter_index]) {
  1.1409 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
  1.1410 -    }
  1.1411 -}
  1.1412 -
  1.1413 -static void SDLCALL
  1.1414 -SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1415 -{
  1.1416 -    int i;
  1.1417 -    const Uint16 *src;
  1.1418 -    float *dst;
  1.1419 -
  1.1420 -#if DEBUG_CONVERT
  1.1421 -    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n");
  1.1422 -#endif
  1.1423 -
  1.1424 -    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.1425 -    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
  1.1426 -    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
  1.1427 -        const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
  1.1428 -        *dst = SDL_SwapFloatBE(val);
  1.1429 -    }
  1.1430 -
  1.1431 -    cvt->len_cvt *= 2;
  1.1432 -    if (cvt->filters[++cvt->filter_index]) {
  1.1433 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
  1.1434 -    }
  1.1435 -}
  1.1436 -
  1.1437 -static void SDLCALL
  1.1438 -SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1439 -{
  1.1440 -    int i;
  1.1441 -    const Uint32 *src;
  1.1442 -    Uint8 *dst;
  1.1443 -
  1.1444 -#if DEBUG_CONVERT
  1.1445 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n");
  1.1446 -#endif
  1.1447 -
  1.1448 -    src = (const Uint32 *) cvt->buf;
  1.1449 -    dst = (Uint8 *) cvt->buf;
  1.1450 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1451 -        const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24));
  1.1452 -        *dst = val;
  1.1453 -    }
  1.1454 -
  1.1455 -    cvt->len_cvt /= 4;
  1.1456 -    if (cvt->filters[++cvt->filter_index]) {
  1.1457 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
  1.1458 -    }
  1.1459 -}
  1.1460 -
  1.1461 -static void SDLCALL
  1.1462 -SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1463 -{
  1.1464 -    int i;
  1.1465 -    const Uint32 *src;
  1.1466 -    Sint8 *dst;
  1.1467 -
  1.1468 -#if DEBUG_CONVERT
  1.1469 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n");
  1.1470 -#endif
  1.1471 -
  1.1472 -    src = (const Uint32 *) cvt->buf;
  1.1473 -    dst = (Sint8 *) cvt->buf;
  1.1474 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1475 -        const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24));
  1.1476 -        *dst = ((Sint8) val);
  1.1477 -    }
  1.1478 -
  1.1479 -    cvt->len_cvt /= 4;
  1.1480 -    if (cvt->filters[++cvt->filter_index]) {
  1.1481 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
  1.1482 -    }
  1.1483 -}
  1.1484 -
  1.1485 -static void SDLCALL
  1.1486 -SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1487 -{
  1.1488 -    int i;
  1.1489 -    const Uint32 *src;
  1.1490 -    Uint16 *dst;
  1.1491 -
  1.1492 -#if DEBUG_CONVERT
  1.1493 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n");
  1.1494 -#endif
  1.1495 -
  1.1496 -    src = (const Uint32 *) cvt->buf;
  1.1497 -    dst = (Uint16 *) cvt->buf;
  1.1498 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1499 -        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
  1.1500 -        *dst = SDL_SwapLE16(val);
  1.1501 -    }
  1.1502 -
  1.1503 -    cvt->len_cvt /= 2;
  1.1504 -    if (cvt->filters[++cvt->filter_index]) {
  1.1505 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
  1.1506 -    }
  1.1507 -}
  1.1508 -
  1.1509 -static void SDLCALL
  1.1510 -SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1511 -{
  1.1512 -    int i;
  1.1513 -    const Uint32 *src;
  1.1514 -    Sint16 *dst;
  1.1515 -
  1.1516 -#if DEBUG_CONVERT
  1.1517 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n");
  1.1518 -#endif
  1.1519 -
  1.1520 -    src = (const Uint32 *) cvt->buf;
  1.1521 -    dst = (Sint16 *) cvt->buf;
  1.1522 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1523 -        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
  1.1524 -        *dst = ((Sint16) SDL_SwapLE16(val));
  1.1525 -    }
  1.1526 -
  1.1527 -    cvt->len_cvt /= 2;
  1.1528 -    if (cvt->filters[++cvt->filter_index]) {
  1.1529 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
  1.1530 -    }
  1.1531 -}
  1.1532 -
  1.1533 -static void SDLCALL
  1.1534 -SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1535 -{
  1.1536 -    int i;
  1.1537 -    const Uint32 *src;
  1.1538 -    Uint16 *dst;
  1.1539 -
  1.1540 -#if DEBUG_CONVERT
  1.1541 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n");
  1.1542 -#endif
  1.1543 -
  1.1544 -    src = (const Uint32 *) cvt->buf;
  1.1545 -    dst = (Uint16 *) cvt->buf;
  1.1546 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1547 -        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
  1.1548 -        *dst = SDL_SwapBE16(val);
  1.1549 -    }
  1.1550 -
  1.1551 -    cvt->len_cvt /= 2;
  1.1552 -    if (cvt->filters[++cvt->filter_index]) {
  1.1553 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
  1.1554 -    }
  1.1555 -}
  1.1556 -
  1.1557 -static void SDLCALL
  1.1558 -SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1559 -{
  1.1560 -    int i;
  1.1561 -    const Uint32 *src;
  1.1562 -    Sint16 *dst;
  1.1563 -
  1.1564 -#if DEBUG_CONVERT
  1.1565 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n");
  1.1566 -#endif
  1.1567 -
  1.1568 -    src = (const Uint32 *) cvt->buf;
  1.1569 -    dst = (Sint16 *) cvt->buf;
  1.1570 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1571 -        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
  1.1572 -        *dst = ((Sint16) SDL_SwapBE16(val));
  1.1573 -    }
  1.1574 -
  1.1575 -    cvt->len_cvt /= 2;
  1.1576 -    if (cvt->filters[++cvt->filter_index]) {
  1.1577 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
  1.1578 -    }
  1.1579 -}
  1.1580 -
  1.1581 -static void SDLCALL
  1.1582 -SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1583 -{
  1.1584 -    int i;
  1.1585 -    const Uint32 *src;
  1.1586 -    Sint32 *dst;
  1.1587 -
  1.1588 -#if DEBUG_CONVERT
  1.1589 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n");
  1.1590 -#endif
  1.1591 -
  1.1592 -    src = (const Uint32 *) cvt->buf;
  1.1593 -    dst = (Sint32 *) cvt->buf;
  1.1594 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1595 -        const Sint32 val = ((Sint32) SDL_SwapLE32(*src));
  1.1596 -        *dst = ((Sint32) SDL_SwapBE32(val));
  1.1597 -    }
  1.1598 -
  1.1599 -    if (cvt->filters[++cvt->filter_index]) {
  1.1600 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
  1.1601 -    }
  1.1602 -}
  1.1603 -
  1.1604 -static void SDLCALL
  1.1605 -SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1606 -{
  1.1607 -    int i;
  1.1608 -    const Uint32 *src;
  1.1609 -    float *dst;
  1.1610 -
  1.1611 -#if DEBUG_CONVERT
  1.1612 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n");
  1.1613 -#endif
  1.1614 -
  1.1615 -    src = (const Uint32 *) cvt->buf;
  1.1616 -    dst = (float *) cvt->buf;
  1.1617 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1618 -        const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
  1.1619 -        *dst = SDL_SwapFloatLE(val);
  1.1620 -    }
  1.1621 -
  1.1622 -    if (cvt->filters[++cvt->filter_index]) {
  1.1623 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
  1.1624 -    }
  1.1625 -}
  1.1626 -
  1.1627 -static void SDLCALL
  1.1628 -SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1629 -{
  1.1630 -    int i;
  1.1631 -    const Uint32 *src;
  1.1632 -    float *dst;
  1.1633 -
  1.1634 -#if DEBUG_CONVERT
  1.1635 -    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n");
  1.1636 -#endif
  1.1637 -
  1.1638 -    src = (const Uint32 *) cvt->buf;
  1.1639 -    dst = (float *) cvt->buf;
  1.1640 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1641 -        const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
  1.1642 -        *dst = SDL_SwapFloatBE(val);
  1.1643 -    }
  1.1644 -
  1.1645 -    if (cvt->filters[++cvt->filter_index]) {
  1.1646 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
  1.1647 -    }
  1.1648 -}
  1.1649 -
  1.1650 -static void SDLCALL
  1.1651 -SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1652 -{
  1.1653 -    int i;
  1.1654 -    const Uint32 *src;
  1.1655 -    Uint8 *dst;
  1.1656 -
  1.1657 -#if DEBUG_CONVERT
  1.1658 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n");
  1.1659 -#endif
  1.1660 -
  1.1661 -    src = (const Uint32 *) cvt->buf;
  1.1662 -    dst = (Uint8 *) cvt->buf;
  1.1663 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1664 -        const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24));
  1.1665 -        *dst = val;
  1.1666 -    }
  1.1667 -
  1.1668 -    cvt->len_cvt /= 4;
  1.1669 -    if (cvt->filters[++cvt->filter_index]) {
  1.1670 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
  1.1671 -    }
  1.1672 -}
  1.1673 -
  1.1674 -static void SDLCALL
  1.1675 -SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1676 -{
  1.1677 -    int i;
  1.1678 -    const Uint32 *src;
  1.1679 -    Sint8 *dst;
  1.1680 -
  1.1681 -#if DEBUG_CONVERT
  1.1682 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n");
  1.1683 -#endif
  1.1684 -
  1.1685 -    src = (const Uint32 *) cvt->buf;
  1.1686 -    dst = (Sint8 *) cvt->buf;
  1.1687 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1688 -        const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24));
  1.1689 -        *dst = ((Sint8) val);
  1.1690 -    }
  1.1691 -
  1.1692 -    cvt->len_cvt /= 4;
  1.1693 -    if (cvt->filters[++cvt->filter_index]) {
  1.1694 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
  1.1695 -    }
  1.1696 -}
  1.1697 -
  1.1698 -static void SDLCALL
  1.1699 -SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1700 -{
  1.1701 -    int i;
  1.1702 -    const Uint32 *src;
  1.1703 -    Uint16 *dst;
  1.1704 -
  1.1705 -#if DEBUG_CONVERT
  1.1706 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n");
  1.1707 -#endif
  1.1708 -
  1.1709 -    src = (const Uint32 *) cvt->buf;
  1.1710 -    dst = (Uint16 *) cvt->buf;
  1.1711 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1712 -        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
  1.1713 -        *dst = SDL_SwapLE16(val);
  1.1714 -    }
  1.1715 -
  1.1716 -    cvt->len_cvt /= 2;
  1.1717 -    if (cvt->filters[++cvt->filter_index]) {
  1.1718 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
  1.1719 -    }
  1.1720 -}
  1.1721 -
  1.1722 -static void SDLCALL
  1.1723 -SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1724 -{
  1.1725 -    int i;
  1.1726 -    const Uint32 *src;
  1.1727 -    Sint16 *dst;
  1.1728 -
  1.1729 -#if DEBUG_CONVERT
  1.1730 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n");
  1.1731 -#endif
  1.1732 -
  1.1733 -    src = (const Uint32 *) cvt->buf;
  1.1734 -    dst = (Sint16 *) cvt->buf;
  1.1735 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1736 -        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
  1.1737 -        *dst = ((Sint16) SDL_SwapLE16(val));
  1.1738 -    }
  1.1739 -
  1.1740 -    cvt->len_cvt /= 2;
  1.1741 -    if (cvt->filters[++cvt->filter_index]) {
  1.1742 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
  1.1743 -    }
  1.1744 -}
  1.1745 -
  1.1746 -static void SDLCALL
  1.1747 -SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1748 -{
  1.1749 -    int i;
  1.1750 -    const Uint32 *src;
  1.1751 -    Uint16 *dst;
  1.1752 -
  1.1753 -#if DEBUG_CONVERT
  1.1754 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n");
  1.1755 -#endif
  1.1756 -
  1.1757 -    src = (const Uint32 *) cvt->buf;
  1.1758 -    dst = (Uint16 *) cvt->buf;
  1.1759 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1760 -        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
  1.1761 -        *dst = SDL_SwapBE16(val);
  1.1762 -    }
  1.1763 -
  1.1764 -    cvt->len_cvt /= 2;
  1.1765 -    if (cvt->filters[++cvt->filter_index]) {
  1.1766 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
  1.1767 -    }
  1.1768 -}
  1.1769 -
  1.1770 -static void SDLCALL
  1.1771 -SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1772 -{
  1.1773 -    int i;
  1.1774 -    const Uint32 *src;
  1.1775 -    Sint16 *dst;
  1.1776 -
  1.1777 -#if DEBUG_CONVERT
  1.1778 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n");
  1.1779 -#endif
  1.1780 -
  1.1781 -    src = (const Uint32 *) cvt->buf;
  1.1782 -    dst = (Sint16 *) cvt->buf;
  1.1783 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1784 -        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
  1.1785 -        *dst = ((Sint16) SDL_SwapBE16(val));
  1.1786 -    }
  1.1787 -
  1.1788 -    cvt->len_cvt /= 2;
  1.1789 -    if (cvt->filters[++cvt->filter_index]) {
  1.1790 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
  1.1791 -    }
  1.1792 -}
  1.1793 -
  1.1794 -static void SDLCALL
  1.1795 -SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1796 -{
  1.1797 -    int i;
  1.1798 -    const Uint32 *src;
  1.1799 -    Sint32 *dst;
  1.1800 -
  1.1801 -#if DEBUG_CONVERT
  1.1802 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n");
  1.1803 -#endif
  1.1804 -
  1.1805 -    src = (const Uint32 *) cvt->buf;
  1.1806 -    dst = (Sint32 *) cvt->buf;
  1.1807 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1808 -        const Sint32 val = ((Sint32) SDL_SwapBE32(*src));
  1.1809 -        *dst = ((Sint32) SDL_SwapLE32(val));
  1.1810 -    }
  1.1811 -
  1.1812 -    if (cvt->filters[++cvt->filter_index]) {
  1.1813 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
  1.1814 -    }
  1.1815 -}
  1.1816 -
  1.1817 -static void SDLCALL
  1.1818 -SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1819 -{
  1.1820 -    int i;
  1.1821 -    const Uint32 *src;
  1.1822 -    float *dst;
  1.1823 -
  1.1824 -#if DEBUG_CONVERT
  1.1825 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n");
  1.1826 -#endif
  1.1827 -
  1.1828 -    src = (const Uint32 *) cvt->buf;
  1.1829 -    dst = (float *) cvt->buf;
  1.1830 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1831 -        const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
  1.1832 -        *dst = SDL_SwapFloatLE(val);
  1.1833 -    }
  1.1834 -
  1.1835 -    if (cvt->filters[++cvt->filter_index]) {
  1.1836 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
  1.1837 -    }
  1.1838 -}
  1.1839 -
  1.1840 -static void SDLCALL
  1.1841 -SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1842 -{
  1.1843 -    int i;
  1.1844 -    const Uint32 *src;
  1.1845 -    float *dst;
  1.1846 -
  1.1847 -#if DEBUG_CONVERT
  1.1848 -    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n");
  1.1849 -#endif
  1.1850 -
  1.1851 -    src = (const Uint32 *) cvt->buf;
  1.1852 -    dst = (float *) cvt->buf;
  1.1853 -    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
  1.1854 -        const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
  1.1855 -        *dst = SDL_SwapFloatBE(val);
  1.1856 -    }
  1.1857 -
  1.1858 -    if (cvt->filters[++cvt->filter_index]) {
  1.1859 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
  1.1860 -    }
  1.1861 -}
  1.1862 -
  1.1863 -static void SDLCALL
  1.1864 -SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1865 -{
  1.1866 -    int i;
  1.1867 -    const float *src;
  1.1868 -    Uint8 *dst;
  1.1869 -
  1.1870 -#if DEBUG_CONVERT
  1.1871 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n");
  1.1872 -#endif
  1.1873 -
  1.1874 -    src = (const float *) cvt->buf;
  1.1875 -    dst = (Uint8 *) cvt->buf;
  1.1876 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.1877 -        const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f));
  1.1878 -        *dst = val;
  1.1879 -    }
  1.1880 -
  1.1881 -    cvt->len_cvt /= 4;
  1.1882 -    if (cvt->filters[++cvt->filter_index]) {
  1.1883 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
  1.1884 -    }
  1.1885 -}
  1.1886 -
  1.1887 -static void SDLCALL
  1.1888 -SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1889 -{
  1.1890 -    int i;
  1.1891 -    const float *src;
  1.1892 -    Sint8 *dst;
  1.1893 -
  1.1894 -#if DEBUG_CONVERT
  1.1895 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n");
  1.1896 -#endif
  1.1897 -
  1.1898 -    src = (const float *) cvt->buf;
  1.1899 -    dst = (Sint8 *) cvt->buf;
  1.1900 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.1901 -        const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f));
  1.1902 -        *dst = ((Sint8) val);
  1.1903 -    }
  1.1904 -
  1.1905 -    cvt->len_cvt /= 4;
  1.1906 -    if (cvt->filters[++cvt->filter_index]) {
  1.1907 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
  1.1908 -    }
  1.1909 -}
  1.1910 -
  1.1911 -static void SDLCALL
  1.1912 -SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1913 -{
  1.1914 -    int i;
  1.1915 -    const float *src;
  1.1916 -    Uint16 *dst;
  1.1917 -
  1.1918 -#if DEBUG_CONVERT
  1.1919 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n");
  1.1920 -#endif
  1.1921 -
  1.1922 -    src = (const float *) cvt->buf;
  1.1923 -    dst = (Uint16 *) cvt->buf;
  1.1924 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.1925 -        const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
  1.1926 -        *dst = SDL_SwapLE16(val);
  1.1927 -    }
  1.1928 -
  1.1929 -    cvt->len_cvt /= 2;
  1.1930 -    if (cvt->filters[++cvt->filter_index]) {
  1.1931 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
  1.1932 -    }
  1.1933 -}
  1.1934 -
  1.1935 -static void SDLCALL
  1.1936 -SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1937 -{
  1.1938 -    int i;
  1.1939 -    const float *src;
  1.1940 -    Sint16 *dst;
  1.1941 -
  1.1942 -#if DEBUG_CONVERT
  1.1943 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n");
  1.1944 -#endif
  1.1945 -
  1.1946 -    src = (const float *) cvt->buf;
  1.1947 -    dst = (Sint16 *) cvt->buf;
  1.1948 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.1949 -        const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
  1.1950 -        *dst = ((Sint16) SDL_SwapLE16(val));
  1.1951 -    }
  1.1952 -
  1.1953 -    cvt->len_cvt /= 2;
  1.1954 -    if (cvt->filters[++cvt->filter_index]) {
  1.1955 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
  1.1956 -    }
  1.1957 -}
  1.1958 -
  1.1959 -static void SDLCALL
  1.1960 -SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1961 -{
  1.1962 -    int i;
  1.1963 -    const float *src;
  1.1964 -    Uint16 *dst;
  1.1965 -
  1.1966 -#if DEBUG_CONVERT
  1.1967 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n");
  1.1968 -#endif
  1.1969 -
  1.1970 -    src = (const float *) cvt->buf;
  1.1971 -    dst = (Uint16 *) cvt->buf;
  1.1972 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.1973 -        const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
  1.1974 -        *dst = SDL_SwapBE16(val);
  1.1975 -    }
  1.1976 -
  1.1977 -    cvt->len_cvt /= 2;
  1.1978 -    if (cvt->filters[++cvt->filter_index]) {
  1.1979 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
  1.1980 -    }
  1.1981 -}
  1.1982 -
  1.1983 -static void SDLCALL
  1.1984 -SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.1985 -{
  1.1986 -    int i;
  1.1987 -    const float *src;
  1.1988 -    Sint16 *dst;
  1.1989 -
  1.1990 -#if DEBUG_CONVERT
  1.1991 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n");
  1.1992 -#endif
  1.1993 -
  1.1994 -    src = (const float *) cvt->buf;
  1.1995 -    dst = (Sint16 *) cvt->buf;
  1.1996 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.1997 -        const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
  1.1998 -        *dst = ((Sint16) SDL_SwapBE16(val));
  1.1999 -    }
  1.2000 -
  1.2001 -    cvt->len_cvt /= 2;
  1.2002 -    if (cvt->filters[++cvt->filter_index]) {
  1.2003 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
  1.2004 -    }
  1.2005 -}
  1.2006 -
  1.2007 -static void SDLCALL
  1.2008 -SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2009 -{
  1.2010 -    int i;
  1.2011 -    const float *src;
  1.2012 -    Sint32 *dst;
  1.2013 -
  1.2014 -#if DEBUG_CONVERT
  1.2015 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n");
  1.2016 -#endif
  1.2017 -
  1.2018 -    src = (const float *) cvt->buf;
  1.2019 -    dst = (Sint32 *) cvt->buf;
  1.2020 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2021 -        const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
  1.2022 -        *dst = ((Sint32) SDL_SwapLE32(val));
  1.2023 -    }
  1.2024 -
  1.2025 -    if (cvt->filters[++cvt->filter_index]) {
  1.2026 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
  1.2027 -    }
  1.2028 -}
  1.2029 -
  1.2030 -static void SDLCALL
  1.2031 -SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2032 -{
  1.2033 -    int i;
  1.2034 -    const float *src;
  1.2035 -    Sint32 *dst;
  1.2036 -
  1.2037 -#if DEBUG_CONVERT
  1.2038 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n");
  1.2039 -#endif
  1.2040 -
  1.2041 -    src = (const float *) cvt->buf;
  1.2042 -    dst = (Sint32 *) cvt->buf;
  1.2043 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2044 -        const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
  1.2045 -        *dst = ((Sint32) SDL_SwapBE32(val));
  1.2046 -    }
  1.2047 -
  1.2048 -    if (cvt->filters[++cvt->filter_index]) {
  1.2049 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
  1.2050 -    }
  1.2051 -}
  1.2052 -
  1.2053 -static void SDLCALL
  1.2054 -SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2055 -{
  1.2056 -    int i;
  1.2057 -    const float *src;
  1.2058 -    float *dst;
  1.2059 -
  1.2060 -#if DEBUG_CONVERT
  1.2061 -    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n");
  1.2062 -#endif
  1.2063 -
  1.2064 -    src = (const float *) cvt->buf;
  1.2065 -    dst = (float *) cvt->buf;
  1.2066 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2067 -        const float val = SDL_SwapFloatLE(*src);
  1.2068 -        *dst = SDL_SwapFloatBE(val);
  1.2069 -    }
  1.2070 -
  1.2071 -    if (cvt->filters[++cvt->filter_index]) {
  1.2072 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
  1.2073 -    }
  1.2074 -}
  1.2075 -
  1.2076 -static void SDLCALL
  1.2077 -SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2078 -{
  1.2079 -    int i;
  1.2080 -    const float *src;
  1.2081 -    Uint8 *dst;
  1.2082 -
  1.2083 -#if DEBUG_CONVERT
  1.2084 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n");
  1.2085 -#endif
  1.2086 -
  1.2087 -    src = (const float *) cvt->buf;
  1.2088 -    dst = (Uint8 *) cvt->buf;
  1.2089 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2090 -        const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f));
  1.2091 -        *dst = val;
  1.2092 -    }
  1.2093 -
  1.2094 -    cvt->len_cvt /= 4;
  1.2095 -    if (cvt->filters[++cvt->filter_index]) {
  1.2096 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
  1.2097 -    }
  1.2098 -}
  1.2099 -
  1.2100 -static void SDLCALL
  1.2101 -SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2102 -{
  1.2103 -    int i;
  1.2104 -    const float *src;
  1.2105 -    Sint8 *dst;
  1.2106 -
  1.2107 -#if DEBUG_CONVERT
  1.2108 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n");
  1.2109 -#endif
  1.2110 -
  1.2111 -    src = (const float *) cvt->buf;
  1.2112 -    dst = (Sint8 *) cvt->buf;
  1.2113 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2114 -        const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f));
  1.2115 -        *dst = ((Sint8) val);
  1.2116 -    }
  1.2117 -
  1.2118 -    cvt->len_cvt /= 4;
  1.2119 -    if (cvt->filters[++cvt->filter_index]) {
  1.2120 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
  1.2121 -    }
  1.2122 -}
  1.2123 -
  1.2124 -static void SDLCALL
  1.2125 -SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2126 -{
  1.2127 -    int i;
  1.2128 -    const float *src;
  1.2129 -    Uint16 *dst;
  1.2130 -
  1.2131 -#if DEBUG_CONVERT
  1.2132 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n");
  1.2133 -#endif
  1.2134 -
  1.2135 -    src = (const float *) cvt->buf;
  1.2136 -    dst = (Uint16 *) cvt->buf;
  1.2137 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2138 -        const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
  1.2139 -        *dst = SDL_SwapLE16(val);
  1.2140 -    }
  1.2141 -
  1.2142 -    cvt->len_cvt /= 2;
  1.2143 -    if (cvt->filters[++cvt->filter_index]) {
  1.2144 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
  1.2145 -    }
  1.2146 -}
  1.2147 -
  1.2148 -static void SDLCALL
  1.2149 -SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2150 -{
  1.2151 -    int i;
  1.2152 -    const float *src;
  1.2153 -    Sint16 *dst;
  1.2154 -
  1.2155 -#if DEBUG_CONVERT
  1.2156 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n");
  1.2157 -#endif
  1.2158 -
  1.2159 -    src = (const float *) cvt->buf;
  1.2160 -    dst = (Sint16 *) cvt->buf;
  1.2161 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2162 -        const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
  1.2163 -        *dst = ((Sint16) SDL_SwapLE16(val));
  1.2164 -    }
  1.2165 -
  1.2166 -    cvt->len_cvt /= 2;
  1.2167 -    if (cvt->filters[++cvt->filter_index]) {
  1.2168 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
  1.2169 -    }
  1.2170 -}
  1.2171 -
  1.2172 -static void SDLCALL
  1.2173 -SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2174 -{
  1.2175 -    int i;
  1.2176 -    const float *src;
  1.2177 -    Uint16 *dst;
  1.2178 -
  1.2179 -#if DEBUG_CONVERT
  1.2180 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n");
  1.2181 -#endif
  1.2182 -
  1.2183 -    src = (const float *) cvt->buf;
  1.2184 -    dst = (Uint16 *) cvt->buf;
  1.2185 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2186 -        const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
  1.2187 -        *dst = SDL_SwapBE16(val);
  1.2188 -    }
  1.2189 -
  1.2190 -    cvt->len_cvt /= 2;
  1.2191 -    if (cvt->filters[++cvt->filter_index]) {
  1.2192 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
  1.2193 -    }
  1.2194 -}
  1.2195 -
  1.2196 -static void SDLCALL
  1.2197 -SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2198 -{
  1.2199 -    int i;
  1.2200 -    const float *src;
  1.2201 -    Sint16 *dst;
  1.2202 -
  1.2203 -#if DEBUG_CONVERT
  1.2204 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n");
  1.2205 -#endif
  1.2206 -
  1.2207 -    src = (const float *) cvt->buf;
  1.2208 -    dst = (Sint16 *) cvt->buf;
  1.2209 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2210 -        const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
  1.2211 -        *dst = ((Sint16) SDL_SwapBE16(val));
  1.2212 -    }
  1.2213 -
  1.2214 -    cvt->len_cvt /= 2;
  1.2215 -    if (cvt->filters[++cvt->filter_index]) {
  1.2216 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
  1.2217 -    }
  1.2218 -}
  1.2219 -
  1.2220 -static void SDLCALL
  1.2221 -SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2222 -{
  1.2223 -    int i;
  1.2224 -    const float *src;
  1.2225 -    Sint32 *dst;
  1.2226 -
  1.2227 -#if DEBUG_CONVERT
  1.2228 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n");
  1.2229 -#endif
  1.2230 -
  1.2231 -    src = (const float *) cvt->buf;
  1.2232 -    dst = (Sint32 *) cvt->buf;
  1.2233 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2234 -        const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
  1.2235 -        *dst = ((Sint32) SDL_SwapLE32(val));
  1.2236 -    }
  1.2237 -
  1.2238 -    if (cvt->filters[++cvt->filter_index]) {
  1.2239 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
  1.2240 -    }
  1.2241 -}
  1.2242 -
  1.2243 -static void SDLCALL
  1.2244 -SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2245 -{
  1.2246 -    int i;
  1.2247 -    const float *src;
  1.2248 -    Sint32 *dst;
  1.2249 -
  1.2250 -#if DEBUG_CONVERT
  1.2251 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n");
  1.2252 -#endif
  1.2253 -
  1.2254 -    src = (const float *) cvt->buf;
  1.2255 -    dst = (Sint32 *) cvt->buf;
  1.2256 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2257 -        const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
  1.2258 -        *dst = ((Sint32) SDL_SwapBE32(val));
  1.2259 -    }
  1.2260 -
  1.2261 -    if (cvt->filters[++cvt->filter_index]) {
  1.2262 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
  1.2263 -    }
  1.2264 -}
  1.2265 -
  1.2266 -static void SDLCALL
  1.2267 -SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2268 -{
  1.2269 -    int i;
  1.2270 -    const float *src;
  1.2271 -    float *dst;
  1.2272 -
  1.2273 -#if DEBUG_CONVERT
  1.2274 -    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n");
  1.2275 -#endif
  1.2276 -
  1.2277 -    src = (const float *) cvt->buf;
  1.2278 -    dst = (float *) cvt->buf;
  1.2279 -    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
  1.2280 -        const float val = SDL_SwapFloatBE(*src);
  1.2281 -        *dst = SDL_SwapFloatLE(val);
  1.2282 -    }
  1.2283 -
  1.2284 -    if (cvt->filters[++cvt->filter_index]) {
  1.2285 -        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
  1.2286 -    }
  1.2287 -}
  1.2288 -
  1.2289 -#endif  /* !NO_CONVERTERS */
  1.2290 -
  1.2291 -
  1.2292 -const SDL_AudioTypeFilters sdl_audio_type_filters[] =
  1.2293 -{
  1.2294 -#if !NO_CONVERTERS
  1.2295 -    { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 },
  1.2296 -    { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB },
  1.2297 -    { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB },
  1.2298 -    { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB },
  1.2299 -    { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB },
  1.2300 -    { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB },
  1.2301 -    { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB },
  1.2302 -    { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB },
  1.2303 -    { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB },
  1.2304 -    { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 },
  1.2305 -    { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB },
  1.2306 -    { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB },
  1.2307 -    { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB },
  1.2308 -    { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB },
  1.2309 -    { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB },
  1.2310 -    { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB },
  1.2311 -    { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB },
  1.2312 -    { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB },
  1.2313 -    { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 },
  1.2314 -    { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 },
  1.2315 -    { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB },
  1.2316 -    { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB },
  1.2317 -    { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB },
  1.2318 -    { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB },
  1.2319 -    { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB },
  1.2320 -    { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB },
  1.2321 -    { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB },
  1.2322 -    { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 },
  1.2323 -    { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 },
  1.2324 -    { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB },
  1.2325 -    { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB },
  1.2326 -    { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB },
  1.2327 -    { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB },
  1.2328 -    { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB },
  1.2329 -    { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB },
  1.2330 -    { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB },
  1.2331 -    { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 },
  1.2332 -    { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 },
  1.2333 -    { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB },
  1.2334 -    { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB },
  1.2335 -    { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB },
  1.2336 -    { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB },
  1.2337 -    { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB },
  1.2338 -    { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB },
  1.2339 -    { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB },
  1.2340 -    { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 },
  1.2341 -    { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 },
  1.2342 -    { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB },
  1.2343 -    { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB },
  1.2344 -    { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB },
  1.2345 -    { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB },
  1.2346 -    { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB },
  1.2347 -    { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB },
  1.2348 -    { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB },
  1.2349 -    { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 },
  1.2350 -    { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 },
  1.2351 -    { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB },
  1.2352 -    { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB },
  1.2353 -    { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB },
  1.2354 -    { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB },
  1.2355 -    { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB },
  1.2356 -    { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB },
  1.2357 -    { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB },
  1.2358 -    { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 },
  1.2359 -    { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 },
  1.2360 -    { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB },
  1.2361 -    { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB },
  1.2362 -    { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB },
  1.2363 -    { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB },
  1.2364 -    { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB },
  1.2365 -    { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB },
  1.2366 -    { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB },
  1.2367 -    { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 },
  1.2368 -    { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 },
  1.2369 -    { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB },
  1.2370 -    { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB },
  1.2371 -    { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB },
  1.2372 -    { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB },
  1.2373 -    { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB },
  1.2374 -    { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB },
  1.2375 -    { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB },
  1.2376 -    { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 },
  1.2377 -    { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 },
  1.2378 -    { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB },
  1.2379 -    { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB },
  1.2380 -    { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB },
  1.2381 -    { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB },
  1.2382 -    { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB },
  1.2383 -    { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB },
  1.2384 -    { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB },
  1.2385 -#endif  /* !NO_CONVERTERS */
  1.2386 -    { 0, 0, NULL }
  1.2387 -};
  1.2388 -
  1.2389 -
  1.2390 -#if !NO_RESAMPLERS
  1.2391 -
  1.2392 -static void SDLCALL
  1.2393 -SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2394 -{
  1.2395 -#if DEBUG_CONVERT
  1.2396 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
  1.2397 -#endif
  1.2398 -
  1.2399 -    const int srcsize = cvt->len_cvt - 16;
  1.2400 -    const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
  1.2401 -    register int eps = 0;
  1.2402 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
  1.2403 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.2404 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.2405 -    Uint8 sample0 = src[0];
  1.2406 -    Uint8 last_sample0 = sample0;
  1.2407      while (dst >= target) {
  1.2408 -        dst[0] = sample0;
  1.2409 -        dst--;
  1.2410 -        eps += srcsize;
  1.2411 -        if ((eps << 1) >= dstsize) {
  1.2412 -            src--;
  1.2413 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2414 -            last_sample0 = sample0;
  1.2415 -            eps -= dstsize;
  1.2416 -        }
  1.2417 -    }
  1.2418 -    cvt->len_cvt = dstsize;
  1.2419 -    if (cvt->filters[++cvt->filter_index]) {
  1.2420 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2421 -    }
  1.2422 -}
  1.2423 -
  1.2424 -static void SDLCALL
  1.2425 -SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2426 -{
  1.2427 -#if DEBUG_CONVERT
  1.2428 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
  1.2429 -#endif
  1.2430 -
  1.2431 -    const int srcsize = cvt->len_cvt - 16;
  1.2432 -    const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
  1.2433 -    register int eps = 0;
  1.2434 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.2435 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.2436 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.2437 -    Uint8 sample0 = src[0];
  1.2438 -    Uint8 last_sample0 = sample0;
  1.2439 -    while (dst < target) {
  1.2440 -        src++;
  1.2441 -        eps += dstsize;
  1.2442 -        if ((eps << 1) >= srcsize) {
  1.2443 -            dst[0] = sample0;
  1.2444 -            dst++;
  1.2445 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2446 -            last_sample0 = sample0;
  1.2447 -            eps -= srcsize;
  1.2448 -        }
  1.2449 -    }
  1.2450 -    cvt->len_cvt = dstsize;
  1.2451 -    if (cvt->filters[++cvt->filter_index]) {
  1.2452 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2453 -    }
  1.2454 -}
  1.2455 -
  1.2456 -static void SDLCALL
  1.2457 -SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2458 -{
  1.2459 -#if DEBUG_CONVERT
  1.2460 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
  1.2461 -#endif
  1.2462 -
  1.2463 -    const int srcsize = cvt->len_cvt - 32;
  1.2464 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.2465 -    register int eps = 0;
  1.2466 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
  1.2467 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.2468 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.2469 -    Uint8 sample1 = src[1];
  1.2470 -    Uint8 sample0 = src[0];
  1.2471 -    Uint8 last_sample1 = sample1;
  1.2472 -    Uint8 last_sample0 = sample0;
  1.2473 -    while (dst >= target) {
  1.2474 -        dst[1] = sample1;
  1.2475 -        dst[0] = sample0;
  1.2476 -        dst -= 2;
  1.2477 -        eps += srcsize;
  1.2478 -        if ((eps << 1) >= dstsize) {
  1.2479 -            src -= 2;
  1.2480 -            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
  1.2481 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2482 -            last_sample1 = sample1;
  1.2483 -            last_sample0 = sample0;
  1.2484 -            eps -= dstsize;
  1.2485 -        }
  1.2486 -    }
  1.2487 -    cvt->len_cvt = dstsize;
  1.2488 -    if (cvt->filters[++cvt->filter_index]) {
  1.2489 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2490 -    }
  1.2491 -}
  1.2492 -
  1.2493 -static void SDLCALL
  1.2494 -SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2495 -{
  1.2496 -#if DEBUG_CONVERT
  1.2497 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
  1.2498 -#endif
  1.2499 -
  1.2500 -    const int srcsize = cvt->len_cvt - 32;
  1.2501 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.2502 -    register int eps = 0;
  1.2503 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.2504 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.2505 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.2506 -    Uint8 sample0 = src[0];
  1.2507 -    Uint8 sample1 = src[1];
  1.2508 -    Uint8 last_sample0 = sample0;
  1.2509 -    Uint8 last_sample1 = sample1;
  1.2510 -    while (dst < target) {
  1.2511 -        src += 2;
  1.2512 -        eps += dstsize;
  1.2513 -        if ((eps << 1) >= srcsize) {
  1.2514 -            dst[0] = sample0;
  1.2515 -            dst[1] = sample1;
  1.2516 -            dst += 2;
  1.2517 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2518 -            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
  1.2519 -            last_sample0 = sample0;
  1.2520 -            last_sample1 = sample1;
  1.2521 -            eps -= srcsize;
  1.2522 -        }
  1.2523 -    }
  1.2524 -    cvt->len_cvt = dstsize;
  1.2525 -    if (cvt->filters[++cvt->filter_index]) {
  1.2526 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2527 -    }
  1.2528 -}
  1.2529 -
  1.2530 -static void SDLCALL
  1.2531 -SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2532 -{
  1.2533 -#if DEBUG_CONVERT
  1.2534 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
  1.2535 -#endif
  1.2536 -
  1.2537 -    const int srcsize = cvt->len_cvt - 64;
  1.2538 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.2539 -    register int eps = 0;
  1.2540 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
  1.2541 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.2542 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.2543 -    Uint8 sample3 = src[3];
  1.2544 -    Uint8 sample2 = src[2];
  1.2545 -    Uint8 sample1 = src[1];
  1.2546 -    Uint8 sample0 = src[0];
  1.2547 -    Uint8 last_sample3 = sample3;
  1.2548 -    Uint8 last_sample2 = sample2;
  1.2549 -    Uint8 last_sample1 = sample1;
  1.2550 -    Uint8 last_sample0 = sample0;
  1.2551 -    while (dst >= target) {
  1.2552 -        dst[3] = sample3;
  1.2553 -        dst[2] = sample2;
  1.2554 -        dst[1] = sample1;
  1.2555 -        dst[0] = sample0;
  1.2556 -        dst -= 4;
  1.2557 -        eps += srcsize;
  1.2558 -        if ((eps << 1) >= dstsize) {
  1.2559 -            src -= 4;
  1.2560 -            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
  1.2561 -            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
  1.2562 -            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
  1.2563 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2564 -            last_sample3 = sample3;
  1.2565 -            last_sample2 = sample2;
  1.2566 -            last_sample1 = sample1;
  1.2567 -            last_sample0 = sample0;
  1.2568 -            eps -= dstsize;
  1.2569 -        }
  1.2570 -    }
  1.2571 -    cvt->len_cvt = dstsize;
  1.2572 -    if (cvt->filters[++cvt->filter_index]) {
  1.2573 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2574 -    }
  1.2575 -}
  1.2576 -
  1.2577 -static void SDLCALL
  1.2578 -SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2579 -{
  1.2580 -#if DEBUG_CONVERT
  1.2581 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
  1.2582 -#endif
  1.2583 -
  1.2584 -    const int srcsize = cvt->len_cvt - 64;
  1.2585 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.2586 -    register int eps = 0;
  1.2587 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.2588 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.2589 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.2590 -    Uint8 sample0 = src[0];
  1.2591 -    Uint8 sample1 = src[1];
  1.2592 -    Uint8 sample2 = src[2];
  1.2593 -    Uint8 sample3 = src[3];
  1.2594 -    Uint8 last_sample0 = sample0;
  1.2595 -    Uint8 last_sample1 = sample1;
  1.2596 -    Uint8 last_sample2 = sample2;
  1.2597 -    Uint8 last_sample3 = sample3;
  1.2598 -    while (dst < target) {
  1.2599 -        src += 4;
  1.2600 -        eps += dstsize;
  1.2601 -        if ((eps << 1) >= srcsize) {
  1.2602 -            dst[0] = sample0;
  1.2603 -            dst[1] = sample1;
  1.2604 -            dst[2] = sample2;
  1.2605 -            dst[3] = sample3;
  1.2606 -            dst += 4;
  1.2607 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2608 -            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
  1.2609 -            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
  1.2610 -            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
  1.2611 -            last_sample0 = sample0;
  1.2612 -            last_sample1 = sample1;
  1.2613 -            last_sample2 = sample2;
  1.2614 -            last_sample3 = sample3;
  1.2615 -            eps -= srcsize;
  1.2616 -        }
  1.2617 -    }
  1.2618 -    cvt->len_cvt = dstsize;
  1.2619 -    if (cvt->filters[++cvt->filter_index]) {
  1.2620 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2621 -    }
  1.2622 -}
  1.2623 -
  1.2624 -static void SDLCALL
  1.2625 -SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2626 -{
  1.2627 -#if DEBUG_CONVERT
  1.2628 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
  1.2629 -#endif
  1.2630 -
  1.2631 -    const int srcsize = cvt->len_cvt - 96;
  1.2632 -    const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
  1.2633 -    register int eps = 0;
  1.2634 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
  1.2635 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.2636 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.2637 -    Uint8 sample5 = src[5];
  1.2638 -    Uint8 sample4 = src[4];
  1.2639 -    Uint8 sample3 = src[3];
  1.2640 -    Uint8 sample2 = src[2];
  1.2641 -    Uint8 sample1 = src[1];
  1.2642 -    Uint8 sample0 = src[0];
  1.2643 -    Uint8 last_sample5 = sample5;
  1.2644 -    Uint8 last_sample4 = sample4;
  1.2645 -    Uint8 last_sample3 = sample3;
  1.2646 -    Uint8 last_sample2 = sample2;
  1.2647 -    Uint8 last_sample1 = sample1;
  1.2648 -    Uint8 last_sample0 = sample0;
  1.2649 -    while (dst >= target) {
  1.2650 -        dst[5] = sample5;
  1.2651 -        dst[4] = sample4;
  1.2652 -        dst[3] = sample3;
  1.2653 -        dst[2] = sample2;
  1.2654 -        dst[1] = sample1;
  1.2655 -        dst[0] = sample0;
  1.2656 -        dst -= 6;
  1.2657 -        eps += srcsize;
  1.2658 -        if ((eps << 1) >= dstsize) {
  1.2659 -            src -= 6;
  1.2660 -            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
  1.2661 -            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
  1.2662 -            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
  1.2663 -            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
  1.2664 -            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
  1.2665 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2666 -            last_sample5 = sample5;
  1.2667 -            last_sample4 = sample4;
  1.2668 -            last_sample3 = sample3;
  1.2669 -            last_sample2 = sample2;
  1.2670 -            last_sample1 = sample1;
  1.2671 -            last_sample0 = sample0;
  1.2672 -            eps -= dstsize;
  1.2673 -        }
  1.2674 -    }
  1.2675 -    cvt->len_cvt = dstsize;
  1.2676 -    if (cvt->filters[++cvt->filter_index]) {
  1.2677 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2678 -    }
  1.2679 -}
  1.2680 -
  1.2681 -static void SDLCALL
  1.2682 -SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2683 -{
  1.2684 -#if DEBUG_CONVERT
  1.2685 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
  1.2686 -#endif
  1.2687 -
  1.2688 -    const int srcsize = cvt->len_cvt - 96;
  1.2689 -    const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
  1.2690 -    register int eps = 0;
  1.2691 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.2692 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.2693 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.2694 -    Uint8 sample0 = src[0];
  1.2695 -    Uint8 sample1 = src[1];
  1.2696 -    Uint8 sample2 = src[2];
  1.2697 -    Uint8 sample3 = src[3];
  1.2698 -    Uint8 sample4 = src[4];
  1.2699 -    Uint8 sample5 = src[5];
  1.2700 -    Uint8 last_sample0 = sample0;
  1.2701 -    Uint8 last_sample1 = sample1;
  1.2702 -    Uint8 last_sample2 = sample2;
  1.2703 -    Uint8 last_sample3 = sample3;
  1.2704 -    Uint8 last_sample4 = sample4;
  1.2705 -    Uint8 last_sample5 = sample5;
  1.2706 -    while (dst < target) {
  1.2707 -        src += 6;
  1.2708 -        eps += dstsize;
  1.2709 -        if ((eps << 1) >= srcsize) {
  1.2710 -            dst[0] = sample0;
  1.2711 -            dst[1] = sample1;
  1.2712 -            dst[2] = sample2;
  1.2713 -            dst[3] = sample3;
  1.2714 -            dst[4] = sample4;
  1.2715 -            dst[5] = sample5;
  1.2716 -            dst += 6;
  1.2717 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2718 -            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
  1.2719 -            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
  1.2720 -            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
  1.2721 -            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
  1.2722 -            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
  1.2723 -            last_sample0 = sample0;
  1.2724 -            last_sample1 = sample1;
  1.2725 -            last_sample2 = sample2;
  1.2726 -            last_sample3 = sample3;
  1.2727 -            last_sample4 = sample4;
  1.2728 -            last_sample5 = sample5;
  1.2729 -            eps -= srcsize;
  1.2730 -        }
  1.2731 -    }
  1.2732 -    cvt->len_cvt = dstsize;
  1.2733 -    if (cvt->filters[++cvt->filter_index]) {
  1.2734 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2735 -    }
  1.2736 -}
  1.2737 -
  1.2738 -static void SDLCALL
  1.2739 -SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2740 -{
  1.2741 -#if DEBUG_CONVERT
  1.2742 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
  1.2743 -#endif
  1.2744 -
  1.2745 -    const int srcsize = cvt->len_cvt - 128;
  1.2746 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.2747 -    register int eps = 0;
  1.2748 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
  1.2749 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.2750 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.2751 -    Uint8 sample7 = src[7];
  1.2752 -    Uint8 sample6 = src[6];
  1.2753 -    Uint8 sample5 = src[5];
  1.2754 -    Uint8 sample4 = src[4];
  1.2755 -    Uint8 sample3 = src[3];
  1.2756 -    Uint8 sample2 = src[2];
  1.2757 -    Uint8 sample1 = src[1];
  1.2758 -    Uint8 sample0 = src[0];
  1.2759 -    Uint8 last_sample7 = sample7;
  1.2760 -    Uint8 last_sample6 = sample6;
  1.2761 -    Uint8 last_sample5 = sample5;
  1.2762 -    Uint8 last_sample4 = sample4;
  1.2763 -    Uint8 last_sample3 = sample3;
  1.2764 -    Uint8 last_sample2 = sample2;
  1.2765 -    Uint8 last_sample1 = sample1;
  1.2766 -    Uint8 last_sample0 = sample0;
  1.2767 -    while (dst >= target) {
  1.2768 -        dst[7] = sample7;
  1.2769 -        dst[6] = sample6;
  1.2770 -        dst[5] = sample5;
  1.2771 -        dst[4] = sample4;
  1.2772 -        dst[3] = sample3;
  1.2773 -        dst[2] = sample2;
  1.2774 -        dst[1] = sample1;
  1.2775 -        dst[0] = sample0;
  1.2776 +        SDL_memcpy(dst, sample, cpy);
  1.2777          dst -= 8;
  1.2778          eps += srcsize;
  1.2779          if ((eps << 1) >= dstsize) {
  1.2780              src -= 8;
  1.2781 -            sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
  1.2782 -            sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
  1.2783 -            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
  1.2784 -            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
  1.2785 -            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
  1.2786 -            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
  1.2787 -            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
  1.2788 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2789 -            last_sample7 = sample7;
  1.2790 -            last_sample6 = sample6;
  1.2791 -            last_sample5 = sample5;
  1.2792 -            last_sample4 = sample4;
  1.2793 -            last_sample3 = sample3;
  1.2794 -            last_sample2 = sample2;
  1.2795 -            last_sample1 = sample1;
  1.2796 -            last_sample0 = sample0;
  1.2797 +            for (i = 0; i < channels; i++) {
  1.2798 +                sample[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.5);
  1.2799 +            }
  1.2800 +            SDL_memcpy(last_sample, sample, cpy);
  1.2801              eps -= dstsize;
  1.2802          }
  1.2803      }
  1.2804 +
  1.2805      cvt->len_cvt = dstsize;
  1.2806      if (cvt->filters[++cvt->filter_index]) {
  1.2807 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2808 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
  1.2809      }
  1.2810  }
  1.2811  
  1.2812 -static void SDLCALL
  1.2813 -SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2814 +void
  1.2815 +SDL_Downsample_Arbitrary(SDL_AudioCVT *cvt, const int channels)
  1.2816  {
  1.2817 +    const int srcsize = cvt->len_cvt - (64 * channels);
  1.2818 +    const int dstsize = (int) (((double)(cvt->len_cvt/(channels*4))) * cvt->rate_incr) * (channels*4);
  1.2819 +    register int eps = 0;
  1.2820 +    float *dst = (float *) cvt->buf;
  1.2821 +    const float *src = (float *) cvt->buf;
  1.2822 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.2823 +    const size_t cpy = sizeof (float) * channels;
  1.2824 +    float last_sample[8];
  1.2825 +    float sample[8];
  1.2826 +    int i;
  1.2827 +
  1.2828  #if DEBUG_CONVERT
  1.2829 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
  1.2830 +    fprintf(stderr, "Downsample arbitrary (x%f), %d channels.\n", cvt->rate_incr, channels);
  1.2831  #endif
  1.2832  
  1.2833 -    const int srcsize = cvt->len_cvt - 128;
  1.2834 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.2835 -    register int eps = 0;
  1.2836 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.2837 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.2838 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.2839 -    Uint8 sample0 = src[0];
  1.2840 -    Uint8 sample1 = src[1];
  1.2841 -    Uint8 sample2 = src[2];
  1.2842 -    Uint8 sample3 = src[3];
  1.2843 -    Uint8 sample4 = src[4];
  1.2844 -    Uint8 sample5 = src[5];
  1.2845 -    Uint8 sample6 = src[6];
  1.2846 -    Uint8 sample7 = src[7];
  1.2847 -    Uint8 last_sample0 = sample0;
  1.2848 -    Uint8 last_sample1 = sample1;
  1.2849 -    Uint8 last_sample2 = sample2;
  1.2850 -    Uint8 last_sample3 = sample3;
  1.2851 -    Uint8 last_sample4 = sample4;
  1.2852 -    Uint8 last_sample5 = sample5;
  1.2853 -    Uint8 last_sample6 = sample6;
  1.2854 -    Uint8 last_sample7 = sample7;
  1.2855 +    SDL_assert(channels <= 8);
  1.2856 +
  1.2857 +    SDL_memcpy(sample, src, cpy);
  1.2858 +    SDL_memcpy(last_sample, src, cpy);
  1.2859 +
  1.2860      while (dst < target) {
  1.2861          src += 8;
  1.2862          eps += dstsize;
  1.2863          if ((eps << 1) >= srcsize) {
  1.2864 -            dst[0] = sample0;
  1.2865 -            dst[1] = sample1;
  1.2866 -            dst[2] = sample2;
  1.2867 -            dst[3] = sample3;
  1.2868 -            dst[4] = sample4;
  1.2869 -            dst[5] = sample5;
  1.2870 -            dst[6] = sample6;
  1.2871 -            dst[7] = sample7;
  1.2872 +            SDL_memcpy(dst, sample, cpy);
  1.2873              dst += 8;
  1.2874 -            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
  1.2875 -            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
  1.2876 -            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
  1.2877 -            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
  1.2878 -            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
  1.2879 -            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
  1.2880 -            sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
  1.2881 -            sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
  1.2882 -            last_sample0 = sample0;
  1.2883 -            last_sample1 = sample1;
  1.2884 -            last_sample2 = sample2;
  1.2885 -            last_sample3 = sample3;
  1.2886 -            last_sample4 = sample4;
  1.2887 -            last_sample5 = sample5;
  1.2888 -            last_sample6 = sample6;
  1.2889 -            last_sample7 = sample7;
  1.2890 +            for (i = 0; i < channels; i++) {
  1.2891 +                sample[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.5);
  1.2892 +            }
  1.2893 +            SDL_memcpy(last_sample, sample, cpy);
  1.2894              eps -= srcsize;
  1.2895          }
  1.2896      }
  1.2897 -    cvt->len_cvt = dstsize;
  1.2898 -    if (cvt->filters[++cvt->filter_index]) {
  1.2899 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2900 -    }
  1.2901 -}
  1.2902 -
  1.2903 -static void SDLCALL
  1.2904 -SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2905 -{
  1.2906 -#if DEBUG_CONVERT
  1.2907 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
  1.2908 -#endif
  1.2909 -
  1.2910 -    const int srcsize = cvt->len_cvt - 16;
  1.2911 -    const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
  1.2912 -    register int eps = 0;
  1.2913 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
  1.2914 -    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.2915 -    const Sint8 *target = ((const Sint8 *) cvt->buf);
  1.2916 -    Sint8 sample0 = ((Sint8) src[0]);
  1.2917 -    Sint8 last_sample0 = sample0;
  1.2918 -    while (dst >= target) {
  1.2919 -        dst[0] = ((Sint8) sample0);
  1.2920 -        dst--;
  1.2921 -        eps += srcsize;
  1.2922 -        if ((eps << 1) >= dstsize) {
  1.2923 -            src--;
  1.2924 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.2925 -            last_sample0 = sample0;
  1.2926 -            eps -= dstsize;
  1.2927 -        }
  1.2928 -    }
  1.2929 -    cvt->len_cvt = dstsize;
  1.2930 -    if (cvt->filters[++cvt->filter_index]) {
  1.2931 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2932 -    }
  1.2933 -}
  1.2934 -
  1.2935 -static void SDLCALL
  1.2936 -SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2937 -{
  1.2938 -#if DEBUG_CONVERT
  1.2939 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
  1.2940 -#endif
  1.2941 -
  1.2942 -    const int srcsize = cvt->len_cvt - 16;
  1.2943 -    const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
  1.2944 -    register int eps = 0;
  1.2945 -    Sint8 *dst = (Sint8 *) cvt->buf;
  1.2946 -    const Sint8 *src = (Sint8 *) cvt->buf;
  1.2947 -    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.2948 -    Sint8 sample0 = ((Sint8) src[0]);
  1.2949 -    Sint8 last_sample0 = sample0;
  1.2950 -    while (dst < target) {
  1.2951 -        src++;
  1.2952 -        eps += dstsize;
  1.2953 -        if ((eps << 1) >= srcsize) {
  1.2954 -            dst[0] = ((Sint8) sample0);
  1.2955 -            dst++;
  1.2956 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.2957 -            last_sample0 = sample0;
  1.2958 -            eps -= srcsize;
  1.2959 -        }
  1.2960 -    }
  1.2961 -    cvt->len_cvt = dstsize;
  1.2962 -    if (cvt->filters[++cvt->filter_index]) {
  1.2963 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.2964 -    }
  1.2965 -}
  1.2966 -
  1.2967 -static void SDLCALL
  1.2968 -SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.2969 -{
  1.2970 -#if DEBUG_CONVERT
  1.2971 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
  1.2972 -#endif
  1.2973 -
  1.2974 -    const int srcsize = cvt->len_cvt - 32;
  1.2975 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.2976 -    register int eps = 0;
  1.2977 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
  1.2978 -    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.2979 -    const Sint8 *target = ((const Sint8 *) cvt->buf);
  1.2980 -    Sint8 sample1 = ((Sint8) src[1]);
  1.2981 -    Sint8 sample0 = ((Sint8) src[0]);
  1.2982 -    Sint8 last_sample1 = sample1;
  1.2983 -    Sint8 last_sample0 = sample0;
  1.2984 -    while (dst >= target) {
  1.2985 -        dst[1] = ((Sint8) sample1);
  1.2986 -        dst[0] = ((Sint8) sample0);
  1.2987 -        dst -= 2;
  1.2988 -        eps += srcsize;
  1.2989 -        if ((eps << 1) >= dstsize) {
  1.2990 -            src -= 2;
  1.2991 -            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.2992 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.2993 -            last_sample1 = sample1;
  1.2994 -            last_sample0 = sample0;
  1.2995 -            eps -= dstsize;
  1.2996 -        }
  1.2997 -    }
  1.2998 -    cvt->len_cvt = dstsize;
  1.2999 -    if (cvt->filters[++cvt->filter_index]) {
  1.3000 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3001 -    }
  1.3002 -}
  1.3003 -
  1.3004 -static void SDLCALL
  1.3005 -SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3006 -{
  1.3007 -#if DEBUG_CONVERT
  1.3008 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
  1.3009 -#endif
  1.3010 -
  1.3011 -    const int srcsize = cvt->len_cvt - 32;
  1.3012 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.3013 -    register int eps = 0;
  1.3014 -    Sint8 *dst = (Sint8 *) cvt->buf;
  1.3015 -    const Sint8 *src = (Sint8 *) cvt->buf;
  1.3016 -    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.3017 -    Sint8 sample0 = ((Sint8) src[0]);
  1.3018 -    Sint8 sample1 = ((Sint8) src[1]);
  1.3019 -    Sint8 last_sample0 = sample0;
  1.3020 -    Sint8 last_sample1 = sample1;
  1.3021 -    while (dst < target) {
  1.3022 -        src += 2;
  1.3023 -        eps += dstsize;
  1.3024 -        if ((eps << 1) >= srcsize) {
  1.3025 -            dst[0] = ((Sint8) sample0);
  1.3026 -            dst[1] = ((Sint8) sample1);
  1.3027 -            dst += 2;
  1.3028 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.3029 -            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.3030 -            last_sample0 = sample0;
  1.3031 -            last_sample1 = sample1;
  1.3032 -            eps -= srcsize;
  1.3033 -        }
  1.3034 -    }
  1.3035 -    cvt->len_cvt = dstsize;
  1.3036 -    if (cvt->filters[++cvt->filter_index]) {
  1.3037 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3038 -    }
  1.3039 -}
  1.3040 -
  1.3041 -static void SDLCALL
  1.3042 -SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3043 -{
  1.3044 -#if DEBUG_CONVERT
  1.3045 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
  1.3046 -#endif
  1.3047 -
  1.3048 -    const int srcsize = cvt->len_cvt - 64;
  1.3049 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.3050 -    register int eps = 0;
  1.3051 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
  1.3052 -    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.3053 -    const Sint8 *target = ((const Sint8 *) cvt->buf);
  1.3054 -    Sint8 sample3 = ((Sint8) src[3]);
  1.3055 -    Sint8 sample2 = ((Sint8) src[2]);
  1.3056 -    Sint8 sample1 = ((Sint8) src[1]);
  1.3057 -    Sint8 sample0 = ((Sint8) src[0]);
  1.3058 -    Sint8 last_sample3 = sample3;
  1.3059 -    Sint8 last_sample2 = sample2;
  1.3060 -    Sint8 last_sample1 = sample1;
  1.3061 -    Sint8 last_sample0 = sample0;
  1.3062 -    while (dst >= target) {
  1.3063 -        dst[3] = ((Sint8) sample3);
  1.3064 -        dst[2] = ((Sint8) sample2);
  1.3065 -        dst[1] = ((Sint8) sample1);
  1.3066 -        dst[0] = ((Sint8) sample0);
  1.3067 -        dst -= 4;
  1.3068 -        eps += srcsize;
  1.3069 -        if ((eps << 1) >= dstsize) {
  1.3070 -            src -= 4;
  1.3071 -            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
  1.3072 -            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
  1.3073 -            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.3074 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.3075 -            last_sample3 = sample3;
  1.3076 -            last_sample2 = sample2;
  1.3077 -            last_sample1 = sample1;
  1.3078 -            last_sample0 = sample0;
  1.3079 -            eps -= dstsize;
  1.3080 -        }
  1.3081 -    }
  1.3082 -    cvt->len_cvt = dstsize;
  1.3083 -    if (cvt->filters[++cvt->filter_index]) {
  1.3084 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3085 -    }
  1.3086 -}
  1.3087 -
  1.3088 -static void SDLCALL
  1.3089 -SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3090 -{
  1.3091 -#if DEBUG_CONVERT
  1.3092 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
  1.3093 -#endif
  1.3094 -
  1.3095 -    const int srcsize = cvt->len_cvt - 64;
  1.3096 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.3097 -    register int eps = 0;
  1.3098 -    Sint8 *dst = (Sint8 *) cvt->buf;
  1.3099 -    const Sint8 *src = (Sint8 *) cvt->buf;
  1.3100 -    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.3101 -    Sint8 sample0 = ((Sint8) src[0]);
  1.3102 -    Sint8 sample1 = ((Sint8) src[1]);
  1.3103 -    Sint8 sample2 = ((Sint8) src[2]);
  1.3104 -    Sint8 sample3 = ((Sint8) src[3]);
  1.3105 -    Sint8 last_sample0 = sample0;
  1.3106 -    Sint8 last_sample1 = sample1;
  1.3107 -    Sint8 last_sample2 = sample2;
  1.3108 -    Sint8 last_sample3 = sample3;
  1.3109 -    while (dst < target) {
  1.3110 -        src += 4;
  1.3111 -        eps += dstsize;
  1.3112 -        if ((eps << 1) >= srcsize) {
  1.3113 -            dst[0] = ((Sint8) sample0);
  1.3114 -            dst[1] = ((Sint8) sample1);
  1.3115 -            dst[2] = ((Sint8) sample2);
  1.3116 -            dst[3] = ((Sint8) sample3);
  1.3117 -            dst += 4;
  1.3118 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.3119 -            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.3120 -            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
  1.3121 -            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
  1.3122 -            last_sample0 = sample0;
  1.3123 -            last_sample1 = sample1;
  1.3124 -            last_sample2 = sample2;
  1.3125 -            last_sample3 = sample3;
  1.3126 -            eps -= srcsize;
  1.3127 -        }
  1.3128 -    }
  1.3129 -    cvt->len_cvt = dstsize;
  1.3130 -    if (cvt->filters[++cvt->filter_index]) {
  1.3131 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3132 -    }
  1.3133 -}
  1.3134 -
  1.3135 -static void SDLCALL
  1.3136 -SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3137 -{
  1.3138 -#if DEBUG_CONVERT
  1.3139 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
  1.3140 -#endif
  1.3141 -
  1.3142 -    const int srcsize = cvt->len_cvt - 96;
  1.3143 -    const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
  1.3144 -    register int eps = 0;
  1.3145 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
  1.3146 -    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.3147 -    const Sint8 *target = ((const Sint8 *) cvt->buf);
  1.3148 -    Sint8 sample5 = ((Sint8) src[5]);
  1.3149 -    Sint8 sample4 = ((Sint8) src[4]);
  1.3150 -    Sint8 sample3 = ((Sint8) src[3]);
  1.3151 -    Sint8 sample2 = ((Sint8) src[2]);
  1.3152 -    Sint8 sample1 = ((Sint8) src[1]);
  1.3153 -    Sint8 sample0 = ((Sint8) src[0]);
  1.3154 -    Sint8 last_sample5 = sample5;
  1.3155 -    Sint8 last_sample4 = sample4;
  1.3156 -    Sint8 last_sample3 = sample3;
  1.3157 -    Sint8 last_sample2 = sample2;
  1.3158 -    Sint8 last_sample1 = sample1;
  1.3159 -    Sint8 last_sample0 = sample0;
  1.3160 -    while (dst >= target) {
  1.3161 -        dst[5] = ((Sint8) sample5);
  1.3162 -        dst[4] = ((Sint8) sample4);
  1.3163 -        dst[3] = ((Sint8) sample3);
  1.3164 -        dst[2] = ((Sint8) sample2);
  1.3165 -        dst[1] = ((Sint8) sample1);
  1.3166 -        dst[0] = ((Sint8) sample0);
  1.3167 -        dst -= 6;
  1.3168 -        eps += srcsize;
  1.3169 -        if ((eps << 1) >= dstsize) {
  1.3170 -            src -= 6;
  1.3171 -            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
  1.3172 -            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
  1.3173 -            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
  1.3174 -            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
  1.3175 -            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.3176 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.3177 -            last_sample5 = sample5;
  1.3178 -            last_sample4 = sample4;
  1.3179 -            last_sample3 = sample3;
  1.3180 -            last_sample2 = sample2;
  1.3181 -            last_sample1 = sample1;
  1.3182 -            last_sample0 = sample0;
  1.3183 -            eps -= dstsize;
  1.3184 -        }
  1.3185 -    }
  1.3186 -    cvt->len_cvt = dstsize;
  1.3187 -    if (cvt->filters[++cvt->filter_index]) {
  1.3188 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3189 -    }
  1.3190 -}
  1.3191 -
  1.3192 -static void SDLCALL
  1.3193 -SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3194 -{
  1.3195 -#if DEBUG_CONVERT
  1.3196 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
  1.3197 -#endif
  1.3198 -
  1.3199 -    const int srcsize = cvt->len_cvt - 96;
  1.3200 -    const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
  1.3201 -    register int eps = 0;
  1.3202 -    Sint8 *dst = (Sint8 *) cvt->buf;
  1.3203 -    const Sint8 *src = (Sint8 *) cvt->buf;
  1.3204 -    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.3205 -    Sint8 sample0 = ((Sint8) src[0]);
  1.3206 -    Sint8 sample1 = ((Sint8) src[1]);
  1.3207 -    Sint8 sample2 = ((Sint8) src[2]);
  1.3208 -    Sint8 sample3 = ((Sint8) src[3]);
  1.3209 -    Sint8 sample4 = ((Sint8) src[4]);
  1.3210 -    Sint8 sample5 = ((Sint8) src[5]);
  1.3211 -    Sint8 last_sample0 = sample0;
  1.3212 -    Sint8 last_sample1 = sample1;
  1.3213 -    Sint8 last_sample2 = sample2;
  1.3214 -    Sint8 last_sample3 = sample3;
  1.3215 -    Sint8 last_sample4 = sample4;
  1.3216 -    Sint8 last_sample5 = sample5;
  1.3217 -    while (dst < target) {
  1.3218 -        src += 6;
  1.3219 -        eps += dstsize;
  1.3220 -        if ((eps << 1) >= srcsize) {
  1.3221 -            dst[0] = ((Sint8) sample0);
  1.3222 -            dst[1] = ((Sint8) sample1);
  1.3223 -            dst[2] = ((Sint8) sample2);
  1.3224 -            dst[3] = ((Sint8) sample3);
  1.3225 -            dst[4] = ((Sint8) sample4);
  1.3226 -            dst[5] = ((Sint8) sample5);
  1.3227 -            dst += 6;
  1.3228 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.3229 -            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.3230 -            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
  1.3231 -            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
  1.3232 -            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
  1.3233 -            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
  1.3234 -            last_sample0 = sample0;
  1.3235 -            last_sample1 = sample1;
  1.3236 -            last_sample2 = sample2;
  1.3237 -            last_sample3 = sample3;
  1.3238 -            last_sample4 = sample4;
  1.3239 -            last_sample5 = sample5;
  1.3240 -            eps -= srcsize;
  1.3241 -        }
  1.3242 -    }
  1.3243 -    cvt->len_cvt = dstsize;
  1.3244 -    if (cvt->filters[++cvt->filter_index]) {
  1.3245 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3246 -    }
  1.3247 -}
  1.3248 -
  1.3249 -static void SDLCALL
  1.3250 -SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3251 -{
  1.3252 -#if DEBUG_CONVERT
  1.3253 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
  1.3254 -#endif
  1.3255 -
  1.3256 -    const int srcsize = cvt->len_cvt - 128;
  1.3257 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.3258 -    register int eps = 0;
  1.3259 -    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
  1.3260 -    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.3261 -    const Sint8 *target = ((const Sint8 *) cvt->buf);
  1.3262 -    Sint8 sample7 = ((Sint8) src[7]);
  1.3263 -    Sint8 sample6 = ((Sint8) src[6]);
  1.3264 -    Sint8 sample5 = ((Sint8) src[5]);
  1.3265 -    Sint8 sample4 = ((Sint8) src[4]);
  1.3266 -    Sint8 sample3 = ((Sint8) src[3]);
  1.3267 -    Sint8 sample2 = ((Sint8) src[2]);
  1.3268 -    Sint8 sample1 = ((Sint8) src[1]);
  1.3269 -    Sint8 sample0 = ((Sint8) src[0]);
  1.3270 -    Sint8 last_sample7 = sample7;
  1.3271 -    Sint8 last_sample6 = sample6;
  1.3272 -    Sint8 last_sample5 = sample5;
  1.3273 -    Sint8 last_sample4 = sample4;
  1.3274 -    Sint8 last_sample3 = sample3;
  1.3275 -    Sint8 last_sample2 = sample2;
  1.3276 -    Sint8 last_sample1 = sample1;
  1.3277 -    Sint8 last_sample0 = sample0;
  1.3278 -    while (dst >= target) {
  1.3279 -        dst[7] = ((Sint8) sample7);
  1.3280 -        dst[6] = ((Sint8) sample6);
  1.3281 -        dst[5] = ((Sint8) sample5);
  1.3282 -        dst[4] = ((Sint8) sample4);
  1.3283 -        dst[3] = ((Sint8) sample3);
  1.3284 -        dst[2] = ((Sint8) sample2);
  1.3285 -        dst[1] = ((Sint8) sample1);
  1.3286 -        dst[0] = ((Sint8) sample0);
  1.3287 -        dst -= 8;
  1.3288 -        eps += srcsize;
  1.3289 -        if ((eps << 1) >= dstsize) {
  1.3290 -            src -= 8;
  1.3291 -            sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
  1.3292 -            sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
  1.3293 -            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
  1.3294 -            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
  1.3295 -            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
  1.3296 -            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
  1.3297 -            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.3298 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.3299 -            last_sample7 = sample7;
  1.3300 -            last_sample6 = sample6;
  1.3301 -            last_sample5 = sample5;
  1.3302 -            last_sample4 = sample4;
  1.3303 -            last_sample3 = sample3;
  1.3304 -            last_sample2 = sample2;
  1.3305 -            last_sample1 = sample1;
  1.3306 -            last_sample0 = sample0;
  1.3307 -            eps -= dstsize;
  1.3308 -        }
  1.3309 -    }
  1.3310 -    cvt->len_cvt = dstsize;
  1.3311 -    if (cvt->filters[++cvt->filter_index]) {
  1.3312 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3313 -    }
  1.3314 -}
  1.3315 -
  1.3316 -static void SDLCALL
  1.3317 -SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3318 -{
  1.3319 -#if DEBUG_CONVERT
  1.3320 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
  1.3321 -#endif
  1.3322 -
  1.3323 -    const int srcsize = cvt->len_cvt - 128;
  1.3324 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.3325 -    register int eps = 0;
  1.3326 -    Sint8 *dst = (Sint8 *) cvt->buf;
  1.3327 -    const Sint8 *src = (Sint8 *) cvt->buf;
  1.3328 -    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
  1.3329 -    Sint8 sample0 = ((Sint8) src[0]);
  1.3330 -    Sint8 sample1 = ((Sint8) src[1]);
  1.3331 -    Sint8 sample2 = ((Sint8) src[2]);
  1.3332 -    Sint8 sample3 = ((Sint8) src[3]);
  1.3333 -    Sint8 sample4 = ((Sint8) src[4]);
  1.3334 -    Sint8 sample5 = ((Sint8) src[5]);
  1.3335 -    Sint8 sample6 = ((Sint8) src[6]);
  1.3336 -    Sint8 sample7 = ((Sint8) src[7]);
  1.3337 -    Sint8 last_sample0 = sample0;
  1.3338 -    Sint8 last_sample1 = sample1;
  1.3339 -    Sint8 last_sample2 = sample2;
  1.3340 -    Sint8 last_sample3 = sample3;
  1.3341 -    Sint8 last_sample4 = sample4;
  1.3342 -    Sint8 last_sample5 = sample5;
  1.3343 -    Sint8 last_sample6 = sample6;
  1.3344 -    Sint8 last_sample7 = sample7;
  1.3345 -    while (dst < target) {
  1.3346 -        src += 8;
  1.3347 -        eps += dstsize;
  1.3348 -        if ((eps << 1) >= srcsize) {
  1.3349 -            dst[0] = ((Sint8) sample0);
  1.3350 -            dst[1] = ((Sint8) sample1);
  1.3351 -            dst[2] = ((Sint8) sample2);
  1.3352 -            dst[3] = ((Sint8) sample3);
  1.3353 -            dst[4] = ((Sint8) sample4);
  1.3354 -            dst[5] = ((Sint8) sample5);
  1.3355 -            dst[6] = ((Sint8) sample6);
  1.3356 -            dst[7] = ((Sint8) sample7);
  1.3357 -            dst += 8;
  1.3358 -            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
  1.3359 -            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
  1.3360 -            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
  1.3361 -            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
  1.3362 -            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
  1.3363 -            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
  1.3364 -            sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
  1.3365 -            sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
  1.3366 -            last_sample0 = sample0;
  1.3367 -            last_sample1 = sample1;
  1.3368 -            last_sample2 = sample2;
  1.3369 -            last_sample3 = sample3;
  1.3370 -            last_sample4 = sample4;
  1.3371 -            last_sample5 = sample5;
  1.3372 -            last_sample6 = sample6;
  1.3373 -            last_sample7 = sample7;
  1.3374 -            eps -= srcsize;
  1.3375 -        }
  1.3376 -    }
  1.3377 -    cvt->len_cvt = dstsize;
  1.3378 -    if (cvt->filters[++cvt->filter_index]) {
  1.3379 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3380 -    }
  1.3381 -}
  1.3382 -
  1.3383 -static void SDLCALL
  1.3384 -SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3385 -{
  1.3386 -#if DEBUG_CONVERT
  1.3387 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
  1.3388 -#endif
  1.3389 -
  1.3390 -    const int srcsize = cvt->len_cvt - 32;
  1.3391 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.3392 -    register int eps = 0;
  1.3393 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
  1.3394 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.3395 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.3396 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3397 -    Uint16 last_sample0 = sample0;
  1.3398 -    while (dst >= target) {
  1.3399 -        dst[0] = SDL_SwapLE16(sample0);
  1.3400 -        dst--;
  1.3401 -        eps += srcsize;
  1.3402 -        if ((eps << 1) >= dstsize) {
  1.3403 -            src--;
  1.3404 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3405 -            last_sample0 = sample0;
  1.3406 -            eps -= dstsize;
  1.3407 -        }
  1.3408 -    }
  1.3409 -    cvt->len_cvt = dstsize;
  1.3410 -    if (cvt->filters[++cvt->filter_index]) {
  1.3411 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3412 -    }
  1.3413 -}
  1.3414 -
  1.3415 -static void SDLCALL
  1.3416 -SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3417 -{
  1.3418 -#if DEBUG_CONVERT
  1.3419 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
  1.3420 -#endif
  1.3421 -
  1.3422 -    const int srcsize = cvt->len_cvt - 32;
  1.3423 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.3424 -    register int eps = 0;
  1.3425 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.3426 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.3427 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.3428 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3429 -    Uint16 last_sample0 = sample0;
  1.3430 -    while (dst < target) {
  1.3431 -        src++;
  1.3432 -        eps += dstsize;
  1.3433 -        if ((eps << 1) >= srcsize) {
  1.3434 -            dst[0] = SDL_SwapLE16(sample0);
  1.3435 -            dst++;
  1.3436 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3437 -            last_sample0 = sample0;
  1.3438 -            eps -= srcsize;
  1.3439 -        }
  1.3440 -    }
  1.3441 -    cvt->len_cvt = dstsize;
  1.3442 -    if (cvt->filters[++cvt->filter_index]) {
  1.3443 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3444 -    }
  1.3445 -}
  1.3446 -
  1.3447 -static void SDLCALL
  1.3448 -SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3449 -{
  1.3450 -#if DEBUG_CONVERT
  1.3451 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
  1.3452 -#endif
  1.3453 -
  1.3454 -    const int srcsize = cvt->len_cvt - 64;
  1.3455 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.3456 -    register int eps = 0;
  1.3457 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
  1.3458 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.3459 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.3460 -    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.3461 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3462 -    Uint16 last_sample1 = sample1;
  1.3463 -    Uint16 last_sample0 = sample0;
  1.3464 -    while (dst >= target) {
  1.3465 -        dst[1] = SDL_SwapLE16(sample1);
  1.3466 -        dst[0] = SDL_SwapLE16(sample0);
  1.3467 -        dst -= 2;
  1.3468 -        eps += srcsize;
  1.3469 -        if ((eps << 1) >= dstsize) {
  1.3470 -            src -= 2;
  1.3471 -            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.3472 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3473 -            last_sample1 = sample1;
  1.3474 -            last_sample0 = sample0;
  1.3475 -            eps -= dstsize;
  1.3476 -        }
  1.3477 -    }
  1.3478 -    cvt->len_cvt = dstsize;
  1.3479 -    if (cvt->filters[++cvt->filter_index]) {
  1.3480 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3481 -    }
  1.3482 -}
  1.3483 -
  1.3484 -static void SDLCALL
  1.3485 -SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3486 -{
  1.3487 -#if DEBUG_CONVERT
  1.3488 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
  1.3489 -#endif
  1.3490 -
  1.3491 -    const int srcsize = cvt->len_cvt - 64;
  1.3492 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.3493 -    register int eps = 0;
  1.3494 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.3495 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.3496 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.3497 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3498 -    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.3499 -    Uint16 last_sample0 = sample0;
  1.3500 -    Uint16 last_sample1 = sample1;
  1.3501 -    while (dst < target) {
  1.3502 -        src += 2;
  1.3503 -        eps += dstsize;
  1.3504 -        if ((eps << 1) >= srcsize) {
  1.3505 -            dst[0] = SDL_SwapLE16(sample0);
  1.3506 -            dst[1] = SDL_SwapLE16(sample1);
  1.3507 -            dst += 2;
  1.3508 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3509 -            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.3510 -            last_sample0 = sample0;
  1.3511 -            last_sample1 = sample1;
  1.3512 -            eps -= srcsize;
  1.3513 -        }
  1.3514 -    }
  1.3515 -    cvt->len_cvt = dstsize;
  1.3516 -    if (cvt->filters[++cvt->filter_index]) {
  1.3517 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3518 -    }
  1.3519 -}
  1.3520 -
  1.3521 -static void SDLCALL
  1.3522 -SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3523 -{
  1.3524 -#if DEBUG_CONVERT
  1.3525 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
  1.3526 -#endif
  1.3527 -
  1.3528 -    const int srcsize = cvt->len_cvt - 128;
  1.3529 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.3530 -    register int eps = 0;
  1.3531 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
  1.3532 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.3533 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.3534 -    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.3535 -    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.3536 -    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.3537 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3538 -    Uint16 last_sample3 = sample3;
  1.3539 -    Uint16 last_sample2 = sample2;
  1.3540 -    Uint16 last_sample1 = sample1;
  1.3541 -    Uint16 last_sample0 = sample0;
  1.3542 -    while (dst >= target) {
  1.3543 -        dst[3] = SDL_SwapLE16(sample3);
  1.3544 -        dst[2] = SDL_SwapLE16(sample2);
  1.3545 -        dst[1] = SDL_SwapLE16(sample1);
  1.3546 -        dst[0] = SDL_SwapLE16(sample0);
  1.3547 -        dst -= 4;
  1.3548 -        eps += srcsize;
  1.3549 -        if ((eps << 1) >= dstsize) {
  1.3550 -            src -= 4;
  1.3551 -            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.3552 -            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.3553 -            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.3554 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3555 -            last_sample3 = sample3;
  1.3556 -            last_sample2 = sample2;
  1.3557 -            last_sample1 = sample1;
  1.3558 -            last_sample0 = sample0;
  1.3559 -            eps -= dstsize;
  1.3560 -        }
  1.3561 -    }
  1.3562 -    cvt->len_cvt = dstsize;
  1.3563 -    if (cvt->filters[++cvt->filter_index]) {
  1.3564 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3565 -    }
  1.3566 -}
  1.3567 -
  1.3568 -static void SDLCALL
  1.3569 -SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3570 -{
  1.3571 -#if DEBUG_CONVERT
  1.3572 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
  1.3573 -#endif
  1.3574 -
  1.3575 -    const int srcsize = cvt->len_cvt - 128;
  1.3576 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.3577 -    register int eps = 0;
  1.3578 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.3579 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.3580 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.3581 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3582 -    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.3583 -    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.3584 -    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.3585 -    Uint16 last_sample0 = sample0;
  1.3586 -    Uint16 last_sample1 = sample1;
  1.3587 -    Uint16 last_sample2 = sample2;
  1.3588 -    Uint16 last_sample3 = sample3;
  1.3589 -    while (dst < target) {
  1.3590 -        src += 4;
  1.3591 -        eps += dstsize;
  1.3592 -        if ((eps << 1) >= srcsize) {
  1.3593 -            dst[0] = SDL_SwapLE16(sample0);
  1.3594 -            dst[1] = SDL_SwapLE16(sample1);
  1.3595 -            dst[2] = SDL_SwapLE16(sample2);
  1.3596 -            dst[3] = SDL_SwapLE16(sample3);
  1.3597 -            dst += 4;
  1.3598 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3599 -            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.3600 -            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.3601 -            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.3602 -            last_sample0 = sample0;
  1.3603 -            last_sample1 = sample1;
  1.3604 -            last_sample2 = sample2;
  1.3605 -            last_sample3 = sample3;
  1.3606 -            eps -= srcsize;
  1.3607 -        }
  1.3608 -    }
  1.3609 -    cvt->len_cvt = dstsize;
  1.3610 -    if (cvt->filters[++cvt->filter_index]) {
  1.3611 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3612 -    }
  1.3613 -}
  1.3614 -
  1.3615 -static void SDLCALL
  1.3616 -SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3617 -{
  1.3618 -#if DEBUG_CONVERT
  1.3619 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
  1.3620 -#endif
  1.3621 -
  1.3622 -    const int srcsize = cvt->len_cvt - 192;
  1.3623 -    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
  1.3624 -    register int eps = 0;
  1.3625 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
  1.3626 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.3627 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.3628 -    Uint16 sample5 = SDL_SwapLE16(src[5]);
  1.3629 -    Uint16 sample4 = SDL_SwapLE16(src[4]);
  1.3630 -    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.3631 -    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.3632 -    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.3633 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3634 -    Uint16 last_sample5 = sample5;
  1.3635 -    Uint16 last_sample4 = sample4;
  1.3636 -    Uint16 last_sample3 = sample3;
  1.3637 -    Uint16 last_sample2 = sample2;
  1.3638 -    Uint16 last_sample1 = sample1;
  1.3639 -    Uint16 last_sample0 = sample0;
  1.3640 -    while (dst >= target) {
  1.3641 -        dst[5] = SDL_SwapLE16(sample5);
  1.3642 -        dst[4] = SDL_SwapLE16(sample4);
  1.3643 -        dst[3] = SDL_SwapLE16(sample3);
  1.3644 -        dst[2] = SDL_SwapLE16(sample2);
  1.3645 -        dst[1] = SDL_SwapLE16(sample1);
  1.3646 -        dst[0] = SDL_SwapLE16(sample0);
  1.3647 -        dst -= 6;
  1.3648 -        eps += srcsize;
  1.3649 -        if ((eps << 1) >= dstsize) {
  1.3650 -            src -= 6;
  1.3651 -            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.3652 -            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.3653 -            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.3654 -            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.3655 -            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.3656 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3657 -            last_sample5 = sample5;
  1.3658 -            last_sample4 = sample4;
  1.3659 -            last_sample3 = sample3;
  1.3660 -            last_sample2 = sample2;
  1.3661 -            last_sample1 = sample1;
  1.3662 -            last_sample0 = sample0;
  1.3663 -            eps -= dstsize;
  1.3664 -        }
  1.3665 -    }
  1.3666 -    cvt->len_cvt = dstsize;
  1.3667 -    if (cvt->filters[++cvt->filter_index]) {
  1.3668 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3669 -    }
  1.3670 -}
  1.3671 -
  1.3672 -static void SDLCALL
  1.3673 -SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3674 -{
  1.3675 -#if DEBUG_CONVERT
  1.3676 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
  1.3677 -#endif
  1.3678 -
  1.3679 -    const int srcsize = cvt->len_cvt - 192;
  1.3680 -    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
  1.3681 -    register int eps = 0;
  1.3682 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.3683 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.3684 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.3685 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3686 -    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.3687 -    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.3688 -    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.3689 -    Uint16 sample4 = SDL_SwapLE16(src[4]);
  1.3690 -    Uint16 sample5 = SDL_SwapLE16(src[5]);
  1.3691 -    Uint16 last_sample0 = sample0;
  1.3692 -    Uint16 last_sample1 = sample1;
  1.3693 -    Uint16 last_sample2 = sample2;
  1.3694 -    Uint16 last_sample3 = sample3;
  1.3695 -    Uint16 last_sample4 = sample4;
  1.3696 -    Uint16 last_sample5 = sample5;
  1.3697 -    while (dst < target) {
  1.3698 -        src += 6;
  1.3699 -        eps += dstsize;
  1.3700 -        if ((eps << 1) >= srcsize) {
  1.3701 -            dst[0] = SDL_SwapLE16(sample0);
  1.3702 -            dst[1] = SDL_SwapLE16(sample1);
  1.3703 -            dst[2] = SDL_SwapLE16(sample2);
  1.3704 -            dst[3] = SDL_SwapLE16(sample3);
  1.3705 -            dst[4] = SDL_SwapLE16(sample4);
  1.3706 -            dst[5] = SDL_SwapLE16(sample5);
  1.3707 -            dst += 6;
  1.3708 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3709 -            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.3710 -            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.3711 -            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.3712 -            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.3713 -            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.3714 -            last_sample0 = sample0;
  1.3715 -            last_sample1 = sample1;
  1.3716 -            last_sample2 = sample2;
  1.3717 -            last_sample3 = sample3;
  1.3718 -            last_sample4 = sample4;
  1.3719 -            last_sample5 = sample5;
  1.3720 -            eps -= srcsize;
  1.3721 -        }
  1.3722 -    }
  1.3723 -    cvt->len_cvt = dstsize;
  1.3724 -    if (cvt->filters[++cvt->filter_index]) {
  1.3725 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3726 -    }
  1.3727 -}
  1.3728 -
  1.3729 -static void SDLCALL
  1.3730 -SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3731 -{
  1.3732 -#if DEBUG_CONVERT
  1.3733 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
  1.3734 -#endif
  1.3735 -
  1.3736 -    const int srcsize = cvt->len_cvt - 256;
  1.3737 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.3738 -    register int eps = 0;
  1.3739 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
  1.3740 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.3741 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.3742 -    Uint16 sample7 = SDL_SwapLE16(src[7]);
  1.3743 -    Uint16 sample6 = SDL_SwapLE16(src[6]);
  1.3744 -    Uint16 sample5 = SDL_SwapLE16(src[5]);
  1.3745 -    Uint16 sample4 = SDL_SwapLE16(src[4]);
  1.3746 -    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.3747 -    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.3748 -    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.3749 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3750 -    Uint16 last_sample7 = sample7;
  1.3751 -    Uint16 last_sample6 = sample6;
  1.3752 -    Uint16 last_sample5 = sample5;
  1.3753 -    Uint16 last_sample4 = sample4;
  1.3754 -    Uint16 last_sample3 = sample3;
  1.3755 -    Uint16 last_sample2 = sample2;
  1.3756 -    Uint16 last_sample1 = sample1;
  1.3757 -    Uint16 last_sample0 = sample0;
  1.3758 -    while (dst >= target) {
  1.3759 -        dst[7] = SDL_SwapLE16(sample7);
  1.3760 -        dst[6] = SDL_SwapLE16(sample6);
  1.3761 -        dst[5] = SDL_SwapLE16(sample5);
  1.3762 -        dst[4] = SDL_SwapLE16(sample4);
  1.3763 -        dst[3] = SDL_SwapLE16(sample3);
  1.3764 -        dst[2] = SDL_SwapLE16(sample2);
  1.3765 -        dst[1] = SDL_SwapLE16(sample1);
  1.3766 -        dst[0] = SDL_SwapLE16(sample0);
  1.3767 -        dst -= 8;
  1.3768 -        eps += srcsize;
  1.3769 -        if ((eps << 1) >= dstsize) {
  1.3770 -            src -= 8;
  1.3771 -            sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
  1.3772 -            sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
  1.3773 -            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.3774 -            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.3775 -            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.3776 -            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.3777 -            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.3778 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3779 -            last_sample7 = sample7;
  1.3780 -            last_sample6 = sample6;
  1.3781 -            last_sample5 = sample5;
  1.3782 -            last_sample4 = sample4;
  1.3783 -            last_sample3 = sample3;
  1.3784 -            last_sample2 = sample2;
  1.3785 -            last_sample1 = sample1;
  1.3786 -            last_sample0 = sample0;
  1.3787 -            eps -= dstsize;
  1.3788 -        }
  1.3789 -    }
  1.3790 -    cvt->len_cvt = dstsize;
  1.3791 -    if (cvt->filters[++cvt->filter_index]) {
  1.3792 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3793 -    }
  1.3794 -}
  1.3795 -
  1.3796 -static void SDLCALL
  1.3797 -SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3798 -{
  1.3799 -#if DEBUG_CONVERT
  1.3800 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
  1.3801 -#endif
  1.3802 -
  1.3803 -    const int srcsize = cvt->len_cvt - 256;
  1.3804 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.3805 -    register int eps = 0;
  1.3806 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.3807 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.3808 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.3809 -    Uint16 sample0 = SDL_SwapLE16(src[0]);
  1.3810 -    Uint16 sample1 = SDL_SwapLE16(src[1]);
  1.3811 -    Uint16 sample2 = SDL_SwapLE16(src[2]);
  1.3812 -    Uint16 sample3 = SDL_SwapLE16(src[3]);
  1.3813 -    Uint16 sample4 = SDL_SwapLE16(src[4]);
  1.3814 -    Uint16 sample5 = SDL_SwapLE16(src[5]);
  1.3815 -    Uint16 sample6 = SDL_SwapLE16(src[6]);
  1.3816 -    Uint16 sample7 = SDL_SwapLE16(src[7]);
  1.3817 -    Uint16 last_sample0 = sample0;
  1.3818 -    Uint16 last_sample1 = sample1;
  1.3819 -    Uint16 last_sample2 = sample2;
  1.3820 -    Uint16 last_sample3 = sample3;
  1.3821 -    Uint16 last_sample4 = sample4;
  1.3822 -    Uint16 last_sample5 = sample5;
  1.3823 -    Uint16 last_sample6 = sample6;
  1.3824 -    Uint16 last_sample7 = sample7;
  1.3825 -    while (dst < target) {
  1.3826 -        src += 8;
  1.3827 -        eps += dstsize;
  1.3828 -        if ((eps << 1) >= srcsize) {
  1.3829 -            dst[0] = SDL_SwapLE16(sample0);
  1.3830 -            dst[1] = SDL_SwapLE16(sample1);
  1.3831 -            dst[2] = SDL_SwapLE16(sample2);
  1.3832 -            dst[3] = SDL_SwapLE16(sample3);
  1.3833 -            dst[4] = SDL_SwapLE16(sample4);
  1.3834 -            dst[5] = SDL_SwapLE16(sample5);
  1.3835 -            dst[6] = SDL_SwapLE16(sample6);
  1.3836 -            dst[7] = SDL_SwapLE16(sample7);
  1.3837 -            dst += 8;
  1.3838 -            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.3839 -            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.3840 -            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.3841 -            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.3842 -            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.3843 -            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.3844 -            sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
  1.3845 -            sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
  1.3846 -            last_sample0 = sample0;
  1.3847 -            last_sample1 = sample1;
  1.3848 -            last_sample2 = sample2;
  1.3849 -            last_sample3 = sample3;
  1.3850 -            last_sample4 = sample4;
  1.3851 -            last_sample5 = sample5;
  1.3852 -            last_sample6 = sample6;
  1.3853 -            last_sample7 = sample7;
  1.3854 -            eps -= srcsize;
  1.3855 -        }
  1.3856 -    }
  1.3857 -    cvt->len_cvt = dstsize;
  1.3858 -    if (cvt->filters[++cvt->filter_index]) {
  1.3859 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3860 -    }
  1.3861 -}
  1.3862 -
  1.3863 -static void SDLCALL
  1.3864 -SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3865 -{
  1.3866 -#if DEBUG_CONVERT
  1.3867 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
  1.3868 -#endif
  1.3869 -
  1.3870 -    const int srcsize = cvt->len_cvt - 32;
  1.3871 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.3872 -    register int eps = 0;
  1.3873 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
  1.3874 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.3875 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.3876 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.3877 -    Sint16 last_sample0 = sample0;
  1.3878 -    while (dst >= target) {
  1.3879 -        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.3880 -        dst--;
  1.3881 -        eps += srcsize;
  1.3882 -        if ((eps << 1) >= dstsize) {
  1.3883 -            src--;
  1.3884 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.3885 -            last_sample0 = sample0;
  1.3886 -            eps -= dstsize;
  1.3887 -        }
  1.3888 -    }
  1.3889 -    cvt->len_cvt = dstsize;
  1.3890 -    if (cvt->filters[++cvt->filter_index]) {
  1.3891 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3892 -    }
  1.3893 -}
  1.3894 -
  1.3895 -static void SDLCALL
  1.3896 -SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3897 -{
  1.3898 -#if DEBUG_CONVERT
  1.3899 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
  1.3900 -#endif
  1.3901 -
  1.3902 -    const int srcsize = cvt->len_cvt - 32;
  1.3903 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.3904 -    register int eps = 0;
  1.3905 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.3906 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.3907 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.3908 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.3909 -    Sint16 last_sample0 = sample0;
  1.3910 -    while (dst < target) {
  1.3911 -        src++;
  1.3912 -        eps += dstsize;
  1.3913 -        if ((eps << 1) >= srcsize) {
  1.3914 -            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.3915 -            dst++;
  1.3916 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.3917 -            last_sample0 = sample0;
  1.3918 -            eps -= srcsize;
  1.3919 -        }
  1.3920 -    }
  1.3921 -    cvt->len_cvt = dstsize;
  1.3922 -    if (cvt->filters[++cvt->filter_index]) {
  1.3923 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3924 -    }
  1.3925 -}
  1.3926 -
  1.3927 -static void SDLCALL
  1.3928 -SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3929 -{
  1.3930 -#if DEBUG_CONVERT
  1.3931 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
  1.3932 -#endif
  1.3933 -
  1.3934 -    const int srcsize = cvt->len_cvt - 64;
  1.3935 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.3936 -    register int eps = 0;
  1.3937 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
  1.3938 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.3939 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.3940 -    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.3941 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.3942 -    Sint16 last_sample1 = sample1;
  1.3943 -    Sint16 last_sample0 = sample0;
  1.3944 -    while (dst >= target) {
  1.3945 -        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.3946 -        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.3947 -        dst -= 2;
  1.3948 -        eps += srcsize;
  1.3949 -        if ((eps << 1) >= dstsize) {
  1.3950 -            src -= 2;
  1.3951 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.3952 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.3953 -            last_sample1 = sample1;
  1.3954 -            last_sample0 = sample0;
  1.3955 -            eps -= dstsize;
  1.3956 -        }
  1.3957 -    }
  1.3958 -    cvt->len_cvt = dstsize;
  1.3959 -    if (cvt->filters[++cvt->filter_index]) {
  1.3960 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3961 -    }
  1.3962 -}
  1.3963 -
  1.3964 -static void SDLCALL
  1.3965 -SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.3966 -{
  1.3967 -#if DEBUG_CONVERT
  1.3968 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
  1.3969 -#endif
  1.3970 -
  1.3971 -    const int srcsize = cvt->len_cvt - 64;
  1.3972 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.3973 -    register int eps = 0;
  1.3974 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.3975 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.3976 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.3977 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.3978 -    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.3979 -    Sint16 last_sample0 = sample0;
  1.3980 -    Sint16 last_sample1 = sample1;
  1.3981 -    while (dst < target) {
  1.3982 -        src += 2;
  1.3983 -        eps += dstsize;
  1.3984 -        if ((eps << 1) >= srcsize) {
  1.3985 -            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.3986 -            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.3987 -            dst += 2;
  1.3988 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.3989 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.3990 -            last_sample0 = sample0;
  1.3991 -            last_sample1 = sample1;
  1.3992 -            eps -= srcsize;
  1.3993 -        }
  1.3994 -    }
  1.3995 -    cvt->len_cvt = dstsize;
  1.3996 -    if (cvt->filters[++cvt->filter_index]) {
  1.3997 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.3998 -    }
  1.3999 -}
  1.4000 -
  1.4001 -static void SDLCALL
  1.4002 -SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4003 -{
  1.4004 -#if DEBUG_CONVERT
  1.4005 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
  1.4006 -#endif
  1.4007 -
  1.4008 -    const int srcsize = cvt->len_cvt - 128;
  1.4009 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.4010 -    register int eps = 0;
  1.4011 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
  1.4012 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.4013 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.4014 -    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.4015 -    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.4016 -    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.4017 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.4018 -    Sint16 last_sample3 = sample3;
  1.4019 -    Sint16 last_sample2 = sample2;
  1.4020 -    Sint16 last_sample1 = sample1;
  1.4021 -    Sint16 last_sample0 = sample0;
  1.4022 -    while (dst >= target) {
  1.4023 -        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.4024 -        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.4025 -        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.4026 -        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.4027 -        dst -= 4;
  1.4028 -        eps += srcsize;
  1.4029 -        if ((eps << 1) >= dstsize) {
  1.4030 -            src -= 4;
  1.4031 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.4032 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.4033 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4034 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4035 -            last_sample3 = sample3;
  1.4036 -            last_sample2 = sample2;
  1.4037 -            last_sample1 = sample1;
  1.4038 -            last_sample0 = sample0;
  1.4039 -            eps -= dstsize;
  1.4040 -        }
  1.4041 -    }
  1.4042 -    cvt->len_cvt = dstsize;
  1.4043 -    if (cvt->filters[++cvt->filter_index]) {
  1.4044 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4045 -    }
  1.4046 -}
  1.4047 -
  1.4048 -static void SDLCALL
  1.4049 -SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4050 -{
  1.4051 -#if DEBUG_CONVERT
  1.4052 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
  1.4053 -#endif
  1.4054 -
  1.4055 -    const int srcsize = cvt->len_cvt - 128;
  1.4056 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.4057 -    register int eps = 0;
  1.4058 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.4059 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.4060 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.4061 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.4062 -    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.4063 -    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.4064 -    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.4065 -    Sint16 last_sample0 = sample0;
  1.4066 -    Sint16 last_sample1 = sample1;
  1.4067 -    Sint16 last_sample2 = sample2;
  1.4068 -    Sint16 last_sample3 = sample3;
  1.4069 -    while (dst < target) {
  1.4070 -        src += 4;
  1.4071 -        eps += dstsize;
  1.4072 -        if ((eps << 1) >= srcsize) {
  1.4073 -            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.4074 -            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.4075 -            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.4076 -            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.4077 -            dst += 4;
  1.4078 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4079 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4080 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.4081 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.4082 -            last_sample0 = sample0;
  1.4083 -            last_sample1 = sample1;
  1.4084 -            last_sample2 = sample2;
  1.4085 -            last_sample3 = sample3;
  1.4086 -            eps -= srcsize;
  1.4087 -        }
  1.4088 -    }
  1.4089 -    cvt->len_cvt = dstsize;
  1.4090 -    if (cvt->filters[++cvt->filter_index]) {
  1.4091 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4092 -    }
  1.4093 -}
  1.4094 -
  1.4095 -static void SDLCALL
  1.4096 -SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4097 -{
  1.4098 -#if DEBUG_CONVERT
  1.4099 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
  1.4100 -#endif
  1.4101 -
  1.4102 -    const int srcsize = cvt->len_cvt - 192;
  1.4103 -    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
  1.4104 -    register int eps = 0;
  1.4105 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
  1.4106 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.4107 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.4108 -    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
  1.4109 -    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
  1.4110 -    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.4111 -    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.4112 -    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.4113 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.4114 -    Sint16 last_sample5 = sample5;
  1.4115 -    Sint16 last_sample4 = sample4;
  1.4116 -    Sint16 last_sample3 = sample3;
  1.4117 -    Sint16 last_sample2 = sample2;
  1.4118 -    Sint16 last_sample1 = sample1;
  1.4119 -    Sint16 last_sample0 = sample0;
  1.4120 -    while (dst >= target) {
  1.4121 -        dst[5] = ((Sint16) SDL_SwapLE16(sample5));
  1.4122 -        dst[4] = ((Sint16) SDL_SwapLE16(sample4));
  1.4123 -        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.4124 -        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.4125 -        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.4126 -        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.4127 -        dst -= 6;
  1.4128 -        eps += srcsize;
  1.4129 -        if ((eps << 1) >= dstsize) {
  1.4130 -            src -= 6;
  1.4131 -            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.4132 -            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.4133 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.4134 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.4135 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4136 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4137 -            last_sample5 = sample5;
  1.4138 -            last_sample4 = sample4;
  1.4139 -            last_sample3 = sample3;
  1.4140 -            last_sample2 = sample2;
  1.4141 -            last_sample1 = sample1;
  1.4142 -            last_sample0 = sample0;
  1.4143 -            eps -= dstsize;
  1.4144 -        }
  1.4145 -    }
  1.4146 -    cvt->len_cvt = dstsize;
  1.4147 -    if (cvt->filters[++cvt->filter_index]) {
  1.4148 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4149 -    }
  1.4150 -}
  1.4151 -
  1.4152 -static void SDLCALL
  1.4153 -SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4154 -{
  1.4155 -#if DEBUG_CONVERT
  1.4156 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
  1.4157 -#endif
  1.4158 -
  1.4159 -    const int srcsize = cvt->len_cvt - 192;
  1.4160 -    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
  1.4161 -    register int eps = 0;
  1.4162 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.4163 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.4164 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.4165 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.4166 -    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.4167 -    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.4168 -    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.4169 -    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
  1.4170 -    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
  1.4171 -    Sint16 last_sample0 = sample0;
  1.4172 -    Sint16 last_sample1 = sample1;
  1.4173 -    Sint16 last_sample2 = sample2;
  1.4174 -    Sint16 last_sample3 = sample3;
  1.4175 -    Sint16 last_sample4 = sample4;
  1.4176 -    Sint16 last_sample5 = sample5;
  1.4177 -    while (dst < target) {
  1.4178 -        src += 6;
  1.4179 -        eps += dstsize;
  1.4180 -        if ((eps << 1) >= srcsize) {
  1.4181 -            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.4182 -            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.4183 -            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.4184 -            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.4185 -            dst[4] = ((Sint16) SDL_SwapLE16(sample4));
  1.4186 -            dst[5] = ((Sint16) SDL_SwapLE16(sample5));
  1.4187 -            dst += 6;
  1.4188 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4189 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4190 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.4191 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.4192 -            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.4193 -            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.4194 -            last_sample0 = sample0;
  1.4195 -            last_sample1 = sample1;
  1.4196 -            last_sample2 = sample2;
  1.4197 -            last_sample3 = sample3;
  1.4198 -            last_sample4 = sample4;
  1.4199 -            last_sample5 = sample5;
  1.4200 -            eps -= srcsize;
  1.4201 -        }
  1.4202 -    }
  1.4203 -    cvt->len_cvt = dstsize;
  1.4204 -    if (cvt->filters[++cvt->filter_index]) {
  1.4205 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4206 -    }
  1.4207 -}
  1.4208 -
  1.4209 -static void SDLCALL
  1.4210 -SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4211 -{
  1.4212 -#if DEBUG_CONVERT
  1.4213 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
  1.4214 -#endif
  1.4215 -
  1.4216 -    const int srcsize = cvt->len_cvt - 256;
  1.4217 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.4218 -    register int eps = 0;
  1.4219 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
  1.4220 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.4221 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.4222 -    Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
  1.4223 -    Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
  1.4224 -    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
  1.4225 -    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
  1.4226 -    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.4227 -    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.4228 -    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.4229 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.4230 -    Sint16 last_sample7 = sample7;
  1.4231 -    Sint16 last_sample6 = sample6;
  1.4232 -    Sint16 last_sample5 = sample5;
  1.4233 -    Sint16 last_sample4 = sample4;
  1.4234 -    Sint16 last_sample3 = sample3;
  1.4235 -    Sint16 last_sample2 = sample2;
  1.4236 -    Sint16 last_sample1 = sample1;
  1.4237 -    Sint16 last_sample0 = sample0;
  1.4238 -    while (dst >= target) {
  1.4239 -        dst[7] = ((Sint16) SDL_SwapLE16(sample7));
  1.4240 -        dst[6] = ((Sint16) SDL_SwapLE16(sample6));
  1.4241 -        dst[5] = ((Sint16) SDL_SwapLE16(sample5));
  1.4242 -        dst[4] = ((Sint16) SDL_SwapLE16(sample4));
  1.4243 -        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.4244 -        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.4245 -        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.4246 -        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.4247 -        dst -= 8;
  1.4248 -        eps += srcsize;
  1.4249 -        if ((eps << 1) >= dstsize) {
  1.4250 -            src -= 8;
  1.4251 -            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
  1.4252 -            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
  1.4253 -            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.4254 -            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.4255 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.4256 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.4257 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4258 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4259 -            last_sample7 = sample7;
  1.4260 -            last_sample6 = sample6;
  1.4261 -            last_sample5 = sample5;
  1.4262 -            last_sample4 = sample4;
  1.4263 -            last_sample3 = sample3;
  1.4264 -            last_sample2 = sample2;
  1.4265 -            last_sample1 = sample1;
  1.4266 -            last_sample0 = sample0;
  1.4267 -            eps -= dstsize;
  1.4268 -        }
  1.4269 -    }
  1.4270 -    cvt->len_cvt = dstsize;
  1.4271 -    if (cvt->filters[++cvt->filter_index]) {
  1.4272 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4273 -    }
  1.4274 -}
  1.4275 -
  1.4276 -static void SDLCALL
  1.4277 -SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4278 -{
  1.4279 -#if DEBUG_CONVERT
  1.4280 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
  1.4281 -#endif
  1.4282 -
  1.4283 -    const int srcsize = cvt->len_cvt - 256;
  1.4284 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.4285 -    register int eps = 0;
  1.4286 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.4287 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.4288 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.4289 -    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
  1.4290 -    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
  1.4291 -    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
  1.4292 -    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
  1.4293 -    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
  1.4294 -    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
  1.4295 -    Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
  1.4296 -    Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
  1.4297 -    Sint16 last_sample0 = sample0;
  1.4298 -    Sint16 last_sample1 = sample1;
  1.4299 -    Sint16 last_sample2 = sample2;
  1.4300 -    Sint16 last_sample3 = sample3;
  1.4301 -    Sint16 last_sample4 = sample4;
  1.4302 -    Sint16 last_sample5 = sample5;
  1.4303 -    Sint16 last_sample6 = sample6;
  1.4304 -    Sint16 last_sample7 = sample7;
  1.4305 -    while (dst < target) {
  1.4306 -        src += 8;
  1.4307 -        eps += dstsize;
  1.4308 -        if ((eps << 1) >= srcsize) {
  1.4309 -            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
  1.4310 -            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
  1.4311 -            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
  1.4312 -            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
  1.4313 -            dst[4] = ((Sint16) SDL_SwapLE16(sample4));
  1.4314 -            dst[5] = ((Sint16) SDL_SwapLE16(sample5));
  1.4315 -            dst[6] = ((Sint16) SDL_SwapLE16(sample6));
  1.4316 -            dst[7] = ((Sint16) SDL_SwapLE16(sample7));
  1.4317 -            dst += 8;
  1.4318 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4319 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4320 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.4321 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.4322 -            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.4323 -            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.4324 -            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
  1.4325 -            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
  1.4326 -            last_sample0 = sample0;
  1.4327 -            last_sample1 = sample1;
  1.4328 -            last_sample2 = sample2;
  1.4329 -            last_sample3 = sample3;
  1.4330 -            last_sample4 = sample4;
  1.4331 -            last_sample5 = sample5;
  1.4332 -            last_sample6 = sample6;
  1.4333 -            last_sample7 = sample7;
  1.4334 -            eps -= srcsize;
  1.4335 -        }
  1.4336 -    }
  1.4337 -    cvt->len_cvt = dstsize;
  1.4338 -    if (cvt->filters[++cvt->filter_index]) {
  1.4339 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4340 -    }
  1.4341 -}
  1.4342 -
  1.4343 -static void SDLCALL
  1.4344 -SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4345 -{
  1.4346 -#if DEBUG_CONVERT
  1.4347 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
  1.4348 -#endif
  1.4349 -
  1.4350 -    const int srcsize = cvt->len_cvt - 32;
  1.4351 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.4352 -    register int eps = 0;
  1.4353 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
  1.4354 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.4355 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.4356 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4357 -    Uint16 last_sample0 = sample0;
  1.4358 -    while (dst >= target) {
  1.4359 -        dst[0] = SDL_SwapBE16(sample0);
  1.4360 -        dst--;
  1.4361 -        eps += srcsize;
  1.4362 -        if ((eps << 1) >= dstsize) {
  1.4363 -            src--;
  1.4364 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4365 -            last_sample0 = sample0;
  1.4366 -            eps -= dstsize;
  1.4367 -        }
  1.4368 -    }
  1.4369 -    cvt->len_cvt = dstsize;
  1.4370 -    if (cvt->filters[++cvt->filter_index]) {
  1.4371 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4372 -    }
  1.4373 -}
  1.4374 -
  1.4375 -static void SDLCALL
  1.4376 -SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4377 -{
  1.4378 -#if DEBUG_CONVERT
  1.4379 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
  1.4380 -#endif
  1.4381 -
  1.4382 -    const int srcsize = cvt->len_cvt - 32;
  1.4383 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.4384 -    register int eps = 0;
  1.4385 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.4386 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.4387 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.4388 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4389 -    Uint16 last_sample0 = sample0;
  1.4390 -    while (dst < target) {
  1.4391 -        src++;
  1.4392 -        eps += dstsize;
  1.4393 -        if ((eps << 1) >= srcsize) {
  1.4394 -            dst[0] = SDL_SwapBE16(sample0);
  1.4395 -            dst++;
  1.4396 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4397 -            last_sample0 = sample0;
  1.4398 -            eps -= srcsize;
  1.4399 -        }
  1.4400 -    }
  1.4401 -    cvt->len_cvt = dstsize;
  1.4402 -    if (cvt->filters[++cvt->filter_index]) {
  1.4403 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4404 -    }
  1.4405 -}
  1.4406 -
  1.4407 -static void SDLCALL
  1.4408 -SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4409 -{
  1.4410 -#if DEBUG_CONVERT
  1.4411 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
  1.4412 -#endif
  1.4413 -
  1.4414 -    const int srcsize = cvt->len_cvt - 64;
  1.4415 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.4416 -    register int eps = 0;
  1.4417 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
  1.4418 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.4419 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.4420 -    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.4421 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4422 -    Uint16 last_sample1 = sample1;
  1.4423 -    Uint16 last_sample0 = sample0;
  1.4424 -    while (dst >= target) {
  1.4425 -        dst[1] = SDL_SwapBE16(sample1);
  1.4426 -        dst[0] = SDL_SwapBE16(sample0);
  1.4427 -        dst -= 2;
  1.4428 -        eps += srcsize;
  1.4429 -        if ((eps << 1) >= dstsize) {
  1.4430 -            src -= 2;
  1.4431 -            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.4432 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4433 -            last_sample1 = sample1;
  1.4434 -            last_sample0 = sample0;
  1.4435 -            eps -= dstsize;
  1.4436 -        }
  1.4437 -    }
  1.4438 -    cvt->len_cvt = dstsize;
  1.4439 -    if (cvt->filters[++cvt->filter_index]) {
  1.4440 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4441 -    }
  1.4442 -}
  1.4443 -
  1.4444 -static void SDLCALL
  1.4445 -SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4446 -{
  1.4447 -#if DEBUG_CONVERT
  1.4448 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
  1.4449 -#endif
  1.4450 -
  1.4451 -    const int srcsize = cvt->len_cvt - 64;
  1.4452 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.4453 -    register int eps = 0;
  1.4454 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.4455 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.4456 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.4457 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4458 -    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.4459 -    Uint16 last_sample0 = sample0;
  1.4460 -    Uint16 last_sample1 = sample1;
  1.4461 -    while (dst < target) {
  1.4462 -        src += 2;
  1.4463 -        eps += dstsize;
  1.4464 -        if ((eps << 1) >= srcsize) {
  1.4465 -            dst[0] = SDL_SwapBE16(sample0);
  1.4466 -            dst[1] = SDL_SwapBE16(sample1);
  1.4467 -            dst += 2;
  1.4468 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4469 -            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.4470 -            last_sample0 = sample0;
  1.4471 -            last_sample1 = sample1;
  1.4472 -            eps -= srcsize;
  1.4473 -        }
  1.4474 -    }
  1.4475 -    cvt->len_cvt = dstsize;
  1.4476 -    if (cvt->filters[++cvt->filter_index]) {
  1.4477 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4478 -    }
  1.4479 -}
  1.4480 -
  1.4481 -static void SDLCALL
  1.4482 -SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4483 -{
  1.4484 -#if DEBUG_CONVERT
  1.4485 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
  1.4486 -#endif
  1.4487 -
  1.4488 -    const int srcsize = cvt->len_cvt - 128;
  1.4489 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.4490 -    register int eps = 0;
  1.4491 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
  1.4492 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.4493 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.4494 -    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.4495 -    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.4496 -    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.4497 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4498 -    Uint16 last_sample3 = sample3;
  1.4499 -    Uint16 last_sample2 = sample2;
  1.4500 -    Uint16 last_sample1 = sample1;
  1.4501 -    Uint16 last_sample0 = sample0;
  1.4502 -    while (dst >= target) {
  1.4503 -        dst[3] = SDL_SwapBE16(sample3);
  1.4504 -        dst[2] = SDL_SwapBE16(sample2);
  1.4505 -        dst[1] = SDL_SwapBE16(sample1);
  1.4506 -        dst[0] = SDL_SwapBE16(sample0);
  1.4507 -        dst -= 4;
  1.4508 -        eps += srcsize;
  1.4509 -        if ((eps << 1) >= dstsize) {
  1.4510 -            src -= 4;
  1.4511 -            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.4512 -            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.4513 -            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.4514 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4515 -            last_sample3 = sample3;
  1.4516 -            last_sample2 = sample2;
  1.4517 -            last_sample1 = sample1;
  1.4518 -            last_sample0 = sample0;
  1.4519 -            eps -= dstsize;
  1.4520 -        }
  1.4521 -    }
  1.4522 -    cvt->len_cvt = dstsize;
  1.4523 -    if (cvt->filters[++cvt->filter_index]) {
  1.4524 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4525 -    }
  1.4526 -}
  1.4527 -
  1.4528 -static void SDLCALL
  1.4529 -SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4530 -{
  1.4531 -#if DEBUG_CONVERT
  1.4532 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
  1.4533 -#endif
  1.4534 -
  1.4535 -    const int srcsize = cvt->len_cvt - 128;
  1.4536 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.4537 -    register int eps = 0;
  1.4538 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.4539 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.4540 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.4541 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4542 -    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.4543 -    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.4544 -    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.4545 -    Uint16 last_sample0 = sample0;
  1.4546 -    Uint16 last_sample1 = sample1;
  1.4547 -    Uint16 last_sample2 = sample2;
  1.4548 -    Uint16 last_sample3 = sample3;
  1.4549 -    while (dst < target) {
  1.4550 -        src += 4;
  1.4551 -        eps += dstsize;
  1.4552 -        if ((eps << 1) >= srcsize) {
  1.4553 -            dst[0] = SDL_SwapBE16(sample0);
  1.4554 -            dst[1] = SDL_SwapBE16(sample1);
  1.4555 -            dst[2] = SDL_SwapBE16(sample2);
  1.4556 -            dst[3] = SDL_SwapBE16(sample3);
  1.4557 -            dst += 4;
  1.4558 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4559 -            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.4560 -            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.4561 -            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.4562 -            last_sample0 = sample0;
  1.4563 -            last_sample1 = sample1;
  1.4564 -            last_sample2 = sample2;
  1.4565 -            last_sample3 = sample3;
  1.4566 -            eps -= srcsize;
  1.4567 -        }
  1.4568 -    }
  1.4569 -    cvt->len_cvt = dstsize;
  1.4570 -    if (cvt->filters[++cvt->filter_index]) {
  1.4571 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4572 -    }
  1.4573 -}
  1.4574 -
  1.4575 -static void SDLCALL
  1.4576 -SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4577 -{
  1.4578 -#if DEBUG_CONVERT
  1.4579 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
  1.4580 -#endif
  1.4581 -
  1.4582 -    const int srcsize = cvt->len_cvt - 192;
  1.4583 -    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
  1.4584 -    register int eps = 0;
  1.4585 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
  1.4586 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.4587 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.4588 -    Uint16 sample5 = SDL_SwapBE16(src[5]);
  1.4589 -    Uint16 sample4 = SDL_SwapBE16(src[4]);
  1.4590 -    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.4591 -    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.4592 -    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.4593 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4594 -    Uint16 last_sample5 = sample5;
  1.4595 -    Uint16 last_sample4 = sample4;
  1.4596 -    Uint16 last_sample3 = sample3;
  1.4597 -    Uint16 last_sample2 = sample2;
  1.4598 -    Uint16 last_sample1 = sample1;
  1.4599 -    Uint16 last_sample0 = sample0;
  1.4600 -    while (dst >= target) {
  1.4601 -        dst[5] = SDL_SwapBE16(sample5);
  1.4602 -        dst[4] = SDL_SwapBE16(sample4);
  1.4603 -        dst[3] = SDL_SwapBE16(sample3);
  1.4604 -        dst[2] = SDL_SwapBE16(sample2);
  1.4605 -        dst[1] = SDL_SwapBE16(sample1);
  1.4606 -        dst[0] = SDL_SwapBE16(sample0);
  1.4607 -        dst -= 6;
  1.4608 -        eps += srcsize;
  1.4609 -        if ((eps << 1) >= dstsize) {
  1.4610 -            src -= 6;
  1.4611 -            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.4612 -            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.4613 -            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.4614 -            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.4615 -            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.4616 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4617 -            last_sample5 = sample5;
  1.4618 -            last_sample4 = sample4;
  1.4619 -            last_sample3 = sample3;
  1.4620 -            last_sample2 = sample2;
  1.4621 -            last_sample1 = sample1;
  1.4622 -            last_sample0 = sample0;
  1.4623 -            eps -= dstsize;
  1.4624 -        }
  1.4625 -    }
  1.4626 -    cvt->len_cvt = dstsize;
  1.4627 -    if (cvt->filters[++cvt->filter_index]) {
  1.4628 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4629 -    }
  1.4630 -}
  1.4631 -
  1.4632 -static void SDLCALL
  1.4633 -SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4634 -{
  1.4635 -#if DEBUG_CONVERT
  1.4636 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
  1.4637 -#endif
  1.4638 -
  1.4639 -    const int srcsize = cvt->len_cvt - 192;
  1.4640 -    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
  1.4641 -    register int eps = 0;
  1.4642 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.4643 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.4644 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.4645 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4646 -    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.4647 -    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.4648 -    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.4649 -    Uint16 sample4 = SDL_SwapBE16(src[4]);
  1.4650 -    Uint16 sample5 = SDL_SwapBE16(src[5]);
  1.4651 -    Uint16 last_sample0 = sample0;
  1.4652 -    Uint16 last_sample1 = sample1;
  1.4653 -    Uint16 last_sample2 = sample2;
  1.4654 -    Uint16 last_sample3 = sample3;
  1.4655 -    Uint16 last_sample4 = sample4;
  1.4656 -    Uint16 last_sample5 = sample5;
  1.4657 -    while (dst < target) {
  1.4658 -        src += 6;
  1.4659 -        eps += dstsize;
  1.4660 -        if ((eps << 1) >= srcsize) {
  1.4661 -            dst[0] = SDL_SwapBE16(sample0);
  1.4662 -            dst[1] = SDL_SwapBE16(sample1);
  1.4663 -            dst[2] = SDL_SwapBE16(sample2);
  1.4664 -            dst[3] = SDL_SwapBE16(sample3);
  1.4665 -            dst[4] = SDL_SwapBE16(sample4);
  1.4666 -            dst[5] = SDL_SwapBE16(sample5);
  1.4667 -            dst += 6;
  1.4668 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4669 -            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.4670 -            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.4671 -            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.4672 -            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.4673 -            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.4674 -            last_sample0 = sample0;
  1.4675 -            last_sample1 = sample1;
  1.4676 -            last_sample2 = sample2;
  1.4677 -            last_sample3 = sample3;
  1.4678 -            last_sample4 = sample4;
  1.4679 -            last_sample5 = sample5;
  1.4680 -            eps -= srcsize;
  1.4681 -        }
  1.4682 -    }
  1.4683 -    cvt->len_cvt = dstsize;
  1.4684 -    if (cvt->filters[++cvt->filter_index]) {
  1.4685 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4686 -    }
  1.4687 -}
  1.4688 -
  1.4689 -static void SDLCALL
  1.4690 -SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4691 -{
  1.4692 -#if DEBUG_CONVERT
  1.4693 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
  1.4694 -#endif
  1.4695 -
  1.4696 -    const int srcsize = cvt->len_cvt - 256;
  1.4697 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.4698 -    register int eps = 0;
  1.4699 -    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
  1.4700 -    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.4701 -    const Uint16 *target = ((const Uint16 *) cvt->buf);
  1.4702 -    Uint16 sample7 = SDL_SwapBE16(src[7]);
  1.4703 -    Uint16 sample6 = SDL_SwapBE16(src[6]);
  1.4704 -    Uint16 sample5 = SDL_SwapBE16(src[5]);
  1.4705 -    Uint16 sample4 = SDL_SwapBE16(src[4]);
  1.4706 -    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.4707 -    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.4708 -    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.4709 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4710 -    Uint16 last_sample7 = sample7;
  1.4711 -    Uint16 last_sample6 = sample6;
  1.4712 -    Uint16 last_sample5 = sample5;
  1.4713 -    Uint16 last_sample4 = sample4;
  1.4714 -    Uint16 last_sample3 = sample3;
  1.4715 -    Uint16 last_sample2 = sample2;
  1.4716 -    Uint16 last_sample1 = sample1;
  1.4717 -    Uint16 last_sample0 = sample0;
  1.4718 -    while (dst >= target) {
  1.4719 -        dst[7] = SDL_SwapBE16(sample7);
  1.4720 -        dst[6] = SDL_SwapBE16(sample6);
  1.4721 -        dst[5] = SDL_SwapBE16(sample5);
  1.4722 -        dst[4] = SDL_SwapBE16(sample4);
  1.4723 -        dst[3] = SDL_SwapBE16(sample3);
  1.4724 -        dst[2] = SDL_SwapBE16(sample2);
  1.4725 -        dst[1] = SDL_SwapBE16(sample1);
  1.4726 -        dst[0] = SDL_SwapBE16(sample0);
  1.4727 -        dst -= 8;
  1.4728 -        eps += srcsize;
  1.4729 -        if ((eps << 1) >= dstsize) {
  1.4730 -            src -= 8;
  1.4731 -            sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
  1.4732 -            sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
  1.4733 -            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.4734 -            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.4735 -            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.4736 -            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.4737 -            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.4738 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4739 -            last_sample7 = sample7;
  1.4740 -            last_sample6 = sample6;
  1.4741 -            last_sample5 = sample5;
  1.4742 -            last_sample4 = sample4;
  1.4743 -            last_sample3 = sample3;
  1.4744 -            last_sample2 = sample2;
  1.4745 -            last_sample1 = sample1;
  1.4746 -            last_sample0 = sample0;
  1.4747 -            eps -= dstsize;
  1.4748 -        }
  1.4749 -    }
  1.4750 -    cvt->len_cvt = dstsize;
  1.4751 -    if (cvt->filters[++cvt->filter_index]) {
  1.4752 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4753 -    }
  1.4754 -}
  1.4755 -
  1.4756 -static void SDLCALL
  1.4757 -SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4758 -{
  1.4759 -#if DEBUG_CONVERT
  1.4760 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
  1.4761 -#endif
  1.4762 -
  1.4763 -    const int srcsize = cvt->len_cvt - 256;
  1.4764 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.4765 -    register int eps = 0;
  1.4766 -    Uint16 *dst = (Uint16 *) cvt->buf;
  1.4767 -    const Uint16 *src = (Uint16 *) cvt->buf;
  1.4768 -    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
  1.4769 -    Uint16 sample0 = SDL_SwapBE16(src[0]);
  1.4770 -    Uint16 sample1 = SDL_SwapBE16(src[1]);
  1.4771 -    Uint16 sample2 = SDL_SwapBE16(src[2]);
  1.4772 -    Uint16 sample3 = SDL_SwapBE16(src[3]);
  1.4773 -    Uint16 sample4 = SDL_SwapBE16(src[4]);
  1.4774 -    Uint16 sample5 = SDL_SwapBE16(src[5]);
  1.4775 -    Uint16 sample6 = SDL_SwapBE16(src[6]);
  1.4776 -    Uint16 sample7 = SDL_SwapBE16(src[7]);
  1.4777 -    Uint16 last_sample0 = sample0;
  1.4778 -    Uint16 last_sample1 = sample1;
  1.4779 -    Uint16 last_sample2 = sample2;
  1.4780 -    Uint16 last_sample3 = sample3;
  1.4781 -    Uint16 last_sample4 = sample4;
  1.4782 -    Uint16 last_sample5 = sample5;
  1.4783 -    Uint16 last_sample6 = sample6;
  1.4784 -    Uint16 last_sample7 = sample7;
  1.4785 -    while (dst < target) {
  1.4786 -        src += 8;
  1.4787 -        eps += dstsize;
  1.4788 -        if ((eps << 1) >= srcsize) {
  1.4789 -            dst[0] = SDL_SwapBE16(sample0);
  1.4790 -            dst[1] = SDL_SwapBE16(sample1);
  1.4791 -            dst[2] = SDL_SwapBE16(sample2);
  1.4792 -            dst[3] = SDL_SwapBE16(sample3);
  1.4793 -            dst[4] = SDL_SwapBE16(sample4);
  1.4794 -            dst[5] = SDL_SwapBE16(sample5);
  1.4795 -            dst[6] = SDL_SwapBE16(sample6);
  1.4796 -            dst[7] = SDL_SwapBE16(sample7);
  1.4797 -            dst += 8;
  1.4798 -            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
  1.4799 -            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
  1.4800 -            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
  1.4801 -            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
  1.4802 -            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
  1.4803 -            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
  1.4804 -            sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
  1.4805 -            sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
  1.4806 -            last_sample0 = sample0;
  1.4807 -            last_sample1 = sample1;
  1.4808 -            last_sample2 = sample2;
  1.4809 -            last_sample3 = sample3;
  1.4810 -            last_sample4 = sample4;
  1.4811 -            last_sample5 = sample5;
  1.4812 -            last_sample6 = sample6;
  1.4813 -            last_sample7 = sample7;
  1.4814 -            eps -= srcsize;
  1.4815 -        }
  1.4816 -    }
  1.4817 -    cvt->len_cvt = dstsize;
  1.4818 -    if (cvt->filters[++cvt->filter_index]) {
  1.4819 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4820 -    }
  1.4821 -}
  1.4822 -
  1.4823 -static void SDLCALL
  1.4824 -SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4825 -{
  1.4826 -#if DEBUG_CONVERT
  1.4827 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
  1.4828 -#endif
  1.4829 -
  1.4830 -    const int srcsize = cvt->len_cvt - 32;
  1.4831 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.4832 -    register int eps = 0;
  1.4833 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
  1.4834 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.4835 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.4836 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.4837 -    Sint16 last_sample0 = sample0;
  1.4838 -    while (dst >= target) {
  1.4839 -        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.4840 -        dst--;
  1.4841 -        eps += srcsize;
  1.4842 -        if ((eps << 1) >= dstsize) {
  1.4843 -            src--;
  1.4844 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4845 -            last_sample0 = sample0;
  1.4846 -            eps -= dstsize;
  1.4847 -        }
  1.4848 -    }
  1.4849 -    cvt->len_cvt = dstsize;
  1.4850 -    if (cvt->filters[++cvt->filter_index]) {
  1.4851 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4852 -    }
  1.4853 -}
  1.4854 -
  1.4855 -static void SDLCALL
  1.4856 -SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4857 -{
  1.4858 -#if DEBUG_CONVERT
  1.4859 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
  1.4860 -#endif
  1.4861 -
  1.4862 -    const int srcsize = cvt->len_cvt - 32;
  1.4863 -    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
  1.4864 -    register int eps = 0;
  1.4865 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.4866 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.4867 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.4868 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.4869 -    Sint16 last_sample0 = sample0;
  1.4870 -    while (dst < target) {
  1.4871 -        src++;
  1.4872 -        eps += dstsize;
  1.4873 -        if ((eps << 1) >= srcsize) {
  1.4874 -            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.4875 -            dst++;
  1.4876 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4877 -            last_sample0 = sample0;
  1.4878 -            eps -= srcsize;
  1.4879 -        }
  1.4880 -    }
  1.4881 -    cvt->len_cvt = dstsize;
  1.4882 -    if (cvt->filters[++cvt->filter_index]) {
  1.4883 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4884 -    }
  1.4885 -}
  1.4886 -
  1.4887 -static void SDLCALL
  1.4888 -SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4889 -{
  1.4890 -#if DEBUG_CONVERT
  1.4891 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
  1.4892 -#endif
  1.4893 -
  1.4894 -    const int srcsize = cvt->len_cvt - 64;
  1.4895 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.4896 -    register int eps = 0;
  1.4897 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
  1.4898 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.4899 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.4900 -    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.4901 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.4902 -    Sint16 last_sample1 = sample1;
  1.4903 -    Sint16 last_sample0 = sample0;
  1.4904 -    while (dst >= target) {
  1.4905 -        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.4906 -        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.4907 -        dst -= 2;
  1.4908 -        eps += srcsize;
  1.4909 -        if ((eps << 1) >= dstsize) {
  1.4910 -            src -= 2;
  1.4911 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4912 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4913 -            last_sample1 = sample1;
  1.4914 -            last_sample0 = sample0;
  1.4915 -            eps -= dstsize;
  1.4916 -        }
  1.4917 -    }
  1.4918 -    cvt->len_cvt = dstsize;
  1.4919 -    if (cvt->filters[++cvt->filter_index]) {
  1.4920 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4921 -    }
  1.4922 -}
  1.4923 -
  1.4924 -static void SDLCALL
  1.4925 -SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4926 -{
  1.4927 -#if DEBUG_CONVERT
  1.4928 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
  1.4929 -#endif
  1.4930 -
  1.4931 -    const int srcsize = cvt->len_cvt - 64;
  1.4932 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.4933 -    register int eps = 0;
  1.4934 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.4935 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.4936 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.4937 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.4938 -    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.4939 -    Sint16 last_sample0 = sample0;
  1.4940 -    Sint16 last_sample1 = sample1;
  1.4941 -    while (dst < target) {
  1.4942 -        src += 2;
  1.4943 -        eps += dstsize;
  1.4944 -        if ((eps << 1) >= srcsize) {
  1.4945 -            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.4946 -            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.4947 -            dst += 2;
  1.4948 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4949 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4950 -            last_sample0 = sample0;
  1.4951 -            last_sample1 = sample1;
  1.4952 -            eps -= srcsize;
  1.4953 -        }
  1.4954 -    }
  1.4955 -    cvt->len_cvt = dstsize;
  1.4956 -    if (cvt->filters[++cvt->filter_index]) {
  1.4957 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.4958 -    }
  1.4959 -}
  1.4960 -
  1.4961 -static void SDLCALL
  1.4962 -SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.4963 -{
  1.4964 -#if DEBUG_CONVERT
  1.4965 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
  1.4966 -#endif
  1.4967 -
  1.4968 -    const int srcsize = cvt->len_cvt - 128;
  1.4969 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.4970 -    register int eps = 0;
  1.4971 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
  1.4972 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.4973 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.4974 -    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.4975 -    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.4976 -    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.4977 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.4978 -    Sint16 last_sample3 = sample3;
  1.4979 -    Sint16 last_sample2 = sample2;
  1.4980 -    Sint16 last_sample1 = sample1;
  1.4981 -    Sint16 last_sample0 = sample0;
  1.4982 -    while (dst >= target) {
  1.4983 -        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.4984 -        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.4985 -        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.4986 -        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.4987 -        dst -= 4;
  1.4988 -        eps += srcsize;
  1.4989 -        if ((eps << 1) >= dstsize) {
  1.4990 -            src -= 4;
  1.4991 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.4992 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.4993 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.4994 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.4995 -            last_sample3 = sample3;
  1.4996 -            last_sample2 = sample2;
  1.4997 -            last_sample1 = sample1;
  1.4998 -            last_sample0 = sample0;
  1.4999 -            eps -= dstsize;
  1.5000 -        }
  1.5001 -    }
  1.5002 -    cvt->len_cvt = dstsize;
  1.5003 -    if (cvt->filters[++cvt->filter_index]) {
  1.5004 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5005 -    }
  1.5006 -}
  1.5007 -
  1.5008 -static void SDLCALL
  1.5009 -SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5010 -{
  1.5011 -#if DEBUG_CONVERT
  1.5012 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
  1.5013 -#endif
  1.5014 -
  1.5015 -    const int srcsize = cvt->len_cvt - 128;
  1.5016 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.5017 -    register int eps = 0;
  1.5018 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.5019 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.5020 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.5021 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.5022 -    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.5023 -    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.5024 -    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.5025 -    Sint16 last_sample0 = sample0;
  1.5026 -    Sint16 last_sample1 = sample1;
  1.5027 -    Sint16 last_sample2 = sample2;
  1.5028 -    Sint16 last_sample3 = sample3;
  1.5029 -    while (dst < target) {
  1.5030 -        src += 4;
  1.5031 -        eps += dstsize;
  1.5032 -        if ((eps << 1) >= srcsize) {
  1.5033 -            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.5034 -            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.5035 -            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.5036 -            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.5037 -            dst += 4;
  1.5038 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.5039 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.5040 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.5041 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.5042 -            last_sample0 = sample0;
  1.5043 -            last_sample1 = sample1;
  1.5044 -            last_sample2 = sample2;
  1.5045 -            last_sample3 = sample3;
  1.5046 -            eps -= srcsize;
  1.5047 -        }
  1.5048 -    }
  1.5049 -    cvt->len_cvt = dstsize;
  1.5050 -    if (cvt->filters[++cvt->filter_index]) {
  1.5051 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5052 -    }
  1.5053 -}
  1.5054 -
  1.5055 -static void SDLCALL
  1.5056 -SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5057 -{
  1.5058 -#if DEBUG_CONVERT
  1.5059 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
  1.5060 -#endif
  1.5061 -
  1.5062 -    const int srcsize = cvt->len_cvt - 192;
  1.5063 -    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
  1.5064 -    register int eps = 0;
  1.5065 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
  1.5066 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.5067 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.5068 -    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
  1.5069 -    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
  1.5070 -    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.5071 -    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.5072 -    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.5073 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.5074 -    Sint16 last_sample5 = sample5;
  1.5075 -    Sint16 last_sample4 = sample4;
  1.5076 -    Sint16 last_sample3 = sample3;
  1.5077 -    Sint16 last_sample2 = sample2;
  1.5078 -    Sint16 last_sample1 = sample1;
  1.5079 -    Sint16 last_sample0 = sample0;
  1.5080 -    while (dst >= target) {
  1.5081 -        dst[5] = ((Sint16) SDL_SwapBE16(sample5));
  1.5082 -        dst[4] = ((Sint16) SDL_SwapBE16(sample4));
  1.5083 -        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.5084 -        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.5085 -        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.5086 -        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.5087 -        dst -= 6;
  1.5088 -        eps += srcsize;
  1.5089 -        if ((eps << 1) >= dstsize) {
  1.5090 -            src -= 6;
  1.5091 -            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.5092 -            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.5093 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.5094 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.5095 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.5096 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.5097 -            last_sample5 = sample5;
  1.5098 -            last_sample4 = sample4;
  1.5099 -            last_sample3 = sample3;
  1.5100 -            last_sample2 = sample2;
  1.5101 -            last_sample1 = sample1;
  1.5102 -            last_sample0 = sample0;
  1.5103 -            eps -= dstsize;
  1.5104 -        }
  1.5105 -    }
  1.5106 -    cvt->len_cvt = dstsize;
  1.5107 -    if (cvt->filters[++cvt->filter_index]) {
  1.5108 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5109 -    }
  1.5110 -}
  1.5111 -
  1.5112 -static void SDLCALL
  1.5113 -SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5114 -{
  1.5115 -#if DEBUG_CONVERT
  1.5116 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
  1.5117 -#endif
  1.5118 -
  1.5119 -    const int srcsize = cvt->len_cvt - 192;
  1.5120 -    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
  1.5121 -    register int eps = 0;
  1.5122 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.5123 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.5124 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.5125 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.5126 -    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.5127 -    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.5128 -    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.5129 -    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
  1.5130 -    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
  1.5131 -    Sint16 last_sample0 = sample0;
  1.5132 -    Sint16 last_sample1 = sample1;
  1.5133 -    Sint16 last_sample2 = sample2;
  1.5134 -    Sint16 last_sample3 = sample3;
  1.5135 -    Sint16 last_sample4 = sample4;
  1.5136 -    Sint16 last_sample5 = sample5;
  1.5137 -    while (dst < target) {
  1.5138 -        src += 6;
  1.5139 -        eps += dstsize;
  1.5140 -        if ((eps << 1) >= srcsize) {
  1.5141 -            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.5142 -            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.5143 -            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.5144 -            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.5145 -            dst[4] = ((Sint16) SDL_SwapBE16(sample4));
  1.5146 -            dst[5] = ((Sint16) SDL_SwapBE16(sample5));
  1.5147 -            dst += 6;
  1.5148 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.5149 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.5150 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.5151 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.5152 -            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.5153 -            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.5154 -            last_sample0 = sample0;
  1.5155 -            last_sample1 = sample1;
  1.5156 -            last_sample2 = sample2;
  1.5157 -            last_sample3 = sample3;
  1.5158 -            last_sample4 = sample4;
  1.5159 -            last_sample5 = sample5;
  1.5160 -            eps -= srcsize;
  1.5161 -        }
  1.5162 -    }
  1.5163 -    cvt->len_cvt = dstsize;
  1.5164 -    if (cvt->filters[++cvt->filter_index]) {
  1.5165 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5166 -    }
  1.5167 -}
  1.5168 -
  1.5169 -static void SDLCALL
  1.5170 -SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5171 -{
  1.5172 -#if DEBUG_CONVERT
  1.5173 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
  1.5174 -#endif
  1.5175 -
  1.5176 -    const int srcsize = cvt->len_cvt - 256;
  1.5177 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.5178 -    register int eps = 0;
  1.5179 -    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
  1.5180 -    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.5181 -    const Sint16 *target = ((const Sint16 *) cvt->buf);
  1.5182 -    Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
  1.5183 -    Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
  1.5184 -    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
  1.5185 -    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
  1.5186 -    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.5187 -    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.5188 -    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.5189 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.5190 -    Sint16 last_sample7 = sample7;
  1.5191 -    Sint16 last_sample6 = sample6;
  1.5192 -    Sint16 last_sample5 = sample5;
  1.5193 -    Sint16 last_sample4 = sample4;
  1.5194 -    Sint16 last_sample3 = sample3;
  1.5195 -    Sint16 last_sample2 = sample2;
  1.5196 -    Sint16 last_sample1 = sample1;
  1.5197 -    Sint16 last_sample0 = sample0;
  1.5198 -    while (dst >= target) {
  1.5199 -        dst[7] = ((Sint16) SDL_SwapBE16(sample7));
  1.5200 -        dst[6] = ((Sint16) SDL_SwapBE16(sample6));
  1.5201 -        dst[5] = ((Sint16) SDL_SwapBE16(sample5));
  1.5202 -        dst[4] = ((Sint16) SDL_SwapBE16(sample4));
  1.5203 -        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.5204 -        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.5205 -        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.5206 -        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.5207 -        dst -= 8;
  1.5208 -        eps += srcsize;
  1.5209 -        if ((eps << 1) >= dstsize) {
  1.5210 -            src -= 8;
  1.5211 -            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
  1.5212 -            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
  1.5213 -            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.5214 -            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.5215 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.5216 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.5217 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.5218 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.5219 -            last_sample7 = sample7;
  1.5220 -            last_sample6 = sample6;
  1.5221 -            last_sample5 = sample5;
  1.5222 -            last_sample4 = sample4;
  1.5223 -            last_sample3 = sample3;
  1.5224 -            last_sample2 = sample2;
  1.5225 -            last_sample1 = sample1;
  1.5226 -            last_sample0 = sample0;
  1.5227 -            eps -= dstsize;
  1.5228 -        }
  1.5229 -    }
  1.5230 -    cvt->len_cvt = dstsize;
  1.5231 -    if (cvt->filters[++cvt->filter_index]) {
  1.5232 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5233 -    }
  1.5234 -}
  1.5235 -
  1.5236 -static void SDLCALL
  1.5237 -SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5238 -{
  1.5239 -#if DEBUG_CONVERT
  1.5240 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
  1.5241 -#endif
  1.5242 -
  1.5243 -    const int srcsize = cvt->len_cvt - 256;
  1.5244 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.5245 -    register int eps = 0;
  1.5246 -    Sint16 *dst = (Sint16 *) cvt->buf;
  1.5247 -    const Sint16 *src = (Sint16 *) cvt->buf;
  1.5248 -    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
  1.5249 -    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
  1.5250 -    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
  1.5251 -    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
  1.5252 -    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
  1.5253 -    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
  1.5254 -    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
  1.5255 -    Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
  1.5256 -    Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
  1.5257 -    Sint16 last_sample0 = sample0;
  1.5258 -    Sint16 last_sample1 = sample1;
  1.5259 -    Sint16 last_sample2 = sample2;
  1.5260 -    Sint16 last_sample3 = sample3;
  1.5261 -    Sint16 last_sample4 = sample4;
  1.5262 -    Sint16 last_sample5 = sample5;
  1.5263 -    Sint16 last_sample6 = sample6;
  1.5264 -    Sint16 last_sample7 = sample7;
  1.5265 -    while (dst < target) {
  1.5266 -        src += 8;
  1.5267 -        eps += dstsize;
  1.5268 -        if ((eps << 1) >= srcsize) {
  1.5269 -            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
  1.5270 -            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
  1.5271 -            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
  1.5272 -            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
  1.5273 -            dst[4] = ((Sint16) SDL_SwapBE16(sample4));
  1.5274 -            dst[5] = ((Sint16) SDL_SwapBE16(sample5));
  1.5275 -            dst[6] = ((Sint16) SDL_SwapBE16(sample6));
  1.5276 -            dst[7] = ((Sint16) SDL_SwapBE16(sample7));
  1.5277 -            dst += 8;
  1.5278 -            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
  1.5279 -            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
  1.5280 -            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
  1.5281 -            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
  1.5282 -            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
  1.5283 -            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
  1.5284 -            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
  1.5285 -            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
  1.5286 -            last_sample0 = sample0;
  1.5287 -            last_sample1 = sample1;
  1.5288 -            last_sample2 = sample2;
  1.5289 -            last_sample3 = sample3;
  1.5290 -            last_sample4 = sample4;
  1.5291 -            last_sample5 = sample5;
  1.5292 -            last_sample6 = sample6;
  1.5293 -            last_sample7 = sample7;
  1.5294 -            eps -= srcsize;
  1.5295 -        }
  1.5296 -    }
  1.5297 -    cvt->len_cvt = dstsize;
  1.5298 -    if (cvt->filters[++cvt->filter_index]) {
  1.5299 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5300 -    }
  1.5301 -}
  1.5302 -
  1.5303 -static void SDLCALL
  1.5304 -SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5305 -{
  1.5306 -#if DEBUG_CONVERT
  1.5307 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
  1.5308 -#endif
  1.5309 -
  1.5310 -    const int srcsize = cvt->len_cvt - 64;
  1.5311 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.5312 -    register int eps = 0;
  1.5313 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
  1.5314 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.5315 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.5316 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5317 -    Sint32 last_sample0 = sample0;
  1.5318 -    while (dst >= target) {
  1.5319 -        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5320 -        dst--;
  1.5321 -        eps += srcsize;
  1.5322 -        if ((eps << 1) >= dstsize) {
  1.5323 -            src--;
  1.5324 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5325 -            last_sample0 = sample0;
  1.5326 -            eps -= dstsize;
  1.5327 -        }
  1.5328 -    }
  1.5329 -    cvt->len_cvt = dstsize;
  1.5330 -    if (cvt->filters[++cvt->filter_index]) {
  1.5331 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5332 -    }
  1.5333 -}
  1.5334 -
  1.5335 -static void SDLCALL
  1.5336 -SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5337 -{
  1.5338 -#if DEBUG_CONVERT
  1.5339 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
  1.5340 -#endif
  1.5341 -
  1.5342 -    const int srcsize = cvt->len_cvt - 64;
  1.5343 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.5344 -    register int eps = 0;
  1.5345 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.5346 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.5347 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.5348 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5349 -    Sint32 last_sample0 = sample0;
  1.5350 -    while (dst < target) {
  1.5351 -        src++;
  1.5352 -        eps += dstsize;
  1.5353 -        if ((eps << 1) >= srcsize) {
  1.5354 -            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5355 -            dst++;
  1.5356 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5357 -            last_sample0 = sample0;
  1.5358 -            eps -= srcsize;
  1.5359 -        }
  1.5360 -    }
  1.5361 -    cvt->len_cvt = dstsize;
  1.5362 -    if (cvt->filters[++cvt->filter_index]) {
  1.5363 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5364 -    }
  1.5365 -}
  1.5366 -
  1.5367 -static void SDLCALL
  1.5368 -SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5369 -{
  1.5370 -#if DEBUG_CONVERT
  1.5371 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
  1.5372 -#endif
  1.5373 -
  1.5374 -    const int srcsize = cvt->len_cvt - 128;
  1.5375 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.5376 -    register int eps = 0;
  1.5377 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
  1.5378 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.5379 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.5380 -    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.5381 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5382 -    Sint32 last_sample1 = sample1;
  1.5383 -    Sint32 last_sample0 = sample0;
  1.5384 -    while (dst >= target) {
  1.5385 -        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.5386 -        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5387 -        dst -= 2;
  1.5388 -        eps += srcsize;
  1.5389 -        if ((eps << 1) >= dstsize) {
  1.5390 -            src -= 2;
  1.5391 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5392 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5393 -            last_sample1 = sample1;
  1.5394 -            last_sample0 = sample0;
  1.5395 -            eps -= dstsize;
  1.5396 -        }
  1.5397 -    }
  1.5398 -    cvt->len_cvt = dstsize;
  1.5399 -    if (cvt->filters[++cvt->filter_index]) {
  1.5400 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5401 -    }
  1.5402 -}
  1.5403 -
  1.5404 -static void SDLCALL
  1.5405 -SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5406 -{
  1.5407 -#if DEBUG_CONVERT
  1.5408 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
  1.5409 -#endif
  1.5410 -
  1.5411 -    const int srcsize = cvt->len_cvt - 128;
  1.5412 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.5413 -    register int eps = 0;
  1.5414 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.5415 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.5416 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.5417 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5418 -    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.5419 -    Sint32 last_sample0 = sample0;
  1.5420 -    Sint32 last_sample1 = sample1;
  1.5421 -    while (dst < target) {
  1.5422 -        src += 2;
  1.5423 -        eps += dstsize;
  1.5424 -        if ((eps << 1) >= srcsize) {
  1.5425 -            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5426 -            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.5427 -            dst += 2;
  1.5428 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5429 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5430 -            last_sample0 = sample0;
  1.5431 -            last_sample1 = sample1;
  1.5432 -            eps -= srcsize;
  1.5433 -        }
  1.5434 -    }
  1.5435 -    cvt->len_cvt = dstsize;
  1.5436 -    if (cvt->filters[++cvt->filter_index]) {
  1.5437 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5438 -    }
  1.5439 -}
  1.5440 -
  1.5441 -static void SDLCALL
  1.5442 -SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5443 -{
  1.5444 -#if DEBUG_CONVERT
  1.5445 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
  1.5446 -#endif
  1.5447 -
  1.5448 -    const int srcsize = cvt->len_cvt - 256;
  1.5449 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.5450 -    register int eps = 0;
  1.5451 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
  1.5452 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.5453 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.5454 -    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.5455 -    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.5456 -    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.5457 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5458 -    Sint32 last_sample3 = sample3;
  1.5459 -    Sint32 last_sample2 = sample2;
  1.5460 -    Sint32 last_sample1 = sample1;
  1.5461 -    Sint32 last_sample0 = sample0;
  1.5462 -    while (dst >= target) {
  1.5463 -        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.5464 -        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.5465 -        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.5466 -        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5467 -        dst -= 4;
  1.5468 -        eps += srcsize;
  1.5469 -        if ((eps << 1) >= dstsize) {
  1.5470 -            src -= 4;
  1.5471 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.5472 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.5473 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5474 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5475 -            last_sample3 = sample3;
  1.5476 -            last_sample2 = sample2;
  1.5477 -            last_sample1 = sample1;
  1.5478 -            last_sample0 = sample0;
  1.5479 -            eps -= dstsize;
  1.5480 -        }
  1.5481 -    }
  1.5482 -    cvt->len_cvt = dstsize;
  1.5483 -    if (cvt->filters[++cvt->filter_index]) {
  1.5484 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5485 -    }
  1.5486 -}
  1.5487 -
  1.5488 -static void SDLCALL
  1.5489 -SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5490 -{
  1.5491 -#if DEBUG_CONVERT
  1.5492 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
  1.5493 -#endif
  1.5494 -
  1.5495 -    const int srcsize = cvt->len_cvt - 256;
  1.5496 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.5497 -    register int eps = 0;
  1.5498 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.5499 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.5500 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.5501 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5502 -    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.5503 -    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.5504 -    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.5505 -    Sint32 last_sample0 = sample0;
  1.5506 -    Sint32 last_sample1 = sample1;
  1.5507 -    Sint32 last_sample2 = sample2;
  1.5508 -    Sint32 last_sample3 = sample3;
  1.5509 -    while (dst < target) {
  1.5510 -        src += 4;
  1.5511 -        eps += dstsize;
  1.5512 -        if ((eps << 1) >= srcsize) {
  1.5513 -            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5514 -            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.5515 -            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.5516 -            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.5517 -            dst += 4;
  1.5518 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5519 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5520 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.5521 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.5522 -            last_sample0 = sample0;
  1.5523 -            last_sample1 = sample1;
  1.5524 -            last_sample2 = sample2;
  1.5525 -            last_sample3 = sample3;
  1.5526 -            eps -= srcsize;
  1.5527 -        }
  1.5528 -    }
  1.5529 -    cvt->len_cvt = dstsize;
  1.5530 -    if (cvt->filters[++cvt->filter_index]) {
  1.5531 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5532 -    }
  1.5533 -}
  1.5534 -
  1.5535 -static void SDLCALL
  1.5536 -SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5537 -{
  1.5538 -#if DEBUG_CONVERT
  1.5539 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
  1.5540 -#endif
  1.5541 -
  1.5542 -    const int srcsize = cvt->len_cvt - 384;
  1.5543 -    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
  1.5544 -    register int eps = 0;
  1.5545 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
  1.5546 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.5547 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.5548 -    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
  1.5549 -    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
  1.5550 -    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.5551 -    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.5552 -    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.5553 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5554 -    Sint32 last_sample5 = sample5;
  1.5555 -    Sint32 last_sample4 = sample4;
  1.5556 -    Sint32 last_sample3 = sample3;
  1.5557 -    Sint32 last_sample2 = sample2;
  1.5558 -    Sint32 last_sample1 = sample1;
  1.5559 -    Sint32 last_sample0 = sample0;
  1.5560 -    while (dst >= target) {
  1.5561 -        dst[5] = ((Sint32) SDL_SwapLE32(sample5));
  1.5562 -        dst[4] = ((Sint32) SDL_SwapLE32(sample4));
  1.5563 -        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.5564 -        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.5565 -        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.5566 -        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5567 -        dst -= 6;
  1.5568 -        eps += srcsize;
  1.5569 -        if ((eps << 1) >= dstsize) {
  1.5570 -            src -= 6;
  1.5571 -            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.5572 -            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.5573 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.5574 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.5575 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5576 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5577 -            last_sample5 = sample5;
  1.5578 -            last_sample4 = sample4;
  1.5579 -            last_sample3 = sample3;
  1.5580 -            last_sample2 = sample2;
  1.5581 -            last_sample1 = sample1;
  1.5582 -            last_sample0 = sample0;
  1.5583 -            eps -= dstsize;
  1.5584 -        }
  1.5585 -    }
  1.5586 -    cvt->len_cvt = dstsize;
  1.5587 -    if (cvt->filters[++cvt->filter_index]) {
  1.5588 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5589 -    }
  1.5590 -}
  1.5591 -
  1.5592 -static void SDLCALL
  1.5593 -SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5594 -{
  1.5595 -#if DEBUG_CONVERT
  1.5596 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
  1.5597 -#endif
  1.5598 -
  1.5599 -    const int srcsize = cvt->len_cvt - 384;
  1.5600 -    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
  1.5601 -    register int eps = 0;
  1.5602 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.5603 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.5604 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.5605 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5606 -    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.5607 -    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.5608 -    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.5609 -    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
  1.5610 -    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
  1.5611 -    Sint32 last_sample0 = sample0;
  1.5612 -    Sint32 last_sample1 = sample1;
  1.5613 -    Sint32 last_sample2 = sample2;
  1.5614 -    Sint32 last_sample3 = sample3;
  1.5615 -    Sint32 last_sample4 = sample4;
  1.5616 -    Sint32 last_sample5 = sample5;
  1.5617 -    while (dst < target) {
  1.5618 -        src += 6;
  1.5619 -        eps += dstsize;
  1.5620 -        if ((eps << 1) >= srcsize) {
  1.5621 -            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5622 -            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.5623 -            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.5624 -            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.5625 -            dst[4] = ((Sint32) SDL_SwapLE32(sample4));
  1.5626 -            dst[5] = ((Sint32) SDL_SwapLE32(sample5));
  1.5627 -            dst += 6;
  1.5628 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5629 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5630 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.5631 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.5632 -            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.5633 -            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.5634 -            last_sample0 = sample0;
  1.5635 -            last_sample1 = sample1;
  1.5636 -            last_sample2 = sample2;
  1.5637 -            last_sample3 = sample3;
  1.5638 -            last_sample4 = sample4;
  1.5639 -            last_sample5 = sample5;
  1.5640 -            eps -= srcsize;
  1.5641 -        }
  1.5642 -    }
  1.5643 -    cvt->len_cvt = dstsize;
  1.5644 -    if (cvt->filters[++cvt->filter_index]) {
  1.5645 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5646 -    }
  1.5647 -}
  1.5648 -
  1.5649 -static void SDLCALL
  1.5650 -SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5651 -{
  1.5652 -#if DEBUG_CONVERT
  1.5653 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
  1.5654 -#endif
  1.5655 -
  1.5656 -    const int srcsize = cvt->len_cvt - 512;
  1.5657 -    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
  1.5658 -    register int eps = 0;
  1.5659 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
  1.5660 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.5661 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.5662 -    Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
  1.5663 -    Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
  1.5664 -    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
  1.5665 -    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
  1.5666 -    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.5667 -    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.5668 -    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.5669 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5670 -    Sint32 last_sample7 = sample7;
  1.5671 -    Sint32 last_sample6 = sample6;
  1.5672 -    Sint32 last_sample5 = sample5;
  1.5673 -    Sint32 last_sample4 = sample4;
  1.5674 -    Sint32 last_sample3 = sample3;
  1.5675 -    Sint32 last_sample2 = sample2;
  1.5676 -    Sint32 last_sample1 = sample1;
  1.5677 -    Sint32 last_sample0 = sample0;
  1.5678 -    while (dst >= target) {
  1.5679 -        dst[7] = ((Sint32) SDL_SwapLE32(sample7));
  1.5680 -        dst[6] = ((Sint32) SDL_SwapLE32(sample6));
  1.5681 -        dst[5] = ((Sint32) SDL_SwapLE32(sample5));
  1.5682 -        dst[4] = ((Sint32) SDL_SwapLE32(sample4));
  1.5683 -        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.5684 -        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.5685 -        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.5686 -        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5687 -        dst -= 8;
  1.5688 -        eps += srcsize;
  1.5689 -        if ((eps << 1) >= dstsize) {
  1.5690 -            src -= 8;
  1.5691 -            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
  1.5692 -            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
  1.5693 -            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.5694 -            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.5695 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.5696 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.5697 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5698 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5699 -            last_sample7 = sample7;
  1.5700 -            last_sample6 = sample6;
  1.5701 -            last_sample5 = sample5;
  1.5702 -            last_sample4 = sample4;
  1.5703 -            last_sample3 = sample3;
  1.5704 -            last_sample2 = sample2;
  1.5705 -            last_sample1 = sample1;
  1.5706 -            last_sample0 = sample0;
  1.5707 -            eps -= dstsize;
  1.5708 -        }
  1.5709 -    }
  1.5710 -    cvt->len_cvt = dstsize;
  1.5711 -    if (cvt->filters[++cvt->filter_index]) {
  1.5712 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5713 -    }
  1.5714 -}
  1.5715 -
  1.5716 -static void SDLCALL
  1.5717 -SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5718 -{
  1.5719 -#if DEBUG_CONVERT
  1.5720 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
  1.5721 -#endif
  1.5722 -
  1.5723 -    const int srcsize = cvt->len_cvt - 512;
  1.5724 -    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
  1.5725 -    register int eps = 0;
  1.5726 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.5727 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.5728 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.5729 -    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
  1.5730 -    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
  1.5731 -    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
  1.5732 -    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
  1.5733 -    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
  1.5734 -    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
  1.5735 -    Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
  1.5736 -    Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
  1.5737 -    Sint32 last_sample0 = sample0;
  1.5738 -    Sint32 last_sample1 = sample1;
  1.5739 -    Sint32 last_sample2 = sample2;
  1.5740 -    Sint32 last_sample3 = sample3;
  1.5741 -    Sint32 last_sample4 = sample4;
  1.5742 -    Sint32 last_sample5 = sample5;
  1.5743 -    Sint32 last_sample6 = sample6;
  1.5744 -    Sint32 last_sample7 = sample7;
  1.5745 -    while (dst < target) {
  1.5746 -        src += 8;
  1.5747 -        eps += dstsize;
  1.5748 -        if ((eps << 1) >= srcsize) {
  1.5749 -            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
  1.5750 -            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
  1.5751 -            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
  1.5752 -            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
  1.5753 -            dst[4] = ((Sint32) SDL_SwapLE32(sample4));
  1.5754 -            dst[5] = ((Sint32) SDL_SwapLE32(sample5));
  1.5755 -            dst[6] = ((Sint32) SDL_SwapLE32(sample6));
  1.5756 -            dst[7] = ((Sint32) SDL_SwapLE32(sample7));
  1.5757 -            dst += 8;
  1.5758 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5759 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5760 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.5761 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.5762 -            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.5763 -            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.5764 -            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
  1.5765 -            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
  1.5766 -            last_sample0 = sample0;
  1.5767 -            last_sample1 = sample1;
  1.5768 -            last_sample2 = sample2;
  1.5769 -            last_sample3 = sample3;
  1.5770 -            last_sample4 = sample4;
  1.5771 -            last_sample5 = sample5;
  1.5772 -            last_sample6 = sample6;
  1.5773 -            last_sample7 = sample7;
  1.5774 -            eps -= srcsize;
  1.5775 -        }
  1.5776 -    }
  1.5777 -    cvt->len_cvt = dstsize;
  1.5778 -    if (cvt->filters[++cvt->filter_index]) {
  1.5779 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5780 -    }
  1.5781 -}
  1.5782 -
  1.5783 -static void SDLCALL
  1.5784 -SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5785 -{
  1.5786 -#if DEBUG_CONVERT
  1.5787 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
  1.5788 -#endif
  1.5789 -
  1.5790 -    const int srcsize = cvt->len_cvt - 64;
  1.5791 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.5792 -    register int eps = 0;
  1.5793 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
  1.5794 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.5795 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.5796 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.5797 -    Sint32 last_sample0 = sample0;
  1.5798 -    while (dst >= target) {
  1.5799 -        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.5800 -        dst--;
  1.5801 -        eps += srcsize;
  1.5802 -        if ((eps << 1) >= dstsize) {
  1.5803 -            src--;
  1.5804 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5805 -            last_sample0 = sample0;
  1.5806 -            eps -= dstsize;
  1.5807 -        }
  1.5808 -    }
  1.5809 -    cvt->len_cvt = dstsize;
  1.5810 -    if (cvt->filters[++cvt->filter_index]) {
  1.5811 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5812 -    }
  1.5813 -}
  1.5814 -
  1.5815 -static void SDLCALL
  1.5816 -SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5817 -{
  1.5818 -#if DEBUG_CONVERT
  1.5819 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
  1.5820 -#endif
  1.5821 -
  1.5822 -    const int srcsize = cvt->len_cvt - 64;
  1.5823 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.5824 -    register int eps = 0;
  1.5825 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.5826 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.5827 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.5828 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.5829 -    Sint32 last_sample0 = sample0;
  1.5830 -    while (dst < target) {
  1.5831 -        src++;
  1.5832 -        eps += dstsize;
  1.5833 -        if ((eps << 1) >= srcsize) {
  1.5834 -            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.5835 -            dst++;
  1.5836 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5837 -            last_sample0 = sample0;
  1.5838 -            eps -= srcsize;
  1.5839 -        }
  1.5840 -    }
  1.5841 -    cvt->len_cvt = dstsize;
  1.5842 -    if (cvt->filters[++cvt->filter_index]) {
  1.5843 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5844 -    }
  1.5845 -}
  1.5846 -
  1.5847 -static void SDLCALL
  1.5848 -SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5849 -{
  1.5850 -#if DEBUG_CONVERT
  1.5851 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
  1.5852 -#endif
  1.5853 -
  1.5854 -    const int srcsize = cvt->len_cvt - 128;
  1.5855 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.5856 -    register int eps = 0;
  1.5857 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
  1.5858 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.5859 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.5860 -    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.5861 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.5862 -    Sint32 last_sample1 = sample1;
  1.5863 -    Sint32 last_sample0 = sample0;
  1.5864 -    while (dst >= target) {
  1.5865 -        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.5866 -        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.5867 -        dst -= 2;
  1.5868 -        eps += srcsize;
  1.5869 -        if ((eps << 1) >= dstsize) {
  1.5870 -            src -= 2;
  1.5871 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5872 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5873 -            last_sample1 = sample1;
  1.5874 -            last_sample0 = sample0;
  1.5875 -            eps -= dstsize;
  1.5876 -        }
  1.5877 -    }
  1.5878 -    cvt->len_cvt = dstsize;
  1.5879 -    if (cvt->filters[++cvt->filter_index]) {
  1.5880 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5881 -    }
  1.5882 -}
  1.5883 -
  1.5884 -static void SDLCALL
  1.5885 -SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5886 -{
  1.5887 -#if DEBUG_CONVERT
  1.5888 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
  1.5889 -#endif
  1.5890 -
  1.5891 -    const int srcsize = cvt->len_cvt - 128;
  1.5892 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.5893 -    register int eps = 0;
  1.5894 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.5895 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.5896 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.5897 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.5898 -    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.5899 -    Sint32 last_sample0 = sample0;
  1.5900 -    Sint32 last_sample1 = sample1;
  1.5901 -    while (dst < target) {
  1.5902 -        src += 2;
  1.5903 -        eps += dstsize;
  1.5904 -        if ((eps << 1) >= srcsize) {
  1.5905 -            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.5906 -            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.5907 -            dst += 2;
  1.5908 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5909 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5910 -            last_sample0 = sample0;
  1.5911 -            last_sample1 = sample1;
  1.5912 -            eps -= srcsize;
  1.5913 -        }
  1.5914 -    }
  1.5915 -    cvt->len_cvt = dstsize;
  1.5916 -    if (cvt->filters[++cvt->filter_index]) {
  1.5917 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5918 -    }
  1.5919 -}
  1.5920 -
  1.5921 -static void SDLCALL
  1.5922 -SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5923 -{
  1.5924 -#if DEBUG_CONVERT
  1.5925 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
  1.5926 -#endif
  1.5927 -
  1.5928 -    const int srcsize = cvt->len_cvt - 256;
  1.5929 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.5930 -    register int eps = 0;
  1.5931 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
  1.5932 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.5933 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.5934 -    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.5935 -    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.5936 -    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.5937 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.5938 -    Sint32 last_sample3 = sample3;
  1.5939 -    Sint32 last_sample2 = sample2;
  1.5940 -    Sint32 last_sample1 = sample1;
  1.5941 -    Sint32 last_sample0 = sample0;
  1.5942 -    while (dst >= target) {
  1.5943 -        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.5944 -        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.5945 -        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.5946 -        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.5947 -        dst -= 4;
  1.5948 -        eps += srcsize;
  1.5949 -        if ((eps << 1) >= dstsize) {
  1.5950 -            src -= 4;
  1.5951 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.5952 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.5953 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.5954 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5955 -            last_sample3 = sample3;
  1.5956 -            last_sample2 = sample2;
  1.5957 -            last_sample1 = sample1;
  1.5958 -            last_sample0 = sample0;
  1.5959 -            eps -= dstsize;
  1.5960 -        }
  1.5961 -    }
  1.5962 -    cvt->len_cvt = dstsize;
  1.5963 -    if (cvt->filters[++cvt->filter_index]) {
  1.5964 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.5965 -    }
  1.5966 -}
  1.5967 -
  1.5968 -static void SDLCALL
  1.5969 -SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.5970 -{
  1.5971 -#if DEBUG_CONVERT
  1.5972 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
  1.5973 -#endif
  1.5974 -
  1.5975 -    const int srcsize = cvt->len_cvt - 256;
  1.5976 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.5977 -    register int eps = 0;
  1.5978 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.5979 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.5980 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.5981 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.5982 -    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.5983 -    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.5984 -    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.5985 -    Sint32 last_sample0 = sample0;
  1.5986 -    Sint32 last_sample1 = sample1;
  1.5987 -    Sint32 last_sample2 = sample2;
  1.5988 -    Sint32 last_sample3 = sample3;
  1.5989 -    while (dst < target) {
  1.5990 -        src += 4;
  1.5991 -        eps += dstsize;
  1.5992 -        if ((eps << 1) >= srcsize) {
  1.5993 -            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.5994 -            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.5995 -            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.5996 -            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.5997 -            dst += 4;
  1.5998 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.5999 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.6000 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.6001 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.6002 -            last_sample0 = sample0;
  1.6003 -            last_sample1 = sample1;
  1.6004 -            last_sample2 = sample2;
  1.6005 -            last_sample3 = sample3;
  1.6006 -            eps -= srcsize;
  1.6007 -        }
  1.6008 -    }
  1.6009 -    cvt->len_cvt = dstsize;
  1.6010 -    if (cvt->filters[++cvt->filter_index]) {
  1.6011 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6012 -    }
  1.6013 -}
  1.6014 -
  1.6015 -static void SDLCALL
  1.6016 -SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6017 -{
  1.6018 -#if DEBUG_CONVERT
  1.6019 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
  1.6020 -#endif
  1.6021 -
  1.6022 -    const int srcsize = cvt->len_cvt - 384;
  1.6023 -    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
  1.6024 -    register int eps = 0;
  1.6025 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
  1.6026 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.6027 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.6028 -    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
  1.6029 -    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
  1.6030 -    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.6031 -    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.6032 -    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.6033 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.6034 -    Sint32 last_sample5 = sample5;
  1.6035 -    Sint32 last_sample4 = sample4;
  1.6036 -    Sint32 last_sample3 = sample3;
  1.6037 -    Sint32 last_sample2 = sample2;
  1.6038 -    Sint32 last_sample1 = sample1;
  1.6039 -    Sint32 last_sample0 = sample0;
  1.6040 -    while (dst >= target) {
  1.6041 -        dst[5] = ((Sint32) SDL_SwapBE32(sample5));
  1.6042 -        dst[4] = ((Sint32) SDL_SwapBE32(sample4));
  1.6043 -        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.6044 -        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.6045 -        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.6046 -        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.6047 -        dst -= 6;
  1.6048 -        eps += srcsize;
  1.6049 -        if ((eps << 1) >= dstsize) {
  1.6050 -            src -= 6;
  1.6051 -            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.6052 -            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.6053 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.6054 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.6055 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.6056 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.6057 -            last_sample5 = sample5;
  1.6058 -            last_sample4 = sample4;
  1.6059 -            last_sample3 = sample3;
  1.6060 -            last_sample2 = sample2;
  1.6061 -            last_sample1 = sample1;
  1.6062 -            last_sample0 = sample0;
  1.6063 -            eps -= dstsize;
  1.6064 -        }
  1.6065 -    }
  1.6066 -    cvt->len_cvt = dstsize;
  1.6067 -    if (cvt->filters[++cvt->filter_index]) {
  1.6068 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6069 -    }
  1.6070 -}
  1.6071 -
  1.6072 -static void SDLCALL
  1.6073 -SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6074 -{
  1.6075 -#if DEBUG_CONVERT
  1.6076 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
  1.6077 -#endif
  1.6078 -
  1.6079 -    const int srcsize = cvt->len_cvt - 384;
  1.6080 -    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
  1.6081 -    register int eps = 0;
  1.6082 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.6083 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.6084 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.6085 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.6086 -    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.6087 -    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.6088 -    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.6089 -    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
  1.6090 -    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
  1.6091 -    Sint32 last_sample0 = sample0;
  1.6092 -    Sint32 last_sample1 = sample1;
  1.6093 -    Sint32 last_sample2 = sample2;
  1.6094 -    Sint32 last_sample3 = sample3;
  1.6095 -    Sint32 last_sample4 = sample4;
  1.6096 -    Sint32 last_sample5 = sample5;
  1.6097 -    while (dst < target) {
  1.6098 -        src += 6;
  1.6099 -        eps += dstsize;
  1.6100 -        if ((eps << 1) >= srcsize) {
  1.6101 -            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.6102 -            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.6103 -            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.6104 -            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.6105 -            dst[4] = ((Sint32) SDL_SwapBE32(sample4));
  1.6106 -            dst[5] = ((Sint32) SDL_SwapBE32(sample5));
  1.6107 -            dst += 6;
  1.6108 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.6109 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.6110 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.6111 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.6112 -            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.6113 -            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.6114 -            last_sample0 = sample0;
  1.6115 -            last_sample1 = sample1;
  1.6116 -            last_sample2 = sample2;
  1.6117 -            last_sample3 = sample3;
  1.6118 -            last_sample4 = sample4;
  1.6119 -            last_sample5 = sample5;
  1.6120 -            eps -= srcsize;
  1.6121 -        }
  1.6122 -    }
  1.6123 -    cvt->len_cvt = dstsize;
  1.6124 -    if (cvt->filters[++cvt->filter_index]) {
  1.6125 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6126 -    }
  1.6127 -}
  1.6128 -
  1.6129 -static void SDLCALL
  1.6130 -SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6131 -{
  1.6132 -#if DEBUG_CONVERT
  1.6133 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
  1.6134 -#endif
  1.6135 -
  1.6136 -    const int srcsize = cvt->len_cvt - 512;
  1.6137 -    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
  1.6138 -    register int eps = 0;
  1.6139 -    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
  1.6140 -    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
  1.6141 -    const Sint32 *target = ((const Sint32 *) cvt->buf);
  1.6142 -    Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
  1.6143 -    Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
  1.6144 -    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
  1.6145 -    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
  1.6146 -    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.6147 -    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.6148 -    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.6149 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.6150 -    Sint32 last_sample7 = sample7;
  1.6151 -    Sint32 last_sample6 = sample6;
  1.6152 -    Sint32 last_sample5 = sample5;
  1.6153 -    Sint32 last_sample4 = sample4;
  1.6154 -    Sint32 last_sample3 = sample3;
  1.6155 -    Sint32 last_sample2 = sample2;
  1.6156 -    Sint32 last_sample1 = sample1;
  1.6157 -    Sint32 last_sample0 = sample0;
  1.6158 -    while (dst >= target) {
  1.6159 -        dst[7] = ((Sint32) SDL_SwapBE32(sample7));
  1.6160 -        dst[6] = ((Sint32) SDL_SwapBE32(sample6));
  1.6161 -        dst[5] = ((Sint32) SDL_SwapBE32(sample5));
  1.6162 -        dst[4] = ((Sint32) SDL_SwapBE32(sample4));
  1.6163 -        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.6164 -        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.6165 -        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.6166 -        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.6167 -        dst -= 8;
  1.6168 -        eps += srcsize;
  1.6169 -        if ((eps << 1) >= dstsize) {
  1.6170 -            src -= 8;
  1.6171 -            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
  1.6172 -            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
  1.6173 -            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.6174 -            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.6175 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.6176 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.6177 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.6178 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.6179 -            last_sample7 = sample7;
  1.6180 -            last_sample6 = sample6;
  1.6181 -            last_sample5 = sample5;
  1.6182 -            last_sample4 = sample4;
  1.6183 -            last_sample3 = sample3;
  1.6184 -            last_sample2 = sample2;
  1.6185 -            last_sample1 = sample1;
  1.6186 -            last_sample0 = sample0;
  1.6187 -            eps -= dstsize;
  1.6188 -        }
  1.6189 -    }
  1.6190 -    cvt->len_cvt = dstsize;
  1.6191 -    if (cvt->filters[++cvt->filter_index]) {
  1.6192 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6193 -    }
  1.6194 -}
  1.6195 -
  1.6196 -static void SDLCALL
  1.6197 -SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6198 -{
  1.6199 -#if DEBUG_CONVERT
  1.6200 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
  1.6201 -#endif
  1.6202 -
  1.6203 -    const int srcsize = cvt->len_cvt - 512;
  1.6204 -    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
  1.6205 -    register int eps = 0;
  1.6206 -    Sint32 *dst = (Sint32 *) cvt->buf;
  1.6207 -    const Sint32 *src = (Sint32 *) cvt->buf;
  1.6208 -    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
  1.6209 -    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
  1.6210 -    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
  1.6211 -    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
  1.6212 -    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
  1.6213 -    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
  1.6214 -    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
  1.6215 -    Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
  1.6216 -    Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
  1.6217 -    Sint32 last_sample0 = sample0;
  1.6218 -    Sint32 last_sample1 = sample1;
  1.6219 -    Sint32 last_sample2 = sample2;
  1.6220 -    Sint32 last_sample3 = sample3;
  1.6221 -    Sint32 last_sample4 = sample4;
  1.6222 -    Sint32 last_sample5 = sample5;
  1.6223 -    Sint32 last_sample6 = sample6;
  1.6224 -    Sint32 last_sample7 = sample7;
  1.6225 -    while (dst < target) {
  1.6226 -        src += 8;
  1.6227 -        eps += dstsize;
  1.6228 -        if ((eps << 1) >= srcsize) {
  1.6229 -            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
  1.6230 -            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
  1.6231 -            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
  1.6232 -            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
  1.6233 -            dst[4] = ((Sint32) SDL_SwapBE32(sample4));
  1.6234 -            dst[5] = ((Sint32) SDL_SwapBE32(sample5));
  1.6235 -            dst[6] = ((Sint32) SDL_SwapBE32(sample6));
  1.6236 -            dst[7] = ((Sint32) SDL_SwapBE32(sample7));
  1.6237 -            dst += 8;
  1.6238 -            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
  1.6239 -            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
  1.6240 -            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
  1.6241 -            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
  1.6242 -            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
  1.6243 -            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
  1.6244 -            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
  1.6245 -            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
  1.6246 -            last_sample0 = sample0;
  1.6247 -            last_sample1 = sample1;
  1.6248 -            last_sample2 = sample2;
  1.6249 -            last_sample3 = sample3;
  1.6250 -            last_sample4 = sample4;
  1.6251 -            last_sample5 = sample5;
  1.6252 -            last_sample6 = sample6;
  1.6253 -            last_sample7 = sample7;
  1.6254 -            eps -= srcsize;
  1.6255 -        }
  1.6256 -    }
  1.6257 -    cvt->len_cvt = dstsize;
  1.6258 -    if (cvt->filters[++cvt->filter_index]) {
  1.6259 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6260 -    }
  1.6261 -}
  1.6262 -
  1.6263 -static void SDLCALL
  1.6264 -SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6265 -{
  1.6266 -#if DEBUG_CONVERT
  1.6267 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
  1.6268 -#endif
  1.6269 -
  1.6270 -    const int srcsize = cvt->len_cvt - 64;
  1.6271 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.6272 -    register int eps = 0;
  1.6273 -    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
  1.6274 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
  1.6275 -    const float *target = ((const float *) cvt->buf);
  1.6276 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6277 -    float last_sample0 = sample0;
  1.6278 -    while (dst >= target) {
  1.6279 -        dst[0] = SDL_SwapFloatLE(sample0);
  1.6280 -        dst--;
  1.6281 -        eps += srcsize;
  1.6282 -        if ((eps << 1) >= dstsize) {
  1.6283 -            src--;
  1.6284 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6285 -            last_sample0 = sample0;
  1.6286 -            eps -= dstsize;
  1.6287 -        }
  1.6288 -    }
  1.6289 -    cvt->len_cvt = dstsize;
  1.6290 -    if (cvt->filters[++cvt->filter_index]) {
  1.6291 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6292 -    }
  1.6293 -}
  1.6294 -
  1.6295 -static void SDLCALL
  1.6296 -SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6297 -{
  1.6298 -#if DEBUG_CONVERT
  1.6299 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
  1.6300 -#endif
  1.6301 -
  1.6302 -    const int srcsize = cvt->len_cvt - 64;
  1.6303 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.6304 -    register int eps = 0;
  1.6305 -    float *dst = (float *) cvt->buf;
  1.6306 -    const float *src = (float *) cvt->buf;
  1.6307 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.6308 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6309 -    float last_sample0 = sample0;
  1.6310 -    while (dst < target) {
  1.6311 -        src++;
  1.6312 -        eps += dstsize;
  1.6313 -        if ((eps << 1) >= srcsize) {
  1.6314 -            dst[0] = SDL_SwapFloatLE(sample0);
  1.6315 -            dst++;
  1.6316 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6317 -            last_sample0 = sample0;
  1.6318 -            eps -= srcsize;
  1.6319 -        }
  1.6320 -    }
  1.6321 -    cvt->len_cvt = dstsize;
  1.6322 -    if (cvt->filters[++cvt->filter_index]) {
  1.6323 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6324 -    }
  1.6325 -}
  1.6326 -
  1.6327 -static void SDLCALL
  1.6328 -SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6329 -{
  1.6330 -#if DEBUG_CONVERT
  1.6331 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
  1.6332 -#endif
  1.6333 -
  1.6334 -    const int srcsize = cvt->len_cvt - 128;
  1.6335 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.6336 -    register int eps = 0;
  1.6337 -    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
  1.6338 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
  1.6339 -    const float *target = ((const float *) cvt->buf);
  1.6340 -    float sample1 = SDL_SwapFloatLE(src[1]);
  1.6341 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6342 -    float last_sample1 = sample1;
  1.6343 -    float last_sample0 = sample0;
  1.6344 -    while (dst >= target) {
  1.6345 -        dst[1] = SDL_SwapFloatLE(sample1);
  1.6346 -        dst[0] = SDL_SwapFloatLE(sample0);
  1.6347 -        dst -= 2;
  1.6348 -        eps += srcsize;
  1.6349 -        if ((eps << 1) >= dstsize) {
  1.6350 -            src -= 2;
  1.6351 -            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6352 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6353 -            last_sample1 = sample1;
  1.6354 -            last_sample0 = sample0;
  1.6355 -            eps -= dstsize;
  1.6356 -        }
  1.6357 -    }
  1.6358 -    cvt->len_cvt = dstsize;
  1.6359 -    if (cvt->filters[++cvt->filter_index]) {
  1.6360 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6361 -    }
  1.6362 -}
  1.6363 -
  1.6364 -static void SDLCALL
  1.6365 -SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6366 -{
  1.6367 -#if DEBUG_CONVERT
  1.6368 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
  1.6369 -#endif
  1.6370 -
  1.6371 -    const int srcsize = cvt->len_cvt - 128;
  1.6372 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.6373 -    register int eps = 0;
  1.6374 -    float *dst = (float *) cvt->buf;
  1.6375 -    const float *src = (float *) cvt->buf;
  1.6376 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.6377 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6378 -    float sample1 = SDL_SwapFloatLE(src[1]);
  1.6379 -    float last_sample0 = sample0;
  1.6380 -    float last_sample1 = sample1;
  1.6381 -    while (dst < target) {
  1.6382 -        src += 2;
  1.6383 -        eps += dstsize;
  1.6384 -        if ((eps << 1) >= srcsize) {
  1.6385 -            dst[0] = SDL_SwapFloatLE(sample0);
  1.6386 -            dst[1] = SDL_SwapFloatLE(sample1);
  1.6387 -            dst += 2;
  1.6388 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6389 -            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6390 -            last_sample0 = sample0;
  1.6391 -            last_sample1 = sample1;
  1.6392 -            eps -= srcsize;
  1.6393 -        }
  1.6394 -    }
  1.6395 -    cvt->len_cvt = dstsize;
  1.6396 -    if (cvt->filters[++cvt->filter_index]) {
  1.6397 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6398 -    }
  1.6399 -}
  1.6400 -
  1.6401 -static void SDLCALL
  1.6402 -SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6403 -{
  1.6404 -#if DEBUG_CONVERT
  1.6405 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
  1.6406 -#endif
  1.6407 -
  1.6408 -    const int srcsize = cvt->len_cvt - 256;
  1.6409 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.6410 -    register int eps = 0;
  1.6411 -    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
  1.6412 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
  1.6413 -    const float *target = ((const float *) cvt->buf);
  1.6414 -    float sample3 = SDL_SwapFloatLE(src[3]);
  1.6415 -    float sample2 = SDL_SwapFloatLE(src[2]);
  1.6416 -    float sample1 = SDL_SwapFloatLE(src[1]);
  1.6417 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6418 -    float last_sample3 = sample3;
  1.6419 -    float last_sample2 = sample2;
  1.6420 -    float last_sample1 = sample1;
  1.6421 -    float last_sample0 = sample0;
  1.6422 -    while (dst >= target) {
  1.6423 -        dst[3] = SDL_SwapFloatLE(sample3);
  1.6424 -        dst[2] = SDL_SwapFloatLE(sample2);
  1.6425 -        dst[1] = SDL_SwapFloatLE(sample1);
  1.6426 -        dst[0] = SDL_SwapFloatLE(sample0);
  1.6427 -        dst -= 4;
  1.6428 -        eps += srcsize;
  1.6429 -        if ((eps << 1) >= dstsize) {
  1.6430 -            src -= 4;
  1.6431 -            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.6432 -            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.6433 -            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6434 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6435 -            last_sample3 = sample3;
  1.6436 -            last_sample2 = sample2;
  1.6437 -            last_sample1 = sample1;
  1.6438 -            last_sample0 = sample0;
  1.6439 -            eps -= dstsize;
  1.6440 -        }
  1.6441 -    }
  1.6442 -    cvt->len_cvt = dstsize;
  1.6443 -    if (cvt->filters[++cvt->filter_index]) {
  1.6444 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6445 -    }
  1.6446 -}
  1.6447 -
  1.6448 -static void SDLCALL
  1.6449 -SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6450 -{
  1.6451 -#if DEBUG_CONVERT
  1.6452 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
  1.6453 -#endif
  1.6454 -
  1.6455 -    const int srcsize = cvt->len_cvt - 256;
  1.6456 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.6457 -    register int eps = 0;
  1.6458 -    float *dst = (float *) cvt->buf;
  1.6459 -    const float *src = (float *) cvt->buf;
  1.6460 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.6461 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6462 -    float sample1 = SDL_SwapFloatLE(src[1]);
  1.6463 -    float sample2 = SDL_SwapFloatLE(src[2]);
  1.6464 -    float sample3 = SDL_SwapFloatLE(src[3]);
  1.6465 -    float last_sample0 = sample0;
  1.6466 -    float last_sample1 = sample1;
  1.6467 -    float last_sample2 = sample2;
  1.6468 -    float last_sample3 = sample3;
  1.6469 -    while (dst < target) {
  1.6470 -        src += 4;
  1.6471 -        eps += dstsize;
  1.6472 -        if ((eps << 1) >= srcsize) {
  1.6473 -            dst[0] = SDL_SwapFloatLE(sample0);
  1.6474 -            dst[1] = SDL_SwapFloatLE(sample1);
  1.6475 -            dst[2] = SDL_SwapFloatLE(sample2);
  1.6476 -            dst[3] = SDL_SwapFloatLE(sample3);
  1.6477 -            dst += 4;
  1.6478 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6479 -            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6480 -            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.6481 -            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.6482 -            last_sample0 = sample0;
  1.6483 -            last_sample1 = sample1;
  1.6484 -            last_sample2 = sample2;
  1.6485 -            last_sample3 = sample3;
  1.6486 -            eps -= srcsize;
  1.6487 -        }
  1.6488 -    }
  1.6489 -    cvt->len_cvt = dstsize;
  1.6490 -    if (cvt->filters[++cvt->filter_index]) {
  1.6491 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6492 -    }
  1.6493 -}
  1.6494 -
  1.6495 -static void SDLCALL
  1.6496 -SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6497 -{
  1.6498 -#if DEBUG_CONVERT
  1.6499 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
  1.6500 -#endif
  1.6501 -
  1.6502 -    const int srcsize = cvt->len_cvt - 384;
  1.6503 -    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
  1.6504 -    register int eps = 0;
  1.6505 -    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
  1.6506 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
  1.6507 -    const float *target = ((const float *) cvt->buf);
  1.6508 -    float sample5 = SDL_SwapFloatLE(src[5]);
  1.6509 -    float sample4 = SDL_SwapFloatLE(src[4]);
  1.6510 -    float sample3 = SDL_SwapFloatLE(src[3]);
  1.6511 -    float sample2 = SDL_SwapFloatLE(src[2]);
  1.6512 -    float sample1 = SDL_SwapFloatLE(src[1]);
  1.6513 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6514 -    float last_sample5 = sample5;
  1.6515 -    float last_sample4 = sample4;
  1.6516 -    float last_sample3 = sample3;
  1.6517 -    float last_sample2 = sample2;
  1.6518 -    float last_sample1 = sample1;
  1.6519 -    float last_sample0 = sample0;
  1.6520 -    while (dst >= target) {
  1.6521 -        dst[5] = SDL_SwapFloatLE(sample5);
  1.6522 -        dst[4] = SDL_SwapFloatLE(sample4);
  1.6523 -        dst[3] = SDL_SwapFloatLE(sample3);
  1.6524 -        dst[2] = SDL_SwapFloatLE(sample2);
  1.6525 -        dst[1] = SDL_SwapFloatLE(sample1);
  1.6526 -        dst[0] = SDL_SwapFloatLE(sample0);
  1.6527 -        dst -= 6;
  1.6528 -        eps += srcsize;
  1.6529 -        if ((eps << 1) >= dstsize) {
  1.6530 -            src -= 6;
  1.6531 -            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
  1.6532 -            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
  1.6533 -            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.6534 -            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.6535 -            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6536 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6537 -            last_sample5 = sample5;
  1.6538 -            last_sample4 = sample4;
  1.6539 -            last_sample3 = sample3;
  1.6540 -            last_sample2 = sample2;
  1.6541 -            last_sample1 = sample1;
  1.6542 -            last_sample0 = sample0;
  1.6543 -            eps -= dstsize;
  1.6544 -        }
  1.6545 -    }
  1.6546 -    cvt->len_cvt = dstsize;
  1.6547 -    if (cvt->filters[++cvt->filter_index]) {
  1.6548 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6549 -    }
  1.6550 -}
  1.6551 -
  1.6552 -static void SDLCALL
  1.6553 -SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6554 -{
  1.6555 -#if DEBUG_CONVERT
  1.6556 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
  1.6557 -#endif
  1.6558 -
  1.6559 -    const int srcsize = cvt->len_cvt - 384;
  1.6560 -    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
  1.6561 -    register int eps = 0;
  1.6562 -    float *dst = (float *) cvt->buf;
  1.6563 -    const float *src = (float *) cvt->buf;
  1.6564 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.6565 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6566 -    float sample1 = SDL_SwapFloatLE(src[1]);
  1.6567 -    float sample2 = SDL_SwapFloatLE(src[2]);
  1.6568 -    float sample3 = SDL_SwapFloatLE(src[3]);
  1.6569 -    float sample4 = SDL_SwapFloatLE(src[4]);
  1.6570 -    float sample5 = SDL_SwapFloatLE(src[5]);
  1.6571 -    float last_sample0 = sample0;
  1.6572 -    float last_sample1 = sample1;
  1.6573 -    float last_sample2 = sample2;
  1.6574 -    float last_sample3 = sample3;
  1.6575 -    float last_sample4 = sample4;
  1.6576 -    float last_sample5 = sample5;
  1.6577 -    while (dst < target) {
  1.6578 -        src += 6;
  1.6579 -        eps += dstsize;
  1.6580 -        if ((eps << 1) >= srcsize) {
  1.6581 -            dst[0] = SDL_SwapFloatLE(sample0);
  1.6582 -            dst[1] = SDL_SwapFloatLE(sample1);
  1.6583 -            dst[2] = SDL_SwapFloatLE(sample2);
  1.6584 -            dst[3] = SDL_SwapFloatLE(sample3);
  1.6585 -            dst[4] = SDL_SwapFloatLE(sample4);
  1.6586 -            dst[5] = SDL_SwapFloatLE(sample5);
  1.6587 -            dst += 6;
  1.6588 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6589 -            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6590 -            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.6591 -            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.6592 -            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
  1.6593 -            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
  1.6594 -            last_sample0 = sample0;
  1.6595 -            last_sample1 = sample1;
  1.6596 -            last_sample2 = sample2;
  1.6597 -            last_sample3 = sample3;
  1.6598 -            last_sample4 = sample4;
  1.6599 -            last_sample5 = sample5;
  1.6600 -            eps -= srcsize;
  1.6601 -        }
  1.6602 -    }
  1.6603 -    cvt->len_cvt = dstsize;
  1.6604 -    if (cvt->filters[++cvt->filter_index]) {
  1.6605 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6606 -    }
  1.6607 -}
  1.6608 -
  1.6609 -static void SDLCALL
  1.6610 -SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6611 -{
  1.6612 -#if DEBUG_CONVERT
  1.6613 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
  1.6614 -#endif
  1.6615 -
  1.6616 -    const int srcsize = cvt->len_cvt - 512;
  1.6617 -    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
  1.6618 -    register int eps = 0;
  1.6619 -    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
  1.6620 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
  1.6621 -    const float *target = ((const float *) cvt->buf);
  1.6622 -    float sample7 = SDL_SwapFloatLE(src[7]);
  1.6623 -    float sample6 = SDL_SwapFloatLE(src[6]);
  1.6624 -    float sample5 = SDL_SwapFloatLE(src[5]);
  1.6625 -    float sample4 = SDL_SwapFloatLE(src[4]);
  1.6626 -    float sample3 = SDL_SwapFloatLE(src[3]);
  1.6627 -    float sample2 = SDL_SwapFloatLE(src[2]);
  1.6628 -    float sample1 = SDL_SwapFloatLE(src[1]);
  1.6629 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6630 -    float last_sample7 = sample7;
  1.6631 -    float last_sample6 = sample6;
  1.6632 -    float last_sample5 = sample5;
  1.6633 -    float last_sample4 = sample4;
  1.6634 -    float last_sample3 = sample3;
  1.6635 -    float last_sample2 = sample2;
  1.6636 -    float last_sample1 = sample1;
  1.6637 -    float last_sample0 = sample0;
  1.6638 -    while (dst >= target) {
  1.6639 -        dst[7] = SDL_SwapFloatLE(sample7);
  1.6640 -        dst[6] = SDL_SwapFloatLE(sample6);
  1.6641 -        dst[5] = SDL_SwapFloatLE(sample5);
  1.6642 -        dst[4] = SDL_SwapFloatLE(sample4);
  1.6643 -        dst[3] = SDL_SwapFloatLE(sample3);
  1.6644 -        dst[2] = SDL_SwapFloatLE(sample2);
  1.6645 -        dst[1] = SDL_SwapFloatLE(sample1);
  1.6646 -        dst[0] = SDL_SwapFloatLE(sample0);
  1.6647 -        dst -= 8;
  1.6648 -        eps += srcsize;
  1.6649 -        if ((eps << 1) >= dstsize) {
  1.6650 -            src -= 8;
  1.6651 -            sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
  1.6652 -            sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
  1.6653 -            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
  1.6654 -            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
  1.6655 -            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.6656 -            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.6657 -            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6658 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6659 -            last_sample7 = sample7;
  1.6660 -            last_sample6 = sample6;
  1.6661 -            last_sample5 = sample5;
  1.6662 -            last_sample4 = sample4;
  1.6663 -            last_sample3 = sample3;
  1.6664 -            last_sample2 = sample2;
  1.6665 -            last_sample1 = sample1;
  1.6666 -            last_sample0 = sample0;
  1.6667 -            eps -= dstsize;
  1.6668 -        }
  1.6669 -    }
  1.6670 -    cvt->len_cvt = dstsize;
  1.6671 -    if (cvt->filters[++cvt->filter_index]) {
  1.6672 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6673 -    }
  1.6674 -}
  1.6675 -
  1.6676 -static void SDLCALL
  1.6677 -SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6678 -{
  1.6679 -#if DEBUG_CONVERT
  1.6680 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
  1.6681 -#endif
  1.6682 -
  1.6683 -    const int srcsize = cvt->len_cvt - 512;
  1.6684 -    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
  1.6685 -    register int eps = 0;
  1.6686 -    float *dst = (float *) cvt->buf;
  1.6687 -    const float *src = (float *) cvt->buf;
  1.6688 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.6689 -    float sample0 = SDL_SwapFloatLE(src[0]);
  1.6690 -    float sample1 = SDL_SwapFloatLE(src[1]);
  1.6691 -    float sample2 = SDL_SwapFloatLE(src[2]);
  1.6692 -    float sample3 = SDL_SwapFloatLE(src[3]);
  1.6693 -    float sample4 = SDL_SwapFloatLE(src[4]);
  1.6694 -    float sample5 = SDL_SwapFloatLE(src[5]);
  1.6695 -    float sample6 = SDL_SwapFloatLE(src[6]);
  1.6696 -    float sample7 = SDL_SwapFloatLE(src[7]);
  1.6697 -    float last_sample0 = sample0;
  1.6698 -    float last_sample1 = sample1;
  1.6699 -    float last_sample2 = sample2;
  1.6700 -    float last_sample3 = sample3;
  1.6701 -    float last_sample4 = sample4;
  1.6702 -    float last_sample5 = sample5;
  1.6703 -    float last_sample6 = sample6;
  1.6704 -    float last_sample7 = sample7;
  1.6705 -    while (dst < target) {
  1.6706 -        src += 8;
  1.6707 -        eps += dstsize;
  1.6708 -        if ((eps << 1) >= srcsize) {
  1.6709 -            dst[0] = SDL_SwapFloatLE(sample0);
  1.6710 -            dst[1] = SDL_SwapFloatLE(sample1);
  1.6711 -            dst[2] = SDL_SwapFloatLE(sample2);
  1.6712 -            dst[3] = SDL_SwapFloatLE(sample3);
  1.6713 -            dst[4] = SDL_SwapFloatLE(sample4);
  1.6714 -            dst[5] = SDL_SwapFloatLE(sample5);
  1.6715 -            dst[6] = SDL_SwapFloatLE(sample6);
  1.6716 -            dst[7] = SDL_SwapFloatLE(sample7);
  1.6717 -            dst += 8;
  1.6718 -            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6719 -            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6720 -            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
  1.6721 -            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
  1.6722 -            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
  1.6723 -            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
  1.6724 -            sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
  1.6725 -            sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
  1.6726 -            last_sample0 = sample0;
  1.6727 -            last_sample1 = sample1;
  1.6728 -            last_sample2 = sample2;
  1.6729 -            last_sample3 = sample3;
  1.6730 -            last_sample4 = sample4;
  1.6731 -            last_sample5 = sample5;
  1.6732 -            last_sample6 = sample6;
  1.6733 -            last_sample7 = sample7;
  1.6734 -            eps -= srcsize;
  1.6735 -        }
  1.6736 -    }
  1.6737 -    cvt->len_cvt = dstsize;
  1.6738 -    if (cvt->filters[++cvt->filter_index]) {
  1.6739 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6740 -    }
  1.6741 -}
  1.6742 -
  1.6743 -static void SDLCALL
  1.6744 -SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6745 -{
  1.6746 -#if DEBUG_CONVERT
  1.6747 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
  1.6748 -#endif
  1.6749 -
  1.6750 -    const int srcsize = cvt->len_cvt - 64;
  1.6751 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.6752 -    register int eps = 0;
  1.6753 -    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
  1.6754 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
  1.6755 -    const float *target = ((const float *) cvt->buf);
  1.6756 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.6757 -    float last_sample0 = sample0;
  1.6758 -    while (dst >= target) {
  1.6759 -        dst[0] = SDL_SwapFloatBE(sample0);
  1.6760 -        dst--;
  1.6761 -        eps += srcsize;
  1.6762 -        if ((eps << 1) >= dstsize) {
  1.6763 -            src--;
  1.6764 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6765 -            last_sample0 = sample0;
  1.6766 -            eps -= dstsize;
  1.6767 -        }
  1.6768 -    }
  1.6769 -    cvt->len_cvt = dstsize;
  1.6770 -    if (cvt->filters[++cvt->filter_index]) {
  1.6771 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6772 -    }
  1.6773 -}
  1.6774 -
  1.6775 -static void SDLCALL
  1.6776 -SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6777 -{
  1.6778 -#if DEBUG_CONVERT
  1.6779 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
  1.6780 -#endif
  1.6781 -
  1.6782 -    const int srcsize = cvt->len_cvt - 64;
  1.6783 -    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
  1.6784 -    register int eps = 0;
  1.6785 -    float *dst = (float *) cvt->buf;
  1.6786 -    const float *src = (float *) cvt->buf;
  1.6787 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.6788 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.6789 -    float last_sample0 = sample0;
  1.6790 -    while (dst < target) {
  1.6791 -        src++;
  1.6792 -        eps += dstsize;
  1.6793 -        if ((eps << 1) >= srcsize) {
  1.6794 -            dst[0] = SDL_SwapFloatBE(sample0);
  1.6795 -            dst++;
  1.6796 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6797 -            last_sample0 = sample0;
  1.6798 -            eps -= srcsize;
  1.6799 -        }
  1.6800 -    }
  1.6801 -    cvt->len_cvt = dstsize;
  1.6802 -    if (cvt->filters[++cvt->filter_index]) {
  1.6803 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6804 -    }
  1.6805 -}
  1.6806 -
  1.6807 -static void SDLCALL
  1.6808 -SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6809 -{
  1.6810 -#if DEBUG_CONVERT
  1.6811 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
  1.6812 -#endif
  1.6813 -
  1.6814 -    const int srcsize = cvt->len_cvt - 128;
  1.6815 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.6816 -    register int eps = 0;
  1.6817 -    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
  1.6818 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
  1.6819 -    const float *target = ((const float *) cvt->buf);
  1.6820 -    float sample1 = SDL_SwapFloatBE(src[1]);
  1.6821 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.6822 -    float last_sample1 = sample1;
  1.6823 -    float last_sample0 = sample0;
  1.6824 -    while (dst >= target) {
  1.6825 -        dst[1] = SDL_SwapFloatBE(sample1);
  1.6826 -        dst[0] = SDL_SwapFloatBE(sample0);
  1.6827 -        dst -= 2;
  1.6828 -        eps += srcsize;
  1.6829 -        if ((eps << 1) >= dstsize) {
  1.6830 -            src -= 2;
  1.6831 -            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6832 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6833 -            last_sample1 = sample1;
  1.6834 -            last_sample0 = sample0;
  1.6835 -            eps -= dstsize;
  1.6836 -        }
  1.6837 -    }
  1.6838 -    cvt->len_cvt = dstsize;
  1.6839 -    if (cvt->filters[++cvt->filter_index]) {
  1.6840 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6841 -    }
  1.6842 -}
  1.6843 -
  1.6844 -static void SDLCALL
  1.6845 -SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6846 -{
  1.6847 -#if DEBUG_CONVERT
  1.6848 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
  1.6849 -#endif
  1.6850 -
  1.6851 -    const int srcsize = cvt->len_cvt - 128;
  1.6852 -    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
  1.6853 -    register int eps = 0;
  1.6854 -    float *dst = (float *) cvt->buf;
  1.6855 -    const float *src = (float *) cvt->buf;
  1.6856 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.6857 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.6858 -    float sample1 = SDL_SwapFloatBE(src[1]);
  1.6859 -    float last_sample0 = sample0;
  1.6860 -    float last_sample1 = sample1;
  1.6861 -    while (dst < target) {
  1.6862 -        src += 2;
  1.6863 -        eps += dstsize;
  1.6864 -        if ((eps << 1) >= srcsize) {
  1.6865 -            dst[0] = SDL_SwapFloatBE(sample0);
  1.6866 -            dst[1] = SDL_SwapFloatBE(sample1);
  1.6867 -            dst += 2;
  1.6868 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6869 -            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6870 -            last_sample0 = sample0;
  1.6871 -            last_sample1 = sample1;
  1.6872 -            eps -= srcsize;
  1.6873 -        }
  1.6874 -    }
  1.6875 -    cvt->len_cvt = dstsize;
  1.6876 -    if (cvt->filters[++cvt->filter_index]) {
  1.6877 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6878 -    }
  1.6879 -}
  1.6880 -
  1.6881 -static void SDLCALL
  1.6882 -SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6883 -{
  1.6884 -#if DEBUG_CONVERT
  1.6885 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
  1.6886 -#endif
  1.6887 -
  1.6888 -    const int srcsize = cvt->len_cvt - 256;
  1.6889 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.6890 -    register int eps = 0;
  1.6891 -    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
  1.6892 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
  1.6893 -    const float *target = ((const float *) cvt->buf);
  1.6894 -    float sample3 = SDL_SwapFloatBE(src[3]);
  1.6895 -    float sample2 = SDL_SwapFloatBE(src[2]);
  1.6896 -    float sample1 = SDL_SwapFloatBE(src[1]);
  1.6897 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.6898 -    float last_sample3 = sample3;
  1.6899 -    float last_sample2 = sample2;
  1.6900 -    float last_sample1 = sample1;
  1.6901 -    float last_sample0 = sample0;
  1.6902 -    while (dst >= target) {
  1.6903 -        dst[3] = SDL_SwapFloatBE(sample3);
  1.6904 -        dst[2] = SDL_SwapFloatBE(sample2);
  1.6905 -        dst[1] = SDL_SwapFloatBE(sample1);
  1.6906 -        dst[0] = SDL_SwapFloatBE(sample0);
  1.6907 -        dst -= 4;
  1.6908 -        eps += srcsize;
  1.6909 -        if ((eps << 1) >= dstsize) {
  1.6910 -            src -= 4;
  1.6911 -            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.6912 -            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.6913 -            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6914 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6915 -            last_sample3 = sample3;
  1.6916 -            last_sample2 = sample2;
  1.6917 -            last_sample1 = sample1;
  1.6918 -            last_sample0 = sample0;
  1.6919 -            eps -= dstsize;
  1.6920 -        }
  1.6921 -    }
  1.6922 -    cvt->len_cvt = dstsize;
  1.6923 -    if (cvt->filters[++cvt->filter_index]) {
  1.6924 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6925 -    }
  1.6926 -}
  1.6927 -
  1.6928 -static void SDLCALL
  1.6929 -SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6930 -{
  1.6931 -#if DEBUG_CONVERT
  1.6932 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
  1.6933 -#endif
  1.6934 -
  1.6935 -    const int srcsize = cvt->len_cvt - 256;
  1.6936 -    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
  1.6937 -    register int eps = 0;
  1.6938 -    float *dst = (float *) cvt->buf;
  1.6939 -    const float *src = (float *) cvt->buf;
  1.6940 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.6941 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.6942 -    float sample1 = SDL_SwapFloatBE(src[1]);
  1.6943 -    float sample2 = SDL_SwapFloatBE(src[2]);
  1.6944 -    float sample3 = SDL_SwapFloatBE(src[3]);
  1.6945 -    float last_sample0 = sample0;
  1.6946 -    float last_sample1 = sample1;
  1.6947 -    float last_sample2 = sample2;
  1.6948 -    float last_sample3 = sample3;
  1.6949 -    while (dst < target) {
  1.6950 -        src += 4;
  1.6951 -        eps += dstsize;
  1.6952 -        if ((eps << 1) >= srcsize) {
  1.6953 -            dst[0] = SDL_SwapFloatBE(sample0);
  1.6954 -            dst[1] = SDL_SwapFloatBE(sample1);
  1.6955 -            dst[2] = SDL_SwapFloatBE(sample2);
  1.6956 -            dst[3] = SDL_SwapFloatBE(sample3);
  1.6957 -            dst += 4;
  1.6958 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.6959 -            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.6960 -            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.6961 -            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.6962 -            last_sample0 = sample0;
  1.6963 -            last_sample1 = sample1;
  1.6964 -            last_sample2 = sample2;
  1.6965 -            last_sample3 = sample3;
  1.6966 -            eps -= srcsize;
  1.6967 -        }
  1.6968 -    }
  1.6969 -    cvt->len_cvt = dstsize;
  1.6970 -    if (cvt->filters[++cvt->filter_index]) {
  1.6971 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.6972 -    }
  1.6973 -}
  1.6974 -
  1.6975 -static void SDLCALL
  1.6976 -SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.6977 -{
  1.6978 -#if DEBUG_CONVERT
  1.6979 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
  1.6980 -#endif
  1.6981 -
  1.6982 -    const int srcsize = cvt->len_cvt - 384;
  1.6983 -    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
  1.6984 -    register int eps = 0;
  1.6985 -    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
  1.6986 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
  1.6987 -    const float *target = ((const float *) cvt->buf);
  1.6988 -    float sample5 = SDL_SwapFloatBE(src[5]);
  1.6989 -    float sample4 = SDL_SwapFloatBE(src[4]);
  1.6990 -    float sample3 = SDL_SwapFloatBE(src[3]);
  1.6991 -    float sample2 = SDL_SwapFloatBE(src[2]);
  1.6992 -    float sample1 = SDL_SwapFloatBE(src[1]);
  1.6993 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.6994 -    float last_sample5 = sample5;
  1.6995 -    float last_sample4 = sample4;
  1.6996 -    float last_sample3 = sample3;
  1.6997 -    float last_sample2 = sample2;
  1.6998 -    float last_sample1 = sample1;
  1.6999 -    float last_sample0 = sample0;
  1.7000 -    while (dst >= target) {
  1.7001 -        dst[5] = SDL_SwapFloatBE(sample5);
  1.7002 -        dst[4] = SDL_SwapFloatBE(sample4);
  1.7003 -        dst[3] = SDL_SwapFloatBE(sample3);
  1.7004 -        dst[2] = SDL_SwapFloatBE(sample2);
  1.7005 -        dst[1] = SDL_SwapFloatBE(sample1);
  1.7006 -        dst[0] = SDL_SwapFloatBE(sample0);
  1.7007 -        dst -= 6;
  1.7008 -        eps += srcsize;
  1.7009 -        if ((eps << 1) >= dstsize) {
  1.7010 -            src -= 6;
  1.7011 -            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
  1.7012 -            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
  1.7013 -            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.7014 -            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.7015 -            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.7016 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.7017 -            last_sample5 = sample5;
  1.7018 -            last_sample4 = sample4;
  1.7019 -            last_sample3 = sample3;
  1.7020 -            last_sample2 = sample2;
  1.7021 -            last_sample1 = sample1;
  1.7022 -            last_sample0 = sample0;
  1.7023 -            eps -= dstsize;
  1.7024 -        }
  1.7025 -    }
  1.7026 -    cvt->len_cvt = dstsize;
  1.7027 -    if (cvt->filters[++cvt->filter_index]) {
  1.7028 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7029 -    }
  1.7030 -}
  1.7031 -
  1.7032 -static void SDLCALL
  1.7033 -SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7034 -{
  1.7035 -#if DEBUG_CONVERT
  1.7036 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
  1.7037 -#endif
  1.7038 -
  1.7039 -    const int srcsize = cvt->len_cvt - 384;
  1.7040 -    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
  1.7041 -    register int eps = 0;
  1.7042 -    float *dst = (float *) cvt->buf;
  1.7043 -    const float *src = (float *) cvt->buf;
  1.7044 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.7045 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.7046 -    float sample1 = SDL_SwapFloatBE(src[1]);
  1.7047 -    float sample2 = SDL_SwapFloatBE(src[2]);
  1.7048 -    float sample3 = SDL_SwapFloatBE(src[3]);
  1.7049 -    float sample4 = SDL_SwapFloatBE(src[4]);
  1.7050 -    float sample5 = SDL_SwapFloatBE(src[5]);
  1.7051 -    float last_sample0 = sample0;
  1.7052 -    float last_sample1 = sample1;
  1.7053 -    float last_sample2 = sample2;
  1.7054 -    float last_sample3 = sample3;
  1.7055 -    float last_sample4 = sample4;
  1.7056 -    float last_sample5 = sample5;
  1.7057 -    while (dst < target) {
  1.7058 -        src += 6;
  1.7059 -        eps += dstsize;
  1.7060 -        if ((eps << 1) >= srcsize) {
  1.7061 -            dst[0] = SDL_SwapFloatBE(sample0);
  1.7062 -            dst[1] = SDL_SwapFloatBE(sample1);
  1.7063 -            dst[2] = SDL_SwapFloatBE(sample2);
  1.7064 -            dst[3] = SDL_SwapFloatBE(sample3);
  1.7065 -            dst[4] = SDL_SwapFloatBE(sample4);
  1.7066 -            dst[5] = SDL_SwapFloatBE(sample5);
  1.7067 -            dst += 6;
  1.7068 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.7069 -            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.7070 -            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.7071 -            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.7072 -            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
  1.7073 -            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
  1.7074 -            last_sample0 = sample0;
  1.7075 -            last_sample1 = sample1;
  1.7076 -            last_sample2 = sample2;
  1.7077 -            last_sample3 = sample3;
  1.7078 -            last_sample4 = sample4;
  1.7079 -            last_sample5 = sample5;
  1.7080 -            eps -= srcsize;
  1.7081 -        }
  1.7082 -    }
  1.7083 -    cvt->len_cvt = dstsize;
  1.7084 -    if (cvt->filters[++cvt->filter_index]) {
  1.7085 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7086 -    }
  1.7087 -}
  1.7088 -
  1.7089 -static void SDLCALL
  1.7090 -SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7091 -{
  1.7092 -#if DEBUG_CONVERT
  1.7093 -    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
  1.7094 -#endif
  1.7095 -
  1.7096 -    const int srcsize = cvt->len_cvt - 512;
  1.7097 -    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
  1.7098 -    register int eps = 0;
  1.7099 -    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
  1.7100 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
  1.7101 -    const float *target = ((const float *) cvt->buf);
  1.7102 -    float sample7 = SDL_SwapFloatBE(src[7]);
  1.7103 -    float sample6 = SDL_SwapFloatBE(src[6]);
  1.7104 -    float sample5 = SDL_SwapFloatBE(src[5]);
  1.7105 -    float sample4 = SDL_SwapFloatBE(src[4]);
  1.7106 -    float sample3 = SDL_SwapFloatBE(src[3]);
  1.7107 -    float sample2 = SDL_SwapFloatBE(src[2]);
  1.7108 -    float sample1 = SDL_SwapFloatBE(src[1]);
  1.7109 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.7110 -    float last_sample7 = sample7;
  1.7111 -    float last_sample6 = sample6;
  1.7112 -    float last_sample5 = sample5;
  1.7113 -    float last_sample4 = sample4;
  1.7114 -    float last_sample3 = sample3;
  1.7115 -    float last_sample2 = sample2;
  1.7116 -    float last_sample1 = sample1;
  1.7117 -    float last_sample0 = sample0;
  1.7118 -    while (dst >= target) {
  1.7119 -        dst[7] = SDL_SwapFloatBE(sample7);
  1.7120 -        dst[6] = SDL_SwapFloatBE(sample6);
  1.7121 -        dst[5] = SDL_SwapFloatBE(sample5);
  1.7122 -        dst[4] = SDL_SwapFloatBE(sample4);
  1.7123 -        dst[3] = SDL_SwapFloatBE(sample3);
  1.7124 -        dst[2] = SDL_SwapFloatBE(sample2);
  1.7125 -        dst[1] = SDL_SwapFloatBE(sample1);
  1.7126 -        dst[0] = SDL_SwapFloatBE(sample0);
  1.7127 -        dst -= 8;
  1.7128 -        eps += srcsize;
  1.7129 -        if ((eps << 1) >= dstsize) {
  1.7130 -            src -= 8;
  1.7131 -            sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
  1.7132 -            sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
  1.7133 -            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
  1.7134 -            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
  1.7135 -            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.7136 -            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.7137 -            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.7138 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.7139 -            last_sample7 = sample7;
  1.7140 -            last_sample6 = sample6;
  1.7141 -            last_sample5 = sample5;
  1.7142 -            last_sample4 = sample4;
  1.7143 -            last_sample3 = sample3;
  1.7144 -            last_sample2 = sample2;
  1.7145 -            last_sample1 = sample1;
  1.7146 -            last_sample0 = sample0;
  1.7147 -            eps -= dstsize;
  1.7148 -        }
  1.7149 -    }
  1.7150 -    cvt->len_cvt = dstsize;
  1.7151 -    if (cvt->filters[++cvt->filter_index]) {
  1.7152 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7153 -    }
  1.7154 -}
  1.7155 -
  1.7156 -static void SDLCALL
  1.7157 -SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7158 -{
  1.7159 -#if DEBUG_CONVERT
  1.7160 -    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
  1.7161 -#endif
  1.7162 -
  1.7163 -    const int srcsize = cvt->len_cvt - 512;
  1.7164 -    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
  1.7165 -    register int eps = 0;
  1.7166 -    float *dst = (float *) cvt->buf;
  1.7167 -    const float *src = (float *) cvt->buf;
  1.7168 -    const float *target = (const float *) (cvt->buf + dstsize);
  1.7169 -    float sample0 = SDL_SwapFloatBE(src[0]);
  1.7170 -    float sample1 = SDL_SwapFloatBE(src[1]);
  1.7171 -    float sample2 = SDL_SwapFloatBE(src[2]);
  1.7172 -    float sample3 = SDL_SwapFloatBE(src[3]);
  1.7173 -    float sample4 = SDL_SwapFloatBE(src[4]);
  1.7174 -    float sample5 = SDL_SwapFloatBE(src[5]);
  1.7175 -    float sample6 = SDL_SwapFloatBE(src[6]);
  1.7176 -    float sample7 = SDL_SwapFloatBE(src[7]);
  1.7177 -    float last_sample0 = sample0;
  1.7178 -    float last_sample1 = sample1;
  1.7179 -    float last_sample2 = sample2;
  1.7180 -    float last_sample3 = sample3;
  1.7181 -    float last_sample4 = sample4;
  1.7182 -    float last_sample5 = sample5;
  1.7183 -    float last_sample6 = sample6;
  1.7184 -    float last_sample7 = sample7;
  1.7185 -    while (dst < target) {
  1.7186 -        src += 8;
  1.7187 -        eps += dstsize;
  1.7188 -        if ((eps << 1) >= srcsize) {
  1.7189 -            dst[0] = SDL_SwapFloatBE(sample0);
  1.7190 -            dst[1] = SDL_SwapFloatBE(sample1);
  1.7191 -            dst[2] = SDL_SwapFloatBE(sample2);
  1.7192 -            dst[3] = SDL_SwapFloatBE(sample3);
  1.7193 -            dst[4] = SDL_SwapFloatBE(sample4);
  1.7194 -            dst[5] = SDL_SwapFloatBE(sample5);
  1.7195 -            dst[6] = SDL_SwapFloatBE(sample6);
  1.7196 -            dst[7] = SDL_SwapFloatBE(sample7);
  1.7197 -            dst += 8;
  1.7198 -            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
  1.7199 -            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
  1.7200 -            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
  1.7201 -            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
  1.7202 -            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
  1.7203 -            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
  1.7204 -            sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
  1.7205 -            sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
  1.7206 -            last_sample0 = sample0;
  1.7207 -            last_sample1 = sample1;
  1.7208 -            last_sample2 = sample2;
  1.7209 -            last_sample3 = sample3;
  1.7210 -            last_sample4 = sample4;
  1.7211 -            last_sample5 = sample5;
  1.7212 -            last_sample6 = sample6;
  1.7213 -            last_sample7 = sample7;
  1.7214 -            eps -= srcsize;
  1.7215 -        }
  1.7216 -    }
  1.7217 -    cvt->len_cvt = dstsize;
  1.7218 -    if (cvt->filters[++cvt->filter_index]) {
  1.7219 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7220 -    }
  1.7221 -}
  1.7222 -
  1.7223 -
  1.7224 -#if !LESS_RESAMPLERS
  1.7225 -
  1.7226 -static void SDLCALL
  1.7227 -SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7228 -{
  1.7229 -#if DEBUG_CONVERT
  1.7230 -    fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n");
  1.7231 -#endif
  1.7232 -
  1.7233 -    const int dstsize = cvt->len_cvt * 2;
  1.7234 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2;
  1.7235 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.7236 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.7237 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7238 -    while (dst >= target) {
  1.7239 -        const Sint16 sample0 = (Sint16) src[0];
  1.7240 -        src--;
  1.7241 -        dst[1] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7242 -        dst[0] = (Uint8) sample0;
  1.7243 -        last_sample0 = sample0;
  1.7244 -        dst -= 2;
  1.7245 -    }
  1.7246  
  1.7247      cvt->len_cvt = dstsize;
  1.7248      if (cvt->filters[++cvt->filter_index]) {
  1.7249 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7250 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
  1.7251      }
  1.7252  }
  1.7253  
  1.7254 -static void SDLCALL
  1.7255 -SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7256 +void
  1.7257 +SDL_Upsample_x2(SDL_AudioCVT *cvt, const int channels)
  1.7258  {
  1.7259 +    const int dstsize = cvt->len_cvt * 2;
  1.7260 +    float *dst = ((float *) (cvt->buf + dstsize)) - (channels * 2);
  1.7261 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - channels;
  1.7262 +    const float *target = ((const float *) cvt->buf);
  1.7263 +    const size_t cpy = sizeof (float) * channels;
  1.7264 +    float last_sample[8];
  1.7265 +    int i;
  1.7266 +
  1.7267  #if DEBUG_CONVERT
  1.7268 -    fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n");
  1.7269 +    fprintf(stderr, "Upsample (x2), %d channels.\n", channels);
  1.7270  #endif
  1.7271  
  1.7272 -    const int dstsize = cvt->len_cvt / 2;
  1.7273 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.7274 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.7275 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.7276 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7277 -    while (dst < target) {
  1.7278 -        const Sint16 sample0 = (Sint16) src[0];
  1.7279 -        src += 2;
  1.7280 -        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7281 -        last_sample0 = sample0;
  1.7282 -        dst++;
  1.7283 +    SDL_assert(channels <= 8);
  1.7284 +    SDL_memcpy(last_sample, src, cpy);
  1.7285 +
  1.7286 +    while (dst >= target) {
  1.7287 +        for (i = 0; i < channels; i++) {
  1.7288 +            dst[i] = (float) ((((double)src[i]) + ((double)last_sample[i])) * 0.5);
  1.7289 +        }
  1.7290 +        dst -= channels;
  1.7291 +        SDL_memcpy(dst, src, cpy);
  1.7292 +        SDL_memcpy(last_sample, src, cpy);
  1.7293 +        src -= channels;
  1.7294 +        dst -= channels;
  1.7295      }
  1.7296  
  1.7297      cvt->len_cvt = dstsize;
  1.7298      if (cvt->filters[++cvt->filter_index]) {
  1.7299 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7300 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
  1.7301      }
  1.7302  }
  1.7303  
  1.7304 -static void SDLCALL
  1.7305 -SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7306 +void
  1.7307 +SDL_Upsample_x4(SDL_AudioCVT *cvt, const int channels)
  1.7308  {
  1.7309 +    const int dstsize = cvt->len_cvt * 4;
  1.7310 +    float *dst = ((float *) (cvt->buf + dstsize)) - (channels * 4);
  1.7311 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - channels;
  1.7312 +    const float *target = ((const float *) cvt->buf);
  1.7313 +    const size_t cpy = sizeof (float) * channels;
  1.7314 +    float last_sample[8];
  1.7315 +    int i;
  1.7316 +
  1.7317  #if DEBUG_CONVERT
  1.7318 -    fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n");
  1.7319 +    fprintf(stderr, "Upsample (x4), %d channels.\n", channels);
  1.7320  #endif
  1.7321  
  1.7322 -    const int dstsize = cvt->len_cvt * 4;
  1.7323 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4;
  1.7324 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
  1.7325 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.7326 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7327 +    SDL_assert(channels <= 8);
  1.7328 +    SDL_memcpy(last_sample, src, cpy);
  1.7329 +
  1.7330      while (dst >= target) {
  1.7331 -        const Sint16 sample0 = (Sint16) src[0];
  1.7332 -        src--;
  1.7333 -        dst[3] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.7334 -        dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7335 -        dst[1] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
  1.7336 -        dst[0] = (Uint8) sample0;
  1.7337 -        last_sample0 = sample0;
  1.7338 -        dst -= 4;
  1.7339 +        for (i = 0; i < channels; i++) {
  1.7340 +            dst[i] = (float) ((((double) src[i]) + (3.0 * ((double) last_sample[i]))) * 0.25);
  1.7341 +        }
  1.7342 +        dst -= channels;
  1.7343 +        for (i = 0; i < channels; i++) {
  1.7344 +            dst[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.25);
  1.7345 +        }
  1.7346 +        dst -= channels;
  1.7347 +        for (i = 0; i < channels; i++) {
  1.7348 +            dst[i] = (float) (((3.0 * ((double) src[i])) + ((double) last_sample[i])) * 0.25);
  1.7349 +        }
  1.7350 +        dst -= channels;
  1.7351 +        SDL_memcpy(dst, src, cpy);
  1.7352 +        dst -= channels;
  1.7353 +        SDL_memcpy(last_sample, src, cpy);
  1.7354 +        src -= channels;
  1.7355      }
  1.7356  
  1.7357      cvt->len_cvt = dstsize;
  1.7358      if (cvt->filters[++cvt->filter_index]) {
  1.7359 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7360 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
  1.7361      }
  1.7362  }
  1.7363  
  1.7364 -static void SDLCALL
  1.7365 -SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7366 +void
  1.7367 +SDL_Downsample_Multiple(SDL_AudioCVT *cvt, const int multiple, const int channels)
  1.7368  {
  1.7369 +    const int dstsize = cvt->len_cvt / multiple;
  1.7370 +    float *dst = (float *) cvt->buf;
  1.7371 +    const float *src = (float *) cvt->buf;
  1.7372 +    const float *target = (const float *) (cvt->buf + dstsize);
  1.7373 +    const size_t cpy = sizeof (float) * channels;
  1.7374 +    float last_sample[8];
  1.7375 +    int i;
  1.7376 +
  1.7377  #if DEBUG_CONVERT
  1.7378 -    fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n");
  1.7379 +    fprintf(stderr, "Downsample (x%d), %d channels.\n", multiple, channels);
  1.7380  #endif
  1.7381  
  1.7382 -    const int dstsize = cvt->len_cvt / 4;
  1.7383 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.7384 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.7385 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.7386 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7387 +    SDL_assert(channels <= 8);
  1.7388 +    SDL_memcpy(last_sample, src, cpy);
  1.7389 +
  1.7390      while (dst < target) {
  1.7391 -        const Sint16 sample0 = (Sint16) src[0];
  1.7392 -        src += 4;
  1.7393 -        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7394 -        last_sample0 = sample0;
  1.7395 -        dst++;
  1.7396 +        for (i = 0; i < channels; i++) {
  1.7397 +            dst[i] = (float) ((((double)src[i]) + ((double)last_sample[i])) * 0.5);
  1.7398 +        }
  1.7399 +        dst += channels;
  1.7400 +
  1.7401 +        SDL_memcpy(last_sample, src, cpy);
  1.7402 +        src += (channels * multiple);
  1.7403      }
  1.7404  
  1.7405      cvt->len_cvt = dstsize;
  1.7406      if (cvt->filters[++cvt->filter_index]) {
  1.7407 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7408 +        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
  1.7409      }
  1.7410  }
  1.7411  
  1.7412 -static void SDLCALL
  1.7413 -SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7414 -{
  1.7415 -#if DEBUG_CONVERT
  1.7416 -    fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n");
  1.7417 -#endif
  1.7418 -
  1.7419 -    const int dstsize = cvt->len_cvt * 2;
  1.7420 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2;
  1.7421 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.7422 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.7423 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7424 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7425 -    while (dst >= target) {
  1.7426 -        const Sint16 sample1 = (Sint16) src[1];
  1.7427 -        const Sint16 sample0 = (Sint16) src[0];
  1.7428 -        src -= 2;
  1.7429 -        dst[3] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7430 -        dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7431 -        dst[1] = (Uint8) sample1;
  1.7432 -        dst[0] = (Uint8) sample0;
  1.7433 -        last_sample1 = sample1;
  1.7434 -        last_sample0 = sample0;
  1.7435 -        dst -= 4;
  1.7436 -    }
  1.7437 -
  1.7438 -    cvt->len_cvt = dstsize;
  1.7439 -    if (cvt->filters[++cvt->filter_index]) {
  1.7440 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7441 -    }
  1.7442 -}
  1.7443 -
  1.7444 -static void SDLCALL
  1.7445 -SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7446 -{
  1.7447 -#if DEBUG_CONVERT
  1.7448 -    fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n");
  1.7449 -#endif
  1.7450 -
  1.7451 -    const int dstsize = cvt->len_cvt / 2;
  1.7452 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.7453 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.7454 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.7455 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7456 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7457 -    while (dst < target) {
  1.7458 -        const Sint16 sample0 = (Sint16) src[0];
  1.7459 -        const Sint16 sample1 = (Sint16) src[1];
  1.7460 -        src += 4;
  1.7461 -        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7462 -        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7463 -        last_sample0 = sample0;
  1.7464 -        last_sample1 = sample1;
  1.7465 -        dst += 2;
  1.7466 -    }
  1.7467 -
  1.7468 -    cvt->len_cvt = dstsize;
  1.7469 -    if (cvt->filters[++cvt->filter_index]) {
  1.7470 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7471 -    }
  1.7472 -}
  1.7473 -
  1.7474 -static void SDLCALL
  1.7475 -SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7476 -{
  1.7477 -#if DEBUG_CONVERT
  1.7478 -    fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n");
  1.7479 -#endif
  1.7480 -
  1.7481 -    const int dstsize = cvt->len_cvt * 4;
  1.7482 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4;
  1.7483 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
  1.7484 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.7485 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7486 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7487 -    while (dst >= target) {
  1.7488 -        const Sint16 sample1 = (Sint16) src[1];
  1.7489 -        const Sint16 sample0 = (Sint16) src[0];
  1.7490 -        src -= 2;
  1.7491 -        dst[7] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.7492 -        dst[6] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.7493 -        dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7494 -        dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7495 -        dst[3] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
  1.7496 -        dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
  1.7497 -        dst[1] = (Uint8) sample1;
  1.7498 -        dst[0] = (Uint8) sample0;
  1.7499 -        last_sample1 = sample1;
  1.7500 -        last_sample0 = sample0;
  1.7501 -        dst -= 8;
  1.7502 -    }
  1.7503 -
  1.7504 -    cvt->len_cvt = dstsize;
  1.7505 -    if (cvt->filters[++cvt->filter_index]) {
  1.7506 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7507 -    }
  1.7508 -}
  1.7509 -
  1.7510 -static void SDLCALL
  1.7511 -SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7512 -{
  1.7513 -#if DEBUG_CONVERT
  1.7514 -    fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n");
  1.7515 -#endif
  1.7516 -
  1.7517 -    const int dstsize = cvt->len_cvt / 4;
  1.7518 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.7519 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.7520 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.7521 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7522 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7523 -    while (dst < target) {
  1.7524 -        const Sint16 sample0 = (Sint16) src[0];
  1.7525 -        const Sint16 sample1 = (Sint16) src[1];
  1.7526 -        src += 8;
  1.7527 -        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7528 -        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7529 -        last_sample0 = sample0;
  1.7530 -        last_sample1 = sample1;
  1.7531 -        dst += 2;
  1.7532 -    }
  1.7533 -
  1.7534 -    cvt->len_cvt = dstsize;
  1.7535 -    if (cvt->filters[++cvt->filter_index]) {
  1.7536 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7537 -    }
  1.7538 -}
  1.7539 -
  1.7540 -static void SDLCALL
  1.7541 -SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7542 -{
  1.7543 -#if DEBUG_CONVERT
  1.7544 -    fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n");
  1.7545 -#endif
  1.7546 -
  1.7547 -    const int dstsize = cvt->len_cvt * 2;
  1.7548 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2;
  1.7549 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.7550 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.7551 -    Sint16 last_sample3 = (Sint16) src[3];
  1.7552 -    Sint16 last_sample2 = (Sint16) src[2];
  1.7553 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7554 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7555 -    while (dst >= target) {
  1.7556 -        const Sint16 sample3 = (Sint16) src[3];
  1.7557 -        const Sint16 sample2 = (Sint16) src[2];
  1.7558 -        const Sint16 sample1 = (Sint16) src[1];
  1.7559 -        const Sint16 sample0 = (Sint16) src[0];
  1.7560 -        src -= 4;
  1.7561 -        dst[7] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.7562 -        dst[6] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.7563 -        dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7564 -        dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7565 -        dst[3] = (Uint8) sample3;
  1.7566 -        dst[2] = (Uint8) sample2;
  1.7567 -        dst[1] = (Uint8) sample1;
  1.7568 -        dst[0] = (Uint8) sample0;
  1.7569 -        last_sample3 = sample3;
  1.7570 -        last_sample2 = sample2;
  1.7571 -        last_sample1 = sample1;
  1.7572 -        last_sample0 = sample0;
  1.7573 -        dst -= 8;
  1.7574 -    }
  1.7575 -
  1.7576 -    cvt->len_cvt = dstsize;
  1.7577 -    if (cvt->filters[++cvt->filter_index]) {
  1.7578 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7579 -    }
  1.7580 -}
  1.7581 -
  1.7582 -static void SDLCALL
  1.7583 -SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7584 -{
  1.7585 -#if DEBUG_CONVERT
  1.7586 -    fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n");
  1.7587 -#endif
  1.7588 -
  1.7589 -    const int dstsize = cvt->len_cvt / 2;
  1.7590 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.7591 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.7592 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.7593 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7594 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7595 -    Sint16 last_sample2 = (Sint16) src[2];
  1.7596 -    Sint16 last_sample3 = (Sint16) src[3];
  1.7597 -    while (dst < target) {
  1.7598 -        const Sint16 sample0 = (Sint16) src[0];
  1.7599 -        const Sint16 sample1 = (Sint16) src[1];
  1.7600 -        const Sint16 sample2 = (Sint16) src[2];
  1.7601 -        const Sint16 sample3 = (Sint16) src[3];
  1.7602 -        src += 8;
  1.7603 -        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7604 -        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7605 -        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.7606 -        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.7607 -        last_sample0 = sample0;
  1.7608 -        last_sample1 = sample1;
  1.7609 -        last_sample2 = sample2;
  1.7610 -        last_sample3 = sample3;
  1.7611 -        dst += 4;
  1.7612 -    }
  1.7613 -
  1.7614 -    cvt->len_cvt = dstsize;
  1.7615 -    if (cvt->filters[++cvt->filter_index]) {
  1.7616 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7617 -    }
  1.7618 -}
  1.7619 -
  1.7620 -static void SDLCALL
  1.7621 -SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7622 -{
  1.7623 -#if DEBUG_CONVERT
  1.7624 -    fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n");
  1.7625 -#endif
  1.7626 -
  1.7627 -    const int dstsize = cvt->len_cvt * 4;
  1.7628 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4;
  1.7629 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
  1.7630 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.7631 -    Sint16 last_sample3 = (Sint16) src[3];
  1.7632 -    Sint16 last_sample2 = (Sint16) src[2];
  1.7633 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7634 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7635 -    while (dst >= target) {
  1.7636 -        const Sint16 sample3 = (Sint16) src[3];
  1.7637 -        const Sint16 sample2 = (Sint16) src[2];
  1.7638 -        const Sint16 sample1 = (Sint16) src[1];
  1.7639 -        const Sint16 sample0 = (Sint16) src[0];
  1.7640 -        src -= 4;
  1.7641 -        dst[15] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
  1.7642 -        dst[14] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
  1.7643 -        dst[13] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
  1.7644 -        dst[12] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
  1.7645 -        dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.7646 -        dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.7647 -        dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7648 -        dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7649 -        dst[7] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
  1.7650 -        dst[6] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
  1.7651 -        dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
  1.7652 -        dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
  1.7653 -        dst[3] = (Uint8) sample3;
  1.7654 -        dst[2] = (Uint8) sample2;
  1.7655 -        dst[1] = (Uint8) sample1;
  1.7656 -        dst[0] = (Uint8) sample0;
  1.7657 -        last_sample3 = sample3;
  1.7658 -        last_sample2 = sample2;
  1.7659 -        last_sample1 = sample1;
  1.7660 -        last_sample0 = sample0;
  1.7661 -        dst -= 16;
  1.7662 -    }
  1.7663 -
  1.7664 -    cvt->len_cvt = dstsize;
  1.7665 -    if (cvt->filters[++cvt->filter_index]) {
  1.7666 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7667 -    }
  1.7668 -}
  1.7669 -
  1.7670 -static void SDLCALL
  1.7671 -SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7672 -{
  1.7673 -#if DEBUG_CONVERT
  1.7674 -    fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n");
  1.7675 -#endif
  1.7676 -
  1.7677 -    const int dstsize = cvt->len_cvt / 4;
  1.7678 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.7679 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.7680 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.7681 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7682 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7683 -    Sint16 last_sample2 = (Sint16) src[2];
  1.7684 -    Sint16 last_sample3 = (Sint16) src[3];
  1.7685 -    while (dst < target) {
  1.7686 -        const Sint16 sample0 = (Sint16) src[0];
  1.7687 -        const Sint16 sample1 = (Sint16) src[1];
  1.7688 -        const Sint16 sample2 = (Sint16) src[2];
  1.7689 -        const Sint16 sample3 = (Sint16) src[3];
  1.7690 -        src += 16;
  1.7691 -        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7692 -        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7693 -        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.7694 -        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.7695 -        last_sample0 = sample0;
  1.7696 -        last_sample1 = sample1;
  1.7697 -        last_sample2 = sample2;
  1.7698 -        last_sample3 = sample3;
  1.7699 -        dst += 4;
  1.7700 -    }
  1.7701 -
  1.7702 -    cvt->len_cvt = dstsize;
  1.7703 -    if (cvt->filters[++cvt->filter_index]) {
  1.7704 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7705 -    }
  1.7706 -}
  1.7707 -
  1.7708 -static void SDLCALL
  1.7709 -SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7710 -{
  1.7711 -#if DEBUG_CONVERT
  1.7712 -    fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n");
  1.7713 -#endif
  1.7714 -
  1.7715 -    const int dstsize = cvt->len_cvt * 2;
  1.7716 -    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2;
  1.7717 -    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
  1.7718 -    const Uint8 *target = ((const Uint8 *) cvt->buf);
  1.7719 -    Sint16 last_sample5 = (Sint16) src[5];
  1.7720 -    Sint16 last_sample4 = (Sint16) src[4];
  1.7721 -    Sint16 last_sample3 = (Sint16) src[3];
  1.7722 -    Sint16 last_sample2 = (Sint16) src[2];
  1.7723 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7724 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7725 -    while (dst >= target) {
  1.7726 -        const Sint16 sample5 = (Sint16) src[5];
  1.7727 -        const Sint16 sample4 = (Sint16) src[4];
  1.7728 -        const Sint16 sample3 = (Sint16) src[3];
  1.7729 -        const Sint16 sample2 = (Sint16) src[2];
  1.7730 -        const Sint16 sample1 = (Sint16) src[1];
  1.7731 -        const Sint16 sample0 = (Sint16) src[0];
  1.7732 -        src -= 6;
  1.7733 -        dst[11] = (Uint8) ((sample5 + last_sample5) >> 1);
  1.7734 -        dst[10] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.7735 -        dst[9] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.7736 -        dst[8] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.7737 -        dst[7] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7738 -        dst[6] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7739 -        dst[5] = (Uint8) sample5;
  1.7740 -        dst[4] = (Uint8) sample4;
  1.7741 -        dst[3] = (Uint8) sample3;
  1.7742 -        dst[2] = (Uint8) sample2;
  1.7743 -        dst[1] = (Uint8) sample1;
  1.7744 -        dst[0] = (Uint8) sample0;
  1.7745 -        last_sample5 = sample5;
  1.7746 -        last_sample4 = sample4;
  1.7747 -        last_sample3 = sample3;
  1.7748 -        last_sample2 = sample2;
  1.7749 -        last_sample1 = sample1;
  1.7750 -        last_sample0 = sample0;
  1.7751 -        dst -= 12;
  1.7752 -    }
  1.7753 -
  1.7754 -    cvt->len_cvt = dstsize;
  1.7755 -    if (cvt->filters[++cvt->filter_index]) {
  1.7756 -        cvt->filters[cvt->filter_index] (cvt, format);
  1.7757 -    }
  1.7758 -}
  1.7759 -
  1.7760 -static void SDLCALL
  1.7761 -SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
  1.7762 -{
  1.7763 -#if DEBUG_CONVERT
  1.7764 -    fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n");
  1.7765 -#endif
  1.7766 -
  1.7767 -    const int dstsize = cvt->len_cvt / 2;
  1.7768 -    Uint8 *dst = (Uint8 *) cvt->buf;
  1.7769 -    const Uint8 *src = (Uint8 *) cvt->buf;
  1.7770 -    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
  1.7771 -    Sint16 last_sample0 = (Sint16) src[0];
  1.7772 -    Sint16 last_sample1 = (Sint16) src[1];
  1.7773 -    Sint16 last_sample2 = (Sint16) src[2];
  1.7774 -    Sint16 last_sample3 = (Sint16) src[3];
  1.7775 -    Sint16 last_sample4 = (Sint16) src[4];
  1.7776 -    Sint16 last_sample5 = (Sint16) src[5];
  1.7777 -    while (dst < target) {
  1.7778 -        const Sint16 sample0 = (Sint16) src[0];
  1.7779 -        const Sint16 sample1 = (Sint16) src[1];
  1.7780 -        const Sint16 sample2 = (Sint16) src[2];
  1.7781 -        const Sint16 sample3 = (Sint16) src[3];
  1.7782 -        const Sint16 sample4 = (Sint16) src[4];
  1.7783 -        const Sint16 sample5 = (Sint16) src[5];
  1.7784 -        src += 12;
  1.7785 -        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
  1.7786 -        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
  1.7787 -        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
  1.7788 -        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
  1.7789 -        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
  1.7790