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