Procházet zdrojové kódy

Reworked audio converter code.

This no longer uses a script to generate code for every possible type
conversion or resampler. This caused a bloat in binary size and and compile
times. Now we use a handful of more generic functions and assume staying in
the CPU cache is the most important thing anyhow.

This shrinks the size of the final build (in this case: macOS X amd64, -Os to
optimize for size) by 15%. When compiling on a single core, build times drop
by about 15% too (although the previous cost was largely hidden by multicore
builds).
Ryan C. Gordon před 8 roky
rodič
revize
f3456e9a93
4 změnil soubory, kde provedl 502 přidání a 17378 odebrání
  1. 25 19
      src/audio/SDL_audio_c.h
  2. 262 785
      src/audio/SDL_audiocvt.c
  3. 215 15813
      src/audio/SDL_audiotypecvt.c
  4. 0 761
      src/audio/sdlgenaudiocvt.pl

+ 25 - 19
src/audio/SDL_audio_c.h

@@ -20,6 +20,16 @@
 */
 #include "../SDL_internal.h"
 
+#ifndef DEBUG_CONVERT
+#define DEBUG_CONVERT 0
+#endif
+
+#if DEBUG_CONVERT
+#define LOG_DEBUG_CONVERT(from, to) fprintf(stderr, "Converting %s to %s.\n", from, to);
+#else
+#define LOG_DEBUG_CONVERT(from, to)
+#endif
+
 /* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
 
 /* Functions to get a list of "close" audio formats */
@@ -29,24 +39,20 @@ extern SDL_AudioFormat SDL_NextAudioFormat(void);
 /* Function to calculate the size and silence for a SDL_AudioSpec */
 extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec);
 
-/* this is used internally to access some autogenerated code. */
-typedef struct
-{
-    SDL_AudioFormat src_fmt;
-    SDL_AudioFormat dst_fmt;
-    SDL_AudioFilter filter;
-} SDL_AudioTypeFilters;
-extern const SDL_AudioTypeFilters sdl_audio_type_filters[];
-
-/* this is used internally to access some autogenerated code. */
-typedef struct
-{
-    SDL_AudioFormat fmt;
-    int channels;
-    int upsample;
-    int multiple;
-    SDL_AudioFilter filter;
-} SDL_AudioRateFilters;
-extern const SDL_AudioRateFilters sdl_audio_rate_filters[];
+void SDLCALL SDL_Convert_S8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_U8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_S16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_U16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_S32_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_S8(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_U8(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_S16(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_U16(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_S32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDL_Upsample_Arbitrary(SDL_AudioCVT *cvt, const int channels);
+void SDL_Downsample_Arbitrary(SDL_AudioCVT *cvt, const int channels);
+void SDL_Upsample_x2(SDL_AudioCVT *cvt, const int channels);
+void SDL_Upsample_x4(SDL_AudioCVT *cvt, const int channels);
+void SDL_Downsample_Multiple(SDL_AudioCVT *cvt, const int multiple, const int channels);
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 262 - 785
src/audio/SDL_audiocvt.c

@@ -27,160 +27,20 @@
 
 #include "SDL_assert.h"
 
-/* #define DEBUG_CONVERT */
 
 /* Effectively mix right and left channels into a single channel */
 static void SDLCALL
 SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 {
+    float *dst = (float *) cvt->buf;
+    const float *src = dst;
     int i;
-    Sint32 sample;
 
-#ifdef DEBUG_CONVERT
-    fprintf(stderr, "Converting to mono\n");
-#endif
-	switch (format & (SDL_AUDIO_MASK_SIGNED |
-                      SDL_AUDIO_MASK_BITSIZE |
-                      SDL_AUDIO_MASK_DATATYPE)) {
-    case AUDIO_U8:
-        {
-            Uint8 *src, *dst;
-
-            src = cvt->buf;
-            dst = cvt->buf;
-            for (i = cvt->len_cvt / 2; i; --i) {
-                sample = src[0] + src[1];
-                *dst = (Uint8) (sample / 2);
-                src += 2;
-                dst += 1;
-            }
-        }
-        break;
-
-    case AUDIO_S8:
-        {
-            Sint8 *src, *dst;
-
-            src = (Sint8 *) cvt->buf;
-            dst = (Sint8 *) cvt->buf;
-            for (i = cvt->len_cvt / 2; i; --i) {
-                sample = src[0] + src[1];
-                *dst = (Sint8) (sample / 2);
-                src += 2;
-                dst += 1;
-            }
-        }
-        break;
-
-    case AUDIO_U16:
-        {
-            Uint8 *src, *dst;
-
-            src = cvt->buf;
-            dst = cvt->buf;
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    sample = (Uint16) ((src[0] << 8) | src[1]) +
-                        (Uint16) ((src[2] << 8) | src[3]);
-                    sample /= 2;
-                    dst[1] = (sample & 0xFF);
-                    sample >>= 8;
-                    dst[0] = (sample & 0xFF);
-                    src += 4;
-                    dst += 2;
-                }
-            } else {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    sample = (Uint16) ((src[1] << 8) | src[0]) +
-                        (Uint16) ((src[3] << 8) | src[2]);
-                    sample /= 2;
-                    dst[0] = (sample & 0xFF);
-                    sample >>= 8;
-                    dst[1] = (sample & 0xFF);
-                    src += 4;
-                    dst += 2;
-                }
-            }
-        }
-        break;
-
-    case AUDIO_S16:
-        {
-            Uint8 *src, *dst;
-
-            src = cvt->buf;
-            dst = cvt->buf;
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    sample = (Sint16) ((src[0] << 8) | src[1]) +
-                        (Sint16) ((src[2] << 8) | src[3]);
-                    sample /= 2;
-                    dst[1] = (sample & 0xFF);
-                    sample >>= 8;
-                    dst[0] = (sample & 0xFF);
-                    src += 4;
-                    dst += 2;
-                }
-            } else {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    sample = (Sint16) ((src[1] << 8) | src[0]) +
-                        (Sint16) ((src[3] << 8) | src[2]);
-                    sample /= 2;
-                    dst[0] = (sample & 0xFF);
-                    sample >>= 8;
-                    dst[1] = (sample & 0xFF);
-                    src += 4;
-                    dst += 2;
-                }
-            }
-        }
-        break;
-
-    case AUDIO_S32:
-        {
-            const Uint32 *src = (const Uint32 *) cvt->buf;
-            Uint32 *dst = (Uint32 *) cvt->buf;
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 8; i; --i, src += 2) {
-                    const Sint64 added =
-                        (((Sint64) (Sint32) SDL_SwapBE32(src[0])) +
-                         ((Sint64) (Sint32) SDL_SwapBE32(src[1])));
-                    *(dst++) = SDL_SwapBE32((Uint32) ((Sint32) (added / 2)));
-                }
-            } else {
-                for (i = cvt->len_cvt / 8; i; --i, src += 2) {
-                    const Sint64 added =
-                        (((Sint64) (Sint32) SDL_SwapLE32(src[0])) +
-                         ((Sint64) (Sint32) SDL_SwapLE32(src[1])));
-                    *(dst++) = SDL_SwapLE32((Uint32) ((Sint32) (added / 2)));
-                }
-            }
-        }
-        break;
-
-    case AUDIO_F32:
-        {
-            const float *src = (const float *) cvt->buf;
-            float *dst = (float *) cvt->buf;
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 8; i; --i, src += 2) {
-                    const float src1 = SDL_SwapFloatBE(src[0]);
-                    const float src2 = SDL_SwapFloatBE(src[1]);
-                    const double added = ((double) src1) + ((double) src2);
-                    const float halved = (float) (added * 0.5);
-                    *(dst++) = SDL_SwapFloatBE(halved);
-                }
-            } else {
-                for (i = cvt->len_cvt / 8; i; --i, src += 2) {
-                    const float src1 = SDL_SwapFloatLE(src[0]);
-                    const float src2 = SDL_SwapFloatLE(src[1]);
-                    const double added = ((double) src1) + ((double) src2);
-                    const float halved = (float) (added * 0.5);
-                    *(dst++) = SDL_SwapFloatLE(halved);
-                }
-            }
-        }
-        break;
+    LOG_DEBUG_CONVERT("stereo", "mono");
+    SDL_assert(format == AUDIO_F32SYS);
+
+    for (i = cvt->len_cvt / 8; i; --i, src += 2) {
+        *(dst++) = (float) ((((double) src[0]) + ((double) src[1])) * 0.5);
     }
 
     cvt->len_cvt /= 2;
@@ -194,39 +54,18 @@ SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 static void SDLCALL
 SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 {
+    float *dst = (float *) cvt->buf;
+    const float *src = dst;
     int i;
 
-#ifdef DEBUG_CONVERT
-    fprintf(stderr, "Converting down from 6 channels to stereo\n");
-#endif
-
-#define strip_chans_6_to_2(type) \
-    { \
-        const type *src = (const type *) cvt->buf; \
-        type *dst = (type *) cvt->buf; \
-        for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \
-            dst[0] = src[0]; \
-            dst[1] = src[1]; \
-            src += 6; \
-            dst += 2; \
-        } \
-    }
+    LOG_DEBUG_CONVERT("6 channels", "stereo");
+    SDL_assert(format == AUDIO_F32SYS);
 
-    /* this function only cares about typesize, and data as a block of bits. */
-    switch (SDL_AUDIO_BITSIZE(format)) {
-    case 8:
-        strip_chans_6_to_2(Uint8);
-        break;
-    case 16:
-        strip_chans_6_to_2(Uint16);
-        break;
-    case 32:
-        strip_chans_6_to_2(Uint32);
-        break;
+    for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 2) {
+        dst[0] = src[0];
+        dst[1] = src[1];
     }
 
-#undef strip_chans_6_to_2
-
     cvt->len_cvt /= 3;
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index] (cvt, format);
@@ -238,41 +77,20 @@ SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 static void SDLCALL
 SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 {
+    float *dst = (float *) cvt->buf;
+    const float *src = dst;
     int i;
 
-#ifdef DEBUG_CONVERT
-    fprintf(stderr, "Converting 6 down to quad\n");
-#endif
-
-#define strip_chans_6_to_4(type) \
-    { \
-        const type *src = (const type *) cvt->buf; \
-        type *dst = (type *) cvt->buf; \
-        for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \
-            dst[0] = src[0]; \
-            dst[1] = src[1]; \
-            dst[2] = src[2]; \
-            dst[3] = src[3]; \
-            src += 6; \
-            dst += 4; \
-        } \
-    }
+    LOG_DEBUG_CONVERT("6 channels", "quad");
+    SDL_assert(format == AUDIO_F32SYS);
 
-    /* this function only cares about typesize, and data as a block of bits. */
-    switch (SDL_AUDIO_BITSIZE(format)) {
-    case 8:
-        strip_chans_6_to_4(Uint8);
-        break;
-    case 16:
-        strip_chans_6_to_4(Uint16);
-        break;
-    case 32:
-        strip_chans_6_to_4(Uint32);
-        break;
+    for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 4) {
+        dst[0] = src[0];
+        dst[1] = src[1];
+        dst[2] = src[2];
+        dst[3] = src[3];
     }
 
-#undef strip_chans_6_to_4
-
     cvt->len_cvt /= 6;
     cvt->len_cvt *= 4;
     if (cvt->filters[++cvt->filter_index]) {
@@ -284,38 +102,19 @@ SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 static void SDLCALL
 SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) (cvt->buf + cvt->len_cvt);
+    float *dst = (float *) (cvt->buf + cvt->len_cvt * 2);
     int i;
 
-#ifdef DEBUG_CONVERT
-    fprintf(stderr, "Converting to stereo\n");
-#endif
-
-#define dup_chans_1_to_2(type) \
-    { \
-        const type *src = (const type *) (cvt->buf + cvt->len_cvt); \
-        type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \
-        for (i = cvt->len_cvt / sizeof(type); i; --i) { \
-            src -= 1; \
-            dst -= 2; \
-            dst[0] = dst[1] = *src; \
-        } \
-    }
+    LOG_DEBUG_CONVERT("mono", "stereo");
+    SDL_assert(format == AUDIO_F32SYS);
 
-    /* this function only cares about typesize, and data as a block of bits. */
-    switch (SDL_AUDIO_BITSIZE(format)) {
-    case 8:
-        dup_chans_1_to_2(Uint8);
-        break;
-    case 16:
-        dup_chans_1_to_2(Uint16);
-        break;
-    case 32:
-        dup_chans_1_to_2(Uint32);
-        break;
+    for (i = cvt->len_cvt / sizeof (float); i; --i) {
+        src--;
+        dst -= 2;
+        dst[0] = dst[1] = *src;
     }
 
-#undef dup_chans_1_to_2
-
     cvt->len_cvt *= 2;
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index] (cvt, format);
@@ -328,253 +127,26 @@ static void SDLCALL
 SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 {
     int i;
-
-#ifdef DEBUG_CONVERT
-    fprintf(stderr, "Converting stereo to surround\n");
-#endif
-
-    switch (format & (SDL_AUDIO_MASK_SIGNED  |
-                      SDL_AUDIO_MASK_BITSIZE |
-                      SDL_AUDIO_MASK_DATATYPE)) {
-    case AUDIO_U8:
-        {
-            Uint8 *src, *dst, lf, rf, ce;
-
-            src = (Uint8 *) (cvt->buf + cvt->len_cvt);
-            dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 3);
-            for (i = cvt->len_cvt; i; --i) {
-                dst -= 6;
-                src -= 2;
-                lf = src[0];
-                rf = src[1];
-                ce = (lf / 2) + (rf / 2);
-                dst[0] = lf;
-                dst[1] = rf;
-                dst[2] = lf - ce;
-                dst[3] = rf - ce;
-                dst[4] = ce;
-                dst[5] = ce;
-            }
-        }
-        break;
-
-    case AUDIO_S8:
-        {
-            Sint8 *src, *dst, lf, rf, ce;
-
-            src = (Sint8 *) cvt->buf + cvt->len_cvt;
-            dst = (Sint8 *) cvt->buf + cvt->len_cvt * 3;
-            for (i = cvt->len_cvt; i; --i) {
-                dst -= 6;
-                src -= 2;
-                lf = src[0];
-                rf = src[1];
-                ce = (lf / 2) + (rf / 2);
-                dst[0] = lf;
-                dst[1] = rf;
-                dst[2] = lf - ce;
-                dst[3] = rf - ce;
-                dst[4] = ce;
-                dst[5] = ce;
-            }
-        }
-        break;
-
-    case AUDIO_U16:
-        {
-            Uint8 *src, *dst;
-            Uint16 lf, rf, ce, lr, rr;
-
-            src = cvt->buf + cvt->len_cvt;
-            dst = cvt->buf + cvt->len_cvt * 3;
-
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    dst -= 12;
-                    src -= 4;
-                    lf = (Uint16) ((src[0] << 8) | src[1]);
-                    rf = (Uint16) ((src[2] << 8) | src[3]);
-                    ce = (lf / 2) + (rf / 2);
-                    rr = lf - ce;
-                    lr = rf - ce;
-                    dst[1] = (lf & 0xFF);
-                    dst[0] = ((lf >> 8) & 0xFF);
-                    dst[3] = (rf & 0xFF);
-                    dst[2] = ((rf >> 8) & 0xFF);
-
-                    dst[1 + 4] = (lr & 0xFF);
-                    dst[0 + 4] = ((lr >> 8) & 0xFF);
-                    dst[3 + 4] = (rr & 0xFF);
-                    dst[2 + 4] = ((rr >> 8) & 0xFF);
-
-                    dst[1 + 8] = (ce & 0xFF);
-                    dst[0 + 8] = ((ce >> 8) & 0xFF);
-                    dst[3 + 8] = (ce & 0xFF);
-                    dst[2 + 8] = ((ce >> 8) & 0xFF);
-                }
-            } else {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    dst -= 12;
-                    src -= 4;
-                    lf = (Uint16) ((src[1] << 8) | src[0]);
-                    rf = (Uint16) ((src[3] << 8) | src[2]);
-                    ce = (lf / 2) + (rf / 2);
-                    rr = lf - ce;
-                    lr = rf - ce;
-                    dst[0] = (lf & 0xFF);
-                    dst[1] = ((lf >> 8) & 0xFF);
-                    dst[2] = (rf & 0xFF);
-                    dst[3] = ((rf >> 8) & 0xFF);
-
-                    dst[0 + 4] = (lr & 0xFF);
-                    dst[1 + 4] = ((lr >> 8) & 0xFF);
-                    dst[2 + 4] = (rr & 0xFF);
-                    dst[3 + 4] = ((rr >> 8) & 0xFF);
-
-                    dst[0 + 8] = (ce & 0xFF);
-                    dst[1 + 8] = ((ce >> 8) & 0xFF);
-                    dst[2 + 8] = (ce & 0xFF);
-                    dst[3 + 8] = ((ce >> 8) & 0xFF);
-                }
-            }
-        }
-        break;
-
-    case AUDIO_S16:
-        {
-            Uint8 *src, *dst;
-            Sint16 lf, rf, ce, lr, rr;
-
-            src = cvt->buf + cvt->len_cvt;
-            dst = cvt->buf + cvt->len_cvt * 3;
-
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    dst -= 12;
-                    src -= 4;
-                    lf = (Sint16) ((src[0] << 8) | src[1]);
-                    rf = (Sint16) ((src[2] << 8) | src[3]);
-                    ce = (lf / 2) + (rf / 2);
-                    rr = lf - ce;
-                    lr = rf - ce;
-                    dst[1] = (lf & 0xFF);
-                    dst[0] = ((lf >> 8) & 0xFF);
-                    dst[3] = (rf & 0xFF);
-                    dst[2] = ((rf >> 8) & 0xFF);
-
-                    dst[1 + 4] = (lr & 0xFF);
-                    dst[0 + 4] = ((lr >> 8) & 0xFF);
-                    dst[3 + 4] = (rr & 0xFF);
-                    dst[2 + 4] = ((rr >> 8) & 0xFF);
-
-                    dst[1 + 8] = (ce & 0xFF);
-                    dst[0 + 8] = ((ce >> 8) & 0xFF);
-                    dst[3 + 8] = (ce & 0xFF);
-                    dst[2 + 8] = ((ce >> 8) & 0xFF);
-                }
-            } else {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    dst -= 12;
-                    src -= 4;
-                    lf = (Sint16) ((src[1] << 8) | src[0]);
-                    rf = (Sint16) ((src[3] << 8) | src[2]);
-                    ce = (lf / 2) + (rf / 2);
-                    rr = lf - ce;
-                    lr = rf - ce;
-                    dst[0] = (lf & 0xFF);
-                    dst[1] = ((lf >> 8) & 0xFF);
-                    dst[2] = (rf & 0xFF);
-                    dst[3] = ((rf >> 8) & 0xFF);
-
-                    dst[0 + 4] = (lr & 0xFF);
-                    dst[1 + 4] = ((lr >> 8) & 0xFF);
-                    dst[2 + 4] = (rr & 0xFF);
-                    dst[3 + 4] = ((rr >> 8) & 0xFF);
-
-                    dst[0 + 8] = (ce & 0xFF);
-                    dst[1 + 8] = ((ce >> 8) & 0xFF);
-                    dst[2 + 8] = (ce & 0xFF);
-                    dst[3 + 8] = ((ce >> 8) & 0xFF);
-                }
-            }
-        }
-        break;
-
-    case AUDIO_S32:
-        {
-            Sint32 lf, rf, ce;
-            const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt);
-            Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 3);
-
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 8; i; --i) {
-                    dst -= 6;
-                    src -= 2;
-                    lf = (Sint32) SDL_SwapBE32(src[0]);
-                    rf = (Sint32) SDL_SwapBE32(src[1]);
-                    ce = (lf / 2) + (rf / 2);
-                    dst[0] = SDL_SwapBE32((Uint32) lf);
-                    dst[1] = SDL_SwapBE32((Uint32) rf);
-                    dst[2] = SDL_SwapBE32((Uint32) (lf - ce));
-                    dst[3] = SDL_SwapBE32((Uint32) (rf - ce));
-                    dst[4] = SDL_SwapBE32((Uint32) ce);
-                    dst[5] = SDL_SwapBE32((Uint32) ce);
-                }
-            } else {
-                for (i = cvt->len_cvt / 8; i; --i) {
-                    dst -= 6;
-                    src -= 2;
-                    lf = (Sint32) SDL_SwapLE32(src[0]);
-                    rf = (Sint32) SDL_SwapLE32(src[1]);
-                    ce = (lf / 2) + (rf / 2);
-                    dst[0] = src[0];
-                    dst[1] = src[1];
-                    dst[2] = SDL_SwapLE32((Uint32) (lf - ce));
-                    dst[3] = SDL_SwapLE32((Uint32) (rf - ce));
-                    dst[4] = SDL_SwapLE32((Uint32) ce);
-                    dst[5] = SDL_SwapLE32((Uint32) ce);
-                }
-            }
-        }
-        break;
-
-    case AUDIO_F32:
-        {
-            float lf, rf, ce;
-            const float *src = (const float *) (cvt->buf + cvt->len_cvt);
-            float *dst = (float *) (cvt->buf + cvt->len_cvt * 3);
-
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 8; i; --i) {
-                    dst -= 6;
-                    src -= 2;
-                    lf = SDL_SwapFloatBE(src[0]);
-                    rf = SDL_SwapFloatBE(src[1]);
-                    ce = (lf * 0.5f) + (rf * 0.5f);
-                    dst[0] = src[0];
-                    dst[1] = src[1];
-                    dst[2] = SDL_SwapFloatBE(lf - ce);
-                    dst[3] = SDL_SwapFloatBE(rf - ce);
-                    dst[4] = dst[5] = SDL_SwapFloatBE(ce);
-                }
-            } else {
-                for (i = cvt->len_cvt / 8; i; --i) {
-                    dst -= 6;
-                    src -= 2;
-                    lf = SDL_SwapFloatLE(src[0]);
-                    rf = SDL_SwapFloatLE(src[1]);
-                    ce = (lf * 0.5f) + (rf * 0.5f);
-                    dst[0] = src[0];
-                    dst[1] = src[1];
-                    dst[2] = SDL_SwapFloatLE(lf - ce);
-                    dst[3] = SDL_SwapFloatLE(rf - ce);
-                    dst[4] = dst[5] = SDL_SwapFloatLE(ce);
-                }
-            }
-        }
-        break;
-
+    float lf, rf, ce;
+    const float *src = (const float *) (cvt->buf + cvt->len_cvt);
+    float *dst = (float *) (cvt->buf + cvt->len_cvt * 3);
+
+    LOG_DEBUG_CONVERT("stereo", "5.1");
+    SDL_assert(format == AUDIO_F32SYS);
+
+    for (i = cvt->len_cvt / 8; i; --i) {
+        dst -= 6;
+        src -= 2;
+        lf = src[0];
+        rf = src[1];
+        ce = (lf * 0.5f) + (rf * 0.5f);
+        dst[0] = src[0];
+        dst[1] = src[1];
+        dst[2] = lf - ce;
+        dst[3] = rf - ce;
+        dst[4] = dst[5] = ce;
     }
+
     cvt->len_cvt *= 3;
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index] (cvt, format);
@@ -586,223 +158,26 @@ SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 static void SDLCALL
 SDL_ConvertSurround_4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) (cvt->buf + cvt->len_cvt);
+    float *dst = (float *) (cvt->buf + cvt->len_cvt * 2);
+    float lf, rf, ce;
     int i;
 
-#ifdef DEBUG_CONVERT
-    fprintf(stderr, "Converting stereo to quad\n");
-#endif
-
-    switch (format & (SDL_AUDIO_MASK_SIGNED |
-                      SDL_AUDIO_MASK_BITSIZE |
-                      SDL_AUDIO_MASK_DATATYPE)) {
-    case AUDIO_U8:
-        {
-            Uint8 *src, *dst, lf, rf, ce;
-
-            src = (Uint8 *) (cvt->buf + cvt->len_cvt);
-            dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 2);
-            for (i = cvt->len_cvt; i; --i) {
-                dst -= 4;
-                src -= 2;
-                lf = src[0];
-                rf = src[1];
-                ce = (lf / 2) + (rf / 2);
-                dst[0] = lf;
-                dst[1] = rf;
-                dst[2] = lf - ce;
-                dst[3] = rf - ce;
-            }
-        }
-        break;
-
-    case AUDIO_S8:
-        {
-            Sint8 *src, *dst, lf, rf, ce;
-
-            src = (Sint8 *) cvt->buf + cvt->len_cvt;
-            dst = (Sint8 *) cvt->buf + cvt->len_cvt * 2;
-            for (i = cvt->len_cvt; i; --i) {
-                dst -= 4;
-                src -= 2;
-                lf = src[0];
-                rf = src[1];
-                ce = (lf / 2) + (rf / 2);
-                dst[0] = lf;
-                dst[1] = rf;
-                dst[2] = lf - ce;
-                dst[3] = rf - ce;
-            }
-        }
-        break;
-
-    case AUDIO_U16:
-        {
-            Uint8 *src, *dst;
-            Uint16 lf, rf, ce, lr, rr;
-
-            src = cvt->buf + cvt->len_cvt;
-            dst = cvt->buf + cvt->len_cvt * 2;
-
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    dst -= 8;
-                    src -= 4;
-                    lf = (Uint16) ((src[0] << 8) | src[1]);
-                    rf = (Uint16) ((src[2] << 8) | src[3]);
-                    ce = (lf / 2) + (rf / 2);
-                    rr = lf - ce;
-                    lr = rf - ce;
-                    dst[1] = (lf & 0xFF);
-                    dst[0] = ((lf >> 8) & 0xFF);
-                    dst[3] = (rf & 0xFF);
-                    dst[2] = ((rf >> 8) & 0xFF);
-
-                    dst[1 + 4] = (lr & 0xFF);
-                    dst[0 + 4] = ((lr >> 8) & 0xFF);
-                    dst[3 + 4] = (rr & 0xFF);
-                    dst[2 + 4] = ((rr >> 8) & 0xFF);
-                }
-            } else {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    dst -= 8;
-                    src -= 4;
-                    lf = (Uint16) ((src[1] << 8) | src[0]);
-                    rf = (Uint16) ((src[3] << 8) | src[2]);
-                    ce = (lf / 2) + (rf / 2);
-                    rr = lf - ce;
-                    lr = rf - ce;
-                    dst[0] = (lf & 0xFF);
-                    dst[1] = ((lf >> 8) & 0xFF);
-                    dst[2] = (rf & 0xFF);
-                    dst[3] = ((rf >> 8) & 0xFF);
-
-                    dst[0 + 4] = (lr & 0xFF);
-                    dst[1 + 4] = ((lr >> 8) & 0xFF);
-                    dst[2 + 4] = (rr & 0xFF);
-                    dst[3 + 4] = ((rr >> 8) & 0xFF);
-                }
-            }
-        }
-        break;
-
-    case AUDIO_S16:
-        {
-            Uint8 *src, *dst;
-            Sint16 lf, rf, ce, lr, rr;
-
-            src = cvt->buf + cvt->len_cvt;
-            dst = cvt->buf + cvt->len_cvt * 2;
-
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    dst -= 8;
-                    src -= 4;
-                    lf = (Sint16) ((src[0] << 8) | src[1]);
-                    rf = (Sint16) ((src[2] << 8) | src[3]);
-                    ce = (lf / 2) + (rf / 2);
-                    rr = lf - ce;
-                    lr = rf - ce;
-                    dst[1] = (lf & 0xFF);
-                    dst[0] = ((lf >> 8) & 0xFF);
-                    dst[3] = (rf & 0xFF);
-                    dst[2] = ((rf >> 8) & 0xFF);
-
-                    dst[1 + 4] = (lr & 0xFF);
-                    dst[0 + 4] = ((lr >> 8) & 0xFF);
-                    dst[3 + 4] = (rr & 0xFF);
-                    dst[2 + 4] = ((rr >> 8) & 0xFF);
-                }
-            } else {
-                for (i = cvt->len_cvt / 4; i; --i) {
-                    dst -= 8;
-                    src -= 4;
-                    lf = (Sint16) ((src[1] << 8) | src[0]);
-                    rf = (Sint16) ((src[3] << 8) | src[2]);
-                    ce = (lf / 2) + (rf / 2);
-                    rr = lf - ce;
-                    lr = rf - ce;
-                    dst[0] = (lf & 0xFF);
-                    dst[1] = ((lf >> 8) & 0xFF);
-                    dst[2] = (rf & 0xFF);
-                    dst[3] = ((rf >> 8) & 0xFF);
-
-                    dst[0 + 4] = (lr & 0xFF);
-                    dst[1 + 4] = ((lr >> 8) & 0xFF);
-                    dst[2 + 4] = (rr & 0xFF);
-                    dst[3 + 4] = ((rr >> 8) & 0xFF);
-                }
-            }
-        }
-        break;
-
-    case AUDIO_S32:
-        {
-            const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt);
-            Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 2);
-            Sint32 lf, rf, ce;
-
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 8; i; --i) {
-                    dst -= 4;
-                    src -= 2;
-                    lf = (Sint32) SDL_SwapBE32(src[0]);
-                    rf = (Sint32) SDL_SwapBE32(src[1]);
-                    ce = (lf / 2) + (rf / 2);
-                    dst[0] = src[0];
-                    dst[1] = src[1];
-                    dst[2] = SDL_SwapBE32((Uint32) (lf - ce));
-                    dst[3] = SDL_SwapBE32((Uint32) (rf - ce));
-                }
-            } else {
-                for (i = cvt->len_cvt / 8; i; --i) {
-                    dst -= 4;
-                    src -= 2;
-                    lf = (Sint32) SDL_SwapLE32(src[0]);
-                    rf = (Sint32) SDL_SwapLE32(src[1]);
-                    ce = (lf / 2) + (rf / 2);
-                    dst[0] = src[0];
-                    dst[1] = src[1];
-                    dst[2] = SDL_SwapLE32((Uint32) (lf - ce));
-                    dst[3] = SDL_SwapLE32((Uint32) (rf - ce));
-                }
-            }
-        }
-        break;
-
-    case AUDIO_F32:
-        {
-            const float *src = (const float *) (cvt->buf + cvt->len_cvt);
-            float *dst = (float *) (cvt->buf + cvt->len_cvt * 2);
-            float lf, rf, ce;
-
-            if (SDL_AUDIO_ISBIGENDIAN(format)) {
-                for (i = cvt->len_cvt / 8; i; --i) {
-                    dst -= 4;
-                    src -= 2;
-                    lf = SDL_SwapFloatBE(src[0]);
-                    rf = SDL_SwapFloatBE(src[1]);
-                    ce = (lf / 2) + (rf / 2);
-                    dst[0] = src[0];
-                    dst[1] = src[1];
-                    dst[2] = SDL_SwapFloatBE(lf - ce);
-                    dst[3] = SDL_SwapFloatBE(rf - ce);
-                }
-            } else {
-                for (i = cvt->len_cvt / 8; i; --i) {
-                    dst -= 4;
-                    src -= 2;
-                    lf = SDL_SwapFloatLE(src[0]);
-                    rf = SDL_SwapFloatLE(src[1]);
-                    ce = (lf / 2) + (rf / 2);
-                    dst[0] = src[0];
-                    dst[1] = src[1];
-                    dst[2] = SDL_SwapFloatLE(lf - ce);
-                    dst[3] = SDL_SwapFloatLE(rf - ce);
-                }
-            }
-        }
-        break;
+    LOG_DEBUG_CONVERT("stereo", "quad");
+    SDL_assert(format == AUDIO_F32SYS);
+
+    for (i = cvt->len_cvt / 8; i; --i) {
+        dst -= 4;
+        src -= 2;
+        lf = src[0];
+        rf = src[1];
+        ce = (lf / 2) + (rf / 2);
+        dst[0] = src[0];
+        dst[1] = src[1];
+        dst[2] = lf - ce;
+        dst[3] = rf - ce;
     }
+
     cvt->len_cvt *= 2;
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index] (cvt, format);
@@ -818,67 +193,86 @@ SDL_ConvertAudio(SDL_AudioCVT * cvt)
 
     /* Make sure there's data to convert */
     if (cvt->buf == NULL) {
-        SDL_SetError("No buffer allocated for conversion");
-        return (-1);
+        return SDL_SetError("No buffer allocated for conversion");
     }
+
     /* Return okay if no conversion is necessary */
     cvt->len_cvt = cvt->len;
     if (cvt->filters[0] == NULL) {
-        return (0);
+        return 0;
     }
 
     /* Set up the conversion and go! */
     cvt->filter_index = 0;
     cvt->filters[0] (cvt, cvt->src_format);
-    return (0);
+    return 0;
 }
 
-
-static SDL_AudioFilter
-SDL_HandTunedTypeCVT(SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt)
+static void SDLCALL
+SDL_Convert_Byteswap(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
-    /*
-     * Fill in any future conversions that are specialized to a
-     *  processor, platform, compiler, or library here.
-     */
+    #if DEBUG_CONVERT
+    fprintf(stderr, "Converting byte order\n");
+    #endif
+
+    switch (SDL_AUDIO_BITSIZE(format)) {
+        #define CASESWAP(b) \
+            case b: { \
+                Uint##b *ptr = (Uint##b *) cvt->buf; \
+                int i; \
+                for (i = cvt->len_cvt / sizeof (*ptr); i; --i, ++ptr) { \
+                    *ptr = SDL_Swap##b(*ptr); \
+                } \
+                break; \
+            }
+
+        CASESWAP(16);
+        CASESWAP(32);
+        CASESWAP(64);
+
+        #undef CASESWAP
+
+        default: SDL_assert(!"unhandled byteswap datatype!"); break;
+    }
 
-    return NULL;                /* no specialized converter code available. */
+    if (cvt->filters[++cvt->filter_index]) {
+        /* flip endian flag for data. */
+        if (format & SDL_AUDIO_MASK_ENDIAN) {
+            format &= ~SDL_AUDIO_MASK_ENDIAN;
+        } else {
+            format |= SDL_AUDIO_MASK_ENDIAN;
+        }
+        cvt->filters[cvt->filter_index](cvt, format);
+    }
 }
 
 
-/*
- * Find a converter between two data types. We try to select a hand-tuned
- *  asm/vectorized/optimized function first, and then fallback to an
- *  autogenerated function that is customized to convert between two
- *  specific data types.
- */
 static int
-SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt,
-                      SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt)
+SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt)
 {
-    if (src_fmt != dst_fmt) {
-        const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt);
-        const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt);
-        SDL_AudioFilter filter = SDL_HandTunedTypeCVT(src_fmt, dst_fmt);
+    int retval = 0;  /* 0 == no conversion necessary. */
 
-        /* No hand-tuned converter? Try the autogenerated ones. */
-        if (filter == NULL) {
-            int i;
-            for (i = 0; sdl_audio_type_filters[i].filter != NULL; i++) {
-                const SDL_AudioTypeFilters *filt = &sdl_audio_type_filters[i];
-                if ((filt->src_fmt == src_fmt) && (filt->dst_fmt == dst_fmt)) {
-                    filter = filt->filter;
-                    break;
-                }
-            }
+    if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) {
+        cvt->filters[cvt->filter_index++] = SDL_Convert_Byteswap;
+        retval = 1;  /* added a converter. */
+    }
 
-            if (filter == NULL) {
-                SDL_SetError("No conversion available for these formats");
-                return -1;
-            }
+    if (!SDL_AUDIO_ISFLOAT(src_fmt)) {
+        SDL_AudioFilter filter = NULL;
+        switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
+            case AUDIO_S8: filter = SDL_Convert_S8_to_F32; break;
+            case AUDIO_U8: filter = SDL_Convert_U8_to_F32; break;
+            case AUDIO_S16: filter = SDL_Convert_S16_to_F32; break;
+            case AUDIO_S32: filter = SDL_Convert_S32_to_F32; break;
+            default: SDL_assert(!"Unexpected audio format!"); break;
         }
 
-        /* Update (cvt) with filter details... */
+        if (!filter) {
+            return SDL_SetError("No conversion available for these formats");
+        }
+
+        const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt);
+        const Uint16 dst_bitsize = 32;
         cvt->filters[cvt->filter_index++] = filter;
         if (src_bitsize < dst_bitsize) {
             const int mult = (dst_bitsize / src_bitsize);
@@ -887,24 +281,50 @@ SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt,
         } else if (src_bitsize > dst_bitsize) {
             cvt->len_ratio /= (src_bitsize / dst_bitsize);
         }
-
-        return 1;               /* added a converter. */
+        retval = 1;  /* added a converter. */
     }
 
-    return 0;                   /* no conversion necessary. */
+    return retval;
 }
 
-
-static SDL_AudioFilter
-SDL_HandTunedResampleCVT(SDL_AudioCVT * cvt, int dst_channels,
-                         int src_rate, int dst_rate)
+static int
+SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt)
 {
-    /*
-     * Fill in any future conversions that are specialized to a
-     *  processor, platform, compiler, or library here.
-     */
+    int retval = 0;  /* 0 == no conversion necessary. */
+
+    if (!SDL_AUDIO_ISFLOAT(dst_fmt)) {
+        SDL_AudioFilter filter = NULL;
+        switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
+            case AUDIO_S8: filter = SDL_Convert_F32_to_S8; break;
+            case AUDIO_U8: filter = SDL_Convert_F32_to_U8; break;
+            case AUDIO_S16: filter = SDL_Convert_F32_to_S16; break;
+            case AUDIO_S32: filter = SDL_Convert_F32_to_S32; break;
+            default: SDL_assert(!"Unexpected audio format!"); break;
+        }
+
+        if (!filter) {
+            return SDL_SetError("No conversion available for these formats");
+        }
 
-    return NULL;                /* no specialized converter code available. */
+        const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt);
+        const Uint16 src_bitsize = 32;
+        cvt->filters[cvt->filter_index++] = filter;
+        if (src_bitsize < dst_bitsize) {
+            const int mult = (dst_bitsize / src_bitsize);
+            cvt->len_mult *= mult;
+            cvt->len_ratio *= mult;
+        } else if (src_bitsize > dst_bitsize) {
+            cvt->len_ratio /= (src_bitsize / dst_bitsize);
+        }
+        retval = 1;  /* added a converter. */
+    }
+
+    if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) {
+        cvt->filters[cvt->filter_index++] = SDL_Convert_Byteswap;
+        retval = 1;  /* added a converter. */
+    }
+
+    return retval;
 }
 
 static int
@@ -913,7 +333,6 @@ SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate)
     int retval = 0;
 
     /* If we only built with the arbitrary resamplers, ignore multiples. */
-#if !LESS_RESAMPLERS
     int lo, hi;
     int div;
 
@@ -935,43 +354,90 @@ SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate)
 
     div = hi / lo;
     retval = ((div == 2) || (div == 4)) ? div : 0;
-#endif
 
     return retval;
 }
 
+#define RESAMPLER_FUNCS(chans) \
+    static void SDLCALL \
+    SDL_Upsample_Arbitrary_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \
+        SDL_assert(format == AUDIO_F32SYS); \
+        SDL_Upsample_Arbitrary(cvt, chans); \
+    }\
+    static void SDLCALL \
+    SDL_Downsample_Arbitrary_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \
+        SDL_assert(format == AUDIO_F32SYS); \
+        SDL_Downsample_Arbitrary(cvt, chans); \
+    } \
+    static void SDLCALL \
+    SDL_Upsample_x2_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \
+        SDL_assert(format == AUDIO_F32SYS); \
+        SDL_Upsample_x2(cvt, chans); \
+    } \
+    static void SDLCALL \
+    SDL_Downsample_x2_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \
+        SDL_assert(format == AUDIO_F32SYS); \
+        SDL_Downsample_Multiple(cvt, 2, chans); \
+    } \
+    static void SDLCALL \
+    SDL_Upsample_x4_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \
+        SDL_assert(format == AUDIO_F32SYS); \
+        SDL_Upsample_x4(cvt, chans); \
+    } \
+    static void SDLCALL \
+    SDL_Downsample_x4_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \
+        SDL_assert(format == AUDIO_F32SYS); \
+        SDL_Downsample_Multiple(cvt, 4, chans); \
+    }
+RESAMPLER_FUNCS(1)
+RESAMPLER_FUNCS(2)
+RESAMPLER_FUNCS(4)
+RESAMPLER_FUNCS(6)
+RESAMPLER_FUNCS(8)
+#undef RESAMPLER_FUNCS
+
 static int
 SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, int dst_channels,
                           int src_rate, int dst_rate)
 {
     if (src_rate != dst_rate) {
-        SDL_AudioFilter filter = SDL_HandTunedResampleCVT(cvt, dst_channels,
-                                                          src_rate, dst_rate);
+        const int upsample = (src_rate < dst_rate) ? 1 : 0;
+        const int multiple = SDL_FindFrequencyMultiple(src_rate, dst_rate);
+        SDL_AudioFilter filter = NULL;
+
+        #define PICK_CHANNEL_FILTER(upordown, resampler) switch (dst_channels) { \
+            case 1: filter = SDL_##upordown##_##resampler##_c1; break; \
+            case 2: filter = SDL_##upordown##_##resampler##_c2; break; \
+            case 4: filter = SDL_##upordown##_##resampler##_c4; break; \
+            case 6: filter = SDL_##upordown##_##resampler##_c6; break; \
+            case 8: filter = SDL_##upordown##_##resampler##_c8; break; \
+            default: break; \
+        }
 
-        /* No hand-tuned converter? Try the autogenerated ones. */
-        if (filter == NULL) {
-            int i;
-            const int upsample = (src_rate < dst_rate) ? 1 : 0;
-            const int multiple =
-                SDL_FindFrequencyMultiple(src_rate, dst_rate);
-
-            for (i = 0; sdl_audio_rate_filters[i].filter != NULL; i++) {
-                const SDL_AudioRateFilters *filt = &sdl_audio_rate_filters[i];
-                if ((filt->fmt == cvt->dst_format) &&
-                    (filt->channels == dst_channels) &&
-                    (filt->upsample == upsample) &&
-                    (filt->multiple == multiple)) {
-                    filter = filt->filter;
-                    break;
-                }
+        if (upsample) {
+            if (multiple == 0) {
+                PICK_CHANNEL_FILTER(Upsample, Arbitrary);
+            } else if (multiple == 2) {
+                PICK_CHANNEL_FILTER(Upsample, x2);
+            } else if (multiple == 4) {
+                PICK_CHANNEL_FILTER(Upsample, x4);
             }
-
-            if (filter == NULL) {
-                SDL_SetError("No conversion available for these rates");
-                return -1;
+        } else {
+            if (multiple == 0) {
+                PICK_CHANNEL_FILTER(Downsample, Arbitrary);
+            } else if (multiple == 2) {
+                PICK_CHANNEL_FILTER(Downsample, x2);
+            } else if (multiple == 4) {
+                PICK_CHANNEL_FILTER(Downsample, x4);
             }
         }
 
+        #undef PICK_CHANNEL_FILTER
+
+        if (filter == NULL) {
+            return SDL_SetError("No conversion available for these rates");
+        }
+
         /* Update (cvt) with filter details... */
         cvt->filters[cvt->filter_index++] = filter;
         if (src_rate < dst_rate) {
@@ -999,14 +465,6 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
                   SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate,
                   SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate)
 {
-    /*
-     * !!! FIXME: reorder filters based on which grow/shrink the buffer.
-     * !!! FIXME: ideally, we should do everything that shrinks the buffer
-     * !!! FIXME: first, so we don't have to process as many bytes in a given
-     * !!! FIXME: filter and abuse the CPU cache less. This might not be as
-     * !!! FIXME: good in practice as it sounds in theory, though.
-     */
-
     /* Sanity check target pointer */
     if (cvt == NULL) {
         return SDL_InvalidParamError("cvt");
@@ -1043,8 +501,31 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
     cvt->len_ratio = 1.0;
     cvt->rate_incr = ((double) dst_rate) / ((double) src_rate);
 
+    /* Type conversion goes like this now:
+        - byteswap to CPU native format first if necessary.
+        - convert to native Float32 if necessary.
+        - resample and change channel count if necessary.
+        - convert back to native format.
+        - byteswap back to foreign format if necessary.
+
+       The expectation is we can process data faster in float32
+       (possibly with SIMD), and making several passes over the same
+       buffer in is likely to be CPU cache-friendly, avoiding the
+       biggest performance hit in modern times. Previously we had
+       (script-generated) custom converters for every data type and
+       it was a bloat on SDL compile times and final library size. */
+
+    /* see if we can skip float conversion entirely (just a byteswap needed). */
+    if ((src_rate == dst_rate) && (src_channels == dst_channels) &&
+        ((src_fmt != dst_fmt) &&
+         ((src_fmt & ~SDL_AUDIO_MASK_ENDIAN) == (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN)))) {
+        cvt->filters[cvt->filter_index++] = SDL_Convert_Byteswap;
+        cvt->needed = 1;
+        return 1;
+    }
+
     /* Convert data types, if necessary. Updates (cvt). */
-    if (SDL_BuildAudioTypeCVT(cvt, src_fmt, dst_fmt) == -1) {
+    if (SDL_BuildAudioTypeCVTToFloat(cvt, src_fmt) == -1) {
         return -1;              /* shouldn't happen, but just in case... */
     }
 
@@ -1105,17 +586,13 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
         return -1;              /* shouldn't happen, but just in case... */
     }
 
-    /* Set up the filter information */
-    if (cvt->filter_index != 0) {
-        cvt->needed = 1;
-        cvt->src_format = src_fmt;
-        cvt->dst_format = dst_fmt;
-        cvt->len = 0;
-        cvt->buf = NULL;
-        cvt->filters[cvt->filter_index] = NULL;
+    if (SDL_BuildAudioTypeCVTFromFloat(cvt, dst_fmt) == -1) {
+        return -1;              /* shouldn't happen, but just in case... */
     }
+
+    cvt->needed = (cvt->filter_index != 0);
     return (cvt->needed);
 }
 
-
 /* vi: set ts=4 sw=4 expandtab: */
+

+ 215 - 15813
src/audio/SDL_audiotypecvt.c

@@ -1,4 +1,3 @@
-/* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
 /*
   Simple DirectMedia Layer
   Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
@@ -23,15993 +22,396 @@
 #include "../SDL_internal.h"
 #include "SDL_audio.h"
 #include "SDL_audio_c.h"
-
-#ifndef DEBUG_CONVERT
-#define DEBUG_CONVERT 0
-#endif
-
-
-/* If you can guarantee your data and need space, you can eliminate code... */
-
-/* Just build the arbitrary resamplers if you're saving code space. */
-#ifndef LESS_RESAMPLERS
-#define LESS_RESAMPLERS 0
-#endif
-
-/* Don't build any resamplers if you're REALLY saving code space. */
-#ifndef NO_RESAMPLERS
-#define NO_RESAMPLERS 0
-#endif
-
-/* Don't build any type converters if you're saving code space. */
-#ifndef NO_CONVERTERS
-#define NO_CONVERTERS 0
-#endif
-
-
-/* *INDENT-OFF* */
+#include "SDL_assert.h"
 
 #define DIVBY127 0.0078740157480315f
 #define DIVBY32767 3.05185094759972e-05f
 #define DIVBY2147483647 4.6566128752458e-10f
 
-#if !NO_CONVERTERS
-
-static void SDLCALL
-SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Sint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n");
-#endif
-
-    src = (const Uint8 *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
-        const Sint8 val = ((*src) ^ 0x80);
-        *dst = ((Sint8) val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n");
-#endif
-
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Uint16 val = (((Uint16) *src) << 8);
-        *dst = SDL_SwapLE16(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n");
-#endif
-
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n");
-#endif
-
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Uint16 val = (((Uint16) *src) << 8);
-        *dst = SDL_SwapBE16(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n");
-#endif
-
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
-        *dst = ((Sint16) SDL_SwapBE16(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n");
-#endif
-
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
-
-    cvt->len_cvt *= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n");
-#endif
-
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
-        *dst = ((Sint32) SDL_SwapBE32(val));
-    }
-
-    cvt->len_cvt *= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_S8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     int i;
-    const Uint8 *src;
-    float *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const float val = ((((float) *src) * DIVBY127) - 1.0f);
-        *dst = SDL_SwapFloatLE(val);
+        *dst = (((float) ((Sint8) *src)) * DIVBY127);
     }
 
     cvt->len_cvt *= 4;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_U8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     int i;
-    const Uint8 *src;
-    float *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const float val = ((((float) *src) * DIVBY127) - 1.0f);
-        *dst = SDL_SwapFloatBE(val);
+        *dst = ((((float) *src) * DIVBY127) - 1.0f);
     }
 
     cvt->len_cvt *= 4;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Uint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n");
-#endif
-
-    src = (const Uint8 *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
-        const Uint8 val = ((((Sint8) *src)) ^ 0x80);
-        *dst = val;
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_S16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
     int i;
-    const Uint8 *src;
-    Uint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
-        *dst = SDL_SwapLE16(val);
+    for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) {
+        *dst = (((float) *src) * DIVBY32767);
     }
 
     cvt->len_cvt *= 2;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_U16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
     int i;
-    const Uint8 *src;
-    Sint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
-        *dst = ((Sint16) SDL_SwapLE16(val));
+    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+        *dst = ((((float) *src) * DIVBY32767) - 1.0f);
     }
 
     cvt->len_cvt *= 2;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_S32_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Uint32 *src = (const Uint32 *) cvt->buf;
+    float *dst = (float *) cvt->buf;
     int i;
-    const Uint8 *src;
-    Uint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
-        *dst = SDL_SwapBE16(val);
+    for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) {
+        *dst = (((float) *src) * DIVBY2147483647);
     }
 
-    cvt->len_cvt *= 2;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_S8(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint8 *dst = (Sint8 *) cvt->buf;
     int i;
-    const Uint8 *src;
-    Sint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
-        *dst = ((Sint16) SDL_SwapBE16(val));
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        *dst = (Sint8) (*src * 127.0f);
     }
 
-    cvt->len_cvt *= 2;
+    cvt->len_cvt /= 4;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_S8);
     }
 }
 
-static void SDLCALL
-SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_U8(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Uint8 *dst = (Uint8 *) cvt->buf;
     int i;
-    const Uint8 *src;
-    Sint32 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
-        *dst = ((Sint32) SDL_SwapLE32(val));
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        *dst = (Uint8) ((*src + 1.0f) * 127.0f);
     }
 
-    cvt->len_cvt *= 4;
+    cvt->len_cvt /= 4;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_U8);
     }
 }
 
-static void SDLCALL
-SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_S16(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint16 *dst = (Sint16 *) cvt->buf;
     int i;
-    const Uint8 *src;
-    Sint32 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
-        *dst = ((Sint32) SDL_SwapBE32(val));
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        *dst = (Sint16) (*src * 32767.0f);
     }
 
-    cvt->len_cvt *= 4;
+    cvt->len_cvt /= 2;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_U16(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Uint16 *dst = (Uint16 *) cvt->buf;
     int i;
-    const Uint8 *src;
-    float *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const float val = (((float) ((Sint8) *src)) * DIVBY127);
-        *dst = SDL_SwapFloatLE(val);
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
     }
 
-    cvt->len_cvt *= 4;
+    cvt->len_cvt /= 2;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_S32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint32 *dst = (Sint32 *) cvt->buf;
     int i;
-    const Uint8 *src;
-    float *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32");
 
-    src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
-        const float val = (((float) ((Sint8) *src)) * DIVBY127);
-        *dst = SDL_SwapFloatBE(val);
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        *dst = (Sint32) (*src * 2147483647.0);
     }
 
-    cvt->len_cvt *= 4;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void
+SDL_Upsample_Arbitrary(SDL_AudioCVT *cvt, const int channels)
 {
+    const int srcsize = cvt->len_cvt - (64 * channels);
+    const int dstsize = (int) (((double)(cvt->len_cvt/(channels*4))) * cvt->rate_incr) * (channels*4);
+    register int eps = 0;
+    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
+    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
+    const float *target = ((const float *) cvt->buf);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
+    float sample[8];
     int i;
-    const Uint16 *src;
-    Uint8 *dst;
 
 #if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n");
+    fprintf(stderr, "Upsample arbitrary (x%f), %d channels.\n", cvt->rate_incr, channels);
 #endif
 
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8));
-        *dst = val;
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint8 *dst;
+    SDL_assert(channels <= 8);
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n");
-#endif
+    SDL_memcpy(sample, src, cpy);
+    SDL_memcpy(last_sample, src, cpy);
 
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8));
-        *dst = ((Sint8) val);
+    while (dst >= target) {
+        SDL_memcpy(dst, sample, cpy);
+        dst -= 8;
+        eps += srcsize;
+        if ((eps << 1) >= dstsize) {
+            src -= 8;
+            for (i = 0; i < channels; i++) {
+                sample[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.5);
+            }
+            SDL_memcpy(last_sample, sample, cpy);
+            eps -= dstsize;
+        }
     }
 
-    cvt->len_cvt /= 2;
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void
+SDL_Downsample_Arbitrary(SDL_AudioCVT *cvt, const int channels)
 {
+    const int srcsize = cvt->len_cvt - (64 * channels);
+    const int dstsize = (int) (((double)(cvt->len_cvt/(channels*4))) * cvt->rate_incr) * (channels*4);
+    register int eps = 0;
+    float *dst = (float *) cvt->buf;
+    const float *src = (float *) cvt->buf;
+    const float *target = (const float *) (cvt->buf + dstsize);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
+    float sample[8];
     int i;
-    const Uint16 *src;
-    Sint16 *dst;
 
 #if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n");
+    fprintf(stderr, "Downsample arbitrary (x%f), %d channels.\n", cvt->rate_incr, channels);
 #endif
 
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint16 *dst;
+    SDL_assert(channels <= 8);
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n");
-#endif
+    SDL_memcpy(sample, src, cpy);
+    SDL_memcpy(last_sample, src, cpy);
 
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint16 val = SDL_SwapLE16(*src);
-        *dst = SDL_SwapBE16(val);
+    while (dst < target) {
+        src += 8;
+        eps += dstsize;
+        if ((eps << 1) >= srcsize) {
+            SDL_memcpy(dst, sample, cpy);
+            dst += 8;
+            for (i = 0; i < channels; i++) {
+                sample[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.5);
+            }
+            SDL_memcpy(last_sample, sample, cpy);
+            eps -= srcsize;
+        }
     }
 
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void
+SDL_Upsample_x2(SDL_AudioCVT *cvt, const int channels)
 {
+    const int dstsize = cvt->len_cvt * 2;
+    float *dst = ((float *) (cvt->buf + dstsize)) - (channels * 2);
+    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - channels;
+    const float *target = ((const float *) cvt->buf);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
     int i;
-    const Uint16 *src;
-    Sint16 *dst;
 
 #if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n");
+    fprintf(stderr, "Upsample (x2), %d channels.\n", channels);
 #endif
 
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
-        *dst = ((Sint16) SDL_SwapBE16(val));
+    SDL_assert(channels <= 8);
+    SDL_memcpy(last_sample, src, cpy);
+
+    while (dst >= target) {
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) ((((double)src[i]) + ((double)last_sample[i])) * 0.5);
+        }
+        dst -= channels;
+        SDL_memcpy(dst, src, cpy);
+        SDL_memcpy(last_sample, src, cpy);
+        src -= channels;
+        dst -= channels;
     }
 
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void
+SDL_Upsample_x4(SDL_AudioCVT *cvt, const int channels)
 {
+    const int dstsize = cvt->len_cvt * 4;
+    float *dst = ((float *) (cvt->buf + dstsize)) - (channels * 4);
+    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - channels;
+    const float *target = ((const float *) cvt->buf);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
     int i;
-    const Uint16 *src;
-    Sint32 *dst;
 
 #if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n");
+    fprintf(stderr, "Upsample (x4), %d channels.\n", channels);
 #endif
 
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
-        *dst = ((Sint32) SDL_SwapLE32(val));
+    SDL_assert(channels <= 8);
+    SDL_memcpy(last_sample, src, cpy);
+
+    while (dst >= target) {
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) ((((double) src[i]) + (3.0 * ((double) last_sample[i]))) * 0.25);
+        }
+        dst -= channels;
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.25);
+        }
+        dst -= channels;
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) (((3.0 * ((double) src[i])) + ((double) last_sample[i])) * 0.25);
+        }
+        dst -= channels;
+        SDL_memcpy(dst, src, cpy);
+        dst -= channels;
+        SDL_memcpy(last_sample, src, cpy);
+        src -= channels;
     }
 
-    cvt->len_cvt *= 2;
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+void
+SDL_Downsample_Multiple(SDL_AudioCVT *cvt, const int multiple, const int channels)
 {
+    const int dstsize = cvt->len_cvt / multiple;
+    float *dst = (float *) cvt->buf;
+    const float *src = (float *) cvt->buf;
+    const float *target = (const float *) (cvt->buf + dstsize);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
     int i;
-    const Uint16 *src;
-    Sint32 *dst;
 
 #if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n");
+    fprintf(stderr, "Downsample (x%d), %d channels.\n", multiple, channels);
 #endif
 
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
-        *dst = ((Sint32) SDL_SwapBE32(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
+    SDL_assert(channels <= 8);
+    SDL_memcpy(last_sample, src, cpy);
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n");
-#endif
+    while (dst < target) {
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) ((((double)src[i]) + ((double)last_sample[i])) * 0.5);
+        }
+        dst += channels;
 
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
-        *dst = SDL_SwapFloatLE(val);
+        SDL_memcpy(last_sample, src, cpy);
+        src += (channels * multiple);
     }
 
-    cvt->len_cvt *= 2;
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
 }
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
-        *dst = SDL_SwapFloatBE(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8));
-        *dst = val;
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8));
-        *dst = ((Sint8) val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
-        *dst = SDL_SwapLE16(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
-        *dst = SDL_SwapBE16(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) SDL_SwapLE16(*src));
-        *dst = ((Sint16) SDL_SwapBE16(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
-        *dst = ((Sint32) SDL_SwapBE32(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
-        *dst = SDL_SwapFloatLE(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
-        *dst = SDL_SwapFloatBE(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8));
-        *dst = val;
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8));
-        *dst = ((Sint8) val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint16 val = SDL_SwapBE16(*src);
-        *dst = SDL_SwapLE16(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
-        *dst = ((Sint16) SDL_SwapBE16(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
-        *dst = ((Sint32) SDL_SwapBE32(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
-        *dst = SDL_SwapFloatLE(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
-        *dst = SDL_SwapFloatBE(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8));
-        *dst = val;
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8));
-        *dst = ((Sint8) val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
-        *dst = SDL_SwapLE16(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) SDL_SwapBE16(*src));
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n");
-#endif
-
-    src = (const Uint16 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
-        const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
-        *dst = SDL_SwapBE16(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
-        *dst = ((Sint32) SDL_SwapBE32(val));
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
-        *dst = SDL_SwapFloatLE(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n");
-#endif
-
-    src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
-    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
-        *dst = SDL_SwapFloatBE(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Uint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24));
-        *dst = val;
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Sint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24));
-        *dst = ((Sint8) val);
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
-        *dst = SDL_SwapLE16(val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
-        *dst = SDL_SwapBE16(val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
-        *dst = ((Sint16) SDL_SwapBE16(val));
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Sint32 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Sint32 val = ((Sint32) SDL_SwapLE32(*src));
-        *dst = ((Sint32) SDL_SwapBE32(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (float *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
-        *dst = SDL_SwapFloatLE(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (float *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
-        *dst = SDL_SwapFloatBE(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Uint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24));
-        *dst = val;
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Sint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24));
-        *dst = ((Sint8) val);
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
-        *dst = SDL_SwapLE16(val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
-        *dst = SDL_SwapBE16(val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
-        *dst = ((Sint16) SDL_SwapBE16(val));
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (Sint32 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const Sint32 val = ((Sint32) SDL_SwapBE32(*src));
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (float *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
-        *dst = SDL_SwapFloatLE(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint32 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n");
-#endif
-
-    src = (const Uint32 *) cvt->buf;
-    dst = (float *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
-        const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
-        *dst = SDL_SwapFloatBE(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Uint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f));
-        *dst = val;
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f));
-        *dst = ((Sint8) val);
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
-        *dst = SDL_SwapLE16(val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
-        *dst = SDL_SwapBE16(val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
-        *dst = ((Sint16) SDL_SwapBE16(val));
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint32 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint32 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
-        *dst = ((Sint32) SDL_SwapBE32(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (float *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const float val = SDL_SwapFloatLE(*src);
-        *dst = SDL_SwapFloatBE(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Uint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Uint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f));
-        *dst = val;
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint8 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint8 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f));
-        *dst = ((Sint8) val);
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
-        *dst = SDL_SwapLE16(val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Uint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
-        *dst = SDL_SwapBE16(val);
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint16 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
-        *dst = ((Sint16) SDL_SwapBE16(val));
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint32 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (Sint32 *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
-        *dst = ((Sint32) SDL_SwapBE32(val));
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const float *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n");
-#endif
-
-    src = (const float *) cvt->buf;
-    dst = (float *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const float val = SDL_SwapFloatBE(*src);
-        *dst = SDL_SwapFloatLE(val);
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
-    }
-}
-
-#endif  /* !NO_CONVERTERS */
-
-
-const SDL_AudioTypeFilters sdl_audio_type_filters[] =
-{
-#if !NO_CONVERTERS
-    { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 },
-    { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB },
-    { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB },
-    { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB },
-    { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB },
-    { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB },
-    { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB },
-    { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB },
-    { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB },
-    { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 },
-    { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB },
-    { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB },
-    { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB },
-    { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB },
-    { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB },
-    { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB },
-    { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB },
-    { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB },
-    { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 },
-    { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 },
-    { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB },
-    { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB },
-    { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB },
-    { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB },
-    { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB },
-    { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB },
-    { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB },
-    { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 },
-    { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 },
-    { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB },
-    { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB },
-    { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB },
-    { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB },
-    { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB },
-    { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB },
-    { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB },
-    { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 },
-    { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 },
-    { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB },
-    { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB },
-    { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB },
-    { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB },
-    { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB },
-    { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB },
-    { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB },
-    { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 },
-    { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 },
-    { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB },
-    { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB },
-    { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB },
-    { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB },
-    { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB },
-    { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB },
-    { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB },
-    { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 },
-    { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 },
-    { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB },
-    { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB },
-    { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB },
-    { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB },
-    { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB },
-    { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB },
-    { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB },
-    { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 },
-    { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 },
-    { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB },
-    { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB },
-    { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB },
-    { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB },
-    { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB },
-    { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB },
-    { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB },
-    { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 },
-    { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 },
-    { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB },
-    { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB },
-    { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB },
-    { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB },
-    { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB },
-    { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB },
-    { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB },
-    { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 },
-    { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 },
-    { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB },
-    { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB },
-    { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB },
-    { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB },
-    { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB },
-    { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB },
-    { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB },
-#endif  /* !NO_CONVERTERS */
-    { 0, 0, NULL }
-};
-
-
-#if !NO_RESAMPLERS
-
-static void SDLCALL
-SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 16;
-    const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
-    register int eps = 0;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Uint8 sample0 = src[0];
-    Uint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = sample0;
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 16;
-    const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
-    register int eps = 0;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Uint8 sample0 = src[0];
-    Uint8 last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = sample0;
-            dst++;
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Uint8 sample1 = src[1];
-    Uint8 sample0 = src[0];
-    Uint8 last_sample1 = sample1;
-    Uint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = sample1;
-        dst[0] = sample0;
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Uint8 sample0 = src[0];
-    Uint8 sample1 = src[1];
-    Uint8 last_sample0 = sample0;
-    Uint8 last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = sample0;
-            dst[1] = sample1;
-            dst += 2;
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Uint8 sample3 = src[3];
-    Uint8 sample2 = src[2];
-    Uint8 sample1 = src[1];
-    Uint8 sample0 = src[0];
-    Uint8 last_sample3 = sample3;
-    Uint8 last_sample2 = sample2;
-    Uint8 last_sample1 = sample1;
-    Uint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = sample3;
-        dst[2] = sample2;
-        dst[1] = sample1;
-        dst[0] = sample0;
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
-            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
-            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Uint8 sample0 = src[0];
-    Uint8 sample1 = src[1];
-    Uint8 sample2 = src[2];
-    Uint8 sample3 = src[3];
-    Uint8 last_sample0 = sample0;
-    Uint8 last_sample1 = sample1;
-    Uint8 last_sample2 = sample2;
-    Uint8 last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = sample0;
-            dst[1] = sample1;
-            dst[2] = sample2;
-            dst[3] = sample3;
-            dst += 4;
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
-            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
-            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 96;
-    const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
-    register int eps = 0;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Uint8 sample5 = src[5];
-    Uint8 sample4 = src[4];
-    Uint8 sample3 = src[3];
-    Uint8 sample2 = src[2];
-    Uint8 sample1 = src[1];
-    Uint8 sample0 = src[0];
-    Uint8 last_sample5 = sample5;
-    Uint8 last_sample4 = sample4;
-    Uint8 last_sample3 = sample3;
-    Uint8 last_sample2 = sample2;
-    Uint8 last_sample1 = sample1;
-    Uint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = sample5;
-        dst[4] = sample4;
-        dst[3] = sample3;
-        dst[2] = sample2;
-        dst[1] = sample1;
-        dst[0] = sample0;
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
-            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
-            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
-            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
-            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 96;
-    const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
-    register int eps = 0;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Uint8 sample0 = src[0];
-    Uint8 sample1 = src[1];
-    Uint8 sample2 = src[2];
-    Uint8 sample3 = src[3];
-    Uint8 sample4 = src[4];
-    Uint8 sample5 = src[5];
-    Uint8 last_sample0 = sample0;
-    Uint8 last_sample1 = sample1;
-    Uint8 last_sample2 = sample2;
-    Uint8 last_sample3 = sample3;
-    Uint8 last_sample4 = sample4;
-    Uint8 last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = sample0;
-            dst[1] = sample1;
-            dst[2] = sample2;
-            dst[3] = sample3;
-            dst[4] = sample4;
-            dst[5] = sample5;
-            dst += 6;
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
-            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
-            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
-            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
-            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Uint8 sample7 = src[7];
-    Uint8 sample6 = src[6];
-    Uint8 sample5 = src[5];
-    Uint8 sample4 = src[4];
-    Uint8 sample3 = src[3];
-    Uint8 sample2 = src[2];
-    Uint8 sample1 = src[1];
-    Uint8 sample0 = src[0];
-    Uint8 last_sample7 = sample7;
-    Uint8 last_sample6 = sample6;
-    Uint8 last_sample5 = sample5;
-    Uint8 last_sample4 = sample4;
-    Uint8 last_sample3 = sample3;
-    Uint8 last_sample2 = sample2;
-    Uint8 last_sample1 = sample1;
-    Uint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = sample7;
-        dst[6] = sample6;
-        dst[5] = sample5;
-        dst[4] = sample4;
-        dst[3] = sample3;
-        dst[2] = sample2;
-        dst[1] = sample1;
-        dst[0] = sample0;
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
-            sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
-            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
-            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
-            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
-            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
-            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Uint8 sample0 = src[0];
-    Uint8 sample1 = src[1];
-    Uint8 sample2 = src[2];
-    Uint8 sample3 = src[3];
-    Uint8 sample4 = src[4];
-    Uint8 sample5 = src[5];
-    Uint8 sample6 = src[6];
-    Uint8 sample7 = src[7];
-    Uint8 last_sample0 = sample0;
-    Uint8 last_sample1 = sample1;
-    Uint8 last_sample2 = sample2;
-    Uint8 last_sample3 = sample3;
-    Uint8 last_sample4 = sample4;
-    Uint8 last_sample5 = sample5;
-    Uint8 last_sample6 = sample6;
-    Uint8 last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = sample0;
-            dst[1] = sample1;
-            dst[2] = sample2;
-            dst[3] = sample3;
-            dst[4] = sample4;
-            dst[5] = sample5;
-            dst[6] = sample6;
-            dst[7] = sample7;
-            dst += 8;
-            sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
-            sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
-            sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
-            sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
-            sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
-            sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
-            sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
-            sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 16;
-    const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
-    register int eps = 0;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = ((Sint8) sample0);
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 16;
-    const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1;
-    register int eps = 0;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint8) sample0);
-            dst++;
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint8 sample1 = ((Sint8) src[1]);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 last_sample1 = sample1;
-    Sint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = ((Sint8) sample1);
-        dst[0] = ((Sint8) sample0);
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 sample1 = ((Sint8) src[1]);
-    Sint8 last_sample0 = sample0;
-    Sint8 last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint8) sample0);
-            dst[1] = ((Sint8) sample1);
-            dst += 2;
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint8 sample3 = ((Sint8) src[3]);
-    Sint8 sample2 = ((Sint8) src[2]);
-    Sint8 sample1 = ((Sint8) src[1]);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 last_sample3 = sample3;
-    Sint8 last_sample2 = sample2;
-    Sint8 last_sample1 = sample1;
-    Sint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = ((Sint8) sample3);
-        dst[2] = ((Sint8) sample2);
-        dst[1] = ((Sint8) sample1);
-        dst[0] = ((Sint8) sample0);
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
-            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
-            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 sample1 = ((Sint8) src[1]);
-    Sint8 sample2 = ((Sint8) src[2]);
-    Sint8 sample3 = ((Sint8) src[3]);
-    Sint8 last_sample0 = sample0;
-    Sint8 last_sample1 = sample1;
-    Sint8 last_sample2 = sample2;
-    Sint8 last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint8) sample0);
-            dst[1] = ((Sint8) sample1);
-            dst[2] = ((Sint8) sample2);
-            dst[3] = ((Sint8) sample3);
-            dst += 4;
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
-            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
-            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 96;
-    const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
-    register int eps = 0;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint8 sample5 = ((Sint8) src[5]);
-    Sint8 sample4 = ((Sint8) src[4]);
-    Sint8 sample3 = ((Sint8) src[3]);
-    Sint8 sample2 = ((Sint8) src[2]);
-    Sint8 sample1 = ((Sint8) src[1]);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 last_sample5 = sample5;
-    Sint8 last_sample4 = sample4;
-    Sint8 last_sample3 = sample3;
-    Sint8 last_sample2 = sample2;
-    Sint8 last_sample1 = sample1;
-    Sint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = ((Sint8) sample5);
-        dst[4] = ((Sint8) sample4);
-        dst[3] = ((Sint8) sample3);
-        dst[2] = ((Sint8) sample2);
-        dst[1] = ((Sint8) sample1);
-        dst[0] = ((Sint8) sample0);
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
-            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
-            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
-            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
-            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 96;
-    const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6;
-    register int eps = 0;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 sample1 = ((Sint8) src[1]);
-    Sint8 sample2 = ((Sint8) src[2]);
-    Sint8 sample3 = ((Sint8) src[3]);
-    Sint8 sample4 = ((Sint8) src[4]);
-    Sint8 sample5 = ((Sint8) src[5]);
-    Sint8 last_sample0 = sample0;
-    Sint8 last_sample1 = sample1;
-    Sint8 last_sample2 = sample2;
-    Sint8 last_sample3 = sample3;
-    Sint8 last_sample4 = sample4;
-    Sint8 last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint8) sample0);
-            dst[1] = ((Sint8) sample1);
-            dst[2] = ((Sint8) sample2);
-            dst[3] = ((Sint8) sample3);
-            dst[4] = ((Sint8) sample4);
-            dst[5] = ((Sint8) sample5);
-            dst += 6;
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
-            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
-            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
-            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
-            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint8 sample7 = ((Sint8) src[7]);
-    Sint8 sample6 = ((Sint8) src[6]);
-    Sint8 sample5 = ((Sint8) src[5]);
-    Sint8 sample4 = ((Sint8) src[4]);
-    Sint8 sample3 = ((Sint8) src[3]);
-    Sint8 sample2 = ((Sint8) src[2]);
-    Sint8 sample1 = ((Sint8) src[1]);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 last_sample7 = sample7;
-    Sint8 last_sample6 = sample6;
-    Sint8 last_sample5 = sample5;
-    Sint8 last_sample4 = sample4;
-    Sint8 last_sample3 = sample3;
-    Sint8 last_sample2 = sample2;
-    Sint8 last_sample1 = sample1;
-    Sint8 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = ((Sint8) sample7);
-        dst[6] = ((Sint8) sample6);
-        dst[5] = ((Sint8) sample5);
-        dst[4] = ((Sint8) sample4);
-        dst[3] = ((Sint8) sample3);
-        dst[2] = ((Sint8) sample2);
-        dst[1] = ((Sint8) sample1);
-        dst[0] = ((Sint8) sample0);
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
-            sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
-            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
-            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
-            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
-            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
-            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint8 sample0 = ((Sint8) src[0]);
-    Sint8 sample1 = ((Sint8) src[1]);
-    Sint8 sample2 = ((Sint8) src[2]);
-    Sint8 sample3 = ((Sint8) src[3]);
-    Sint8 sample4 = ((Sint8) src[4]);
-    Sint8 sample5 = ((Sint8) src[5]);
-    Sint8 sample6 = ((Sint8) src[6]);
-    Sint8 sample7 = ((Sint8) src[7]);
-    Sint8 last_sample0 = sample0;
-    Sint8 last_sample1 = sample1;
-    Sint8 last_sample2 = sample2;
-    Sint8 last_sample3 = sample3;
-    Sint8 last_sample4 = sample4;
-    Sint8 last_sample5 = sample5;
-    Sint8 last_sample6 = sample6;
-    Sint8 last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint8) sample0);
-            dst[1] = ((Sint8) sample1);
-            dst[2] = ((Sint8) sample2);
-            dst[3] = ((Sint8) sample3);
-            dst[4] = ((Sint8) sample4);
-            dst[5] = ((Sint8) sample5);
-            dst[6] = ((Sint8) sample6);
-            dst[7] = ((Sint8) sample7);
-            dst += 8;
-            sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
-            sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
-            sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
-            sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
-            sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
-            sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
-            sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
-            sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = SDL_SwapLE16(sample0);
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapLE16(sample0);
-            dst++;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample1 = SDL_SwapLE16(src[1]);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = SDL_SwapLE16(sample1);
-        dst[0] = SDL_SwapLE16(sample0);
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 sample1 = SDL_SwapLE16(src[1]);
-    Uint16 last_sample0 = sample0;
-    Uint16 last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapLE16(sample0);
-            dst[1] = SDL_SwapLE16(sample1);
-            dst += 2;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample3 = SDL_SwapLE16(src[3]);
-    Uint16 sample2 = SDL_SwapLE16(src[2]);
-    Uint16 sample1 = SDL_SwapLE16(src[1]);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = SDL_SwapLE16(sample3);
-        dst[2] = SDL_SwapLE16(sample2);
-        dst[1] = SDL_SwapLE16(sample1);
-        dst[0] = SDL_SwapLE16(sample0);
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 sample1 = SDL_SwapLE16(src[1]);
-    Uint16 sample2 = SDL_SwapLE16(src[2]);
-    Uint16 sample3 = SDL_SwapLE16(src[3]);
-    Uint16 last_sample0 = sample0;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapLE16(sample0);
-            dst[1] = SDL_SwapLE16(sample1);
-            dst[2] = SDL_SwapLE16(sample2);
-            dst[3] = SDL_SwapLE16(sample3);
-            dst += 4;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 192;
-    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample5 = SDL_SwapLE16(src[5]);
-    Uint16 sample4 = SDL_SwapLE16(src[4]);
-    Uint16 sample3 = SDL_SwapLE16(src[3]);
-    Uint16 sample2 = SDL_SwapLE16(src[2]);
-    Uint16 sample1 = SDL_SwapLE16(src[1]);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 last_sample5 = sample5;
-    Uint16 last_sample4 = sample4;
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = SDL_SwapLE16(sample5);
-        dst[4] = SDL_SwapLE16(sample4);
-        dst[3] = SDL_SwapLE16(sample3);
-        dst[2] = SDL_SwapLE16(sample2);
-        dst[1] = SDL_SwapLE16(sample1);
-        dst[0] = SDL_SwapLE16(sample0);
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
-            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 192;
-    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 sample1 = SDL_SwapLE16(src[1]);
-    Uint16 sample2 = SDL_SwapLE16(src[2]);
-    Uint16 sample3 = SDL_SwapLE16(src[3]);
-    Uint16 sample4 = SDL_SwapLE16(src[4]);
-    Uint16 sample5 = SDL_SwapLE16(src[5]);
-    Uint16 last_sample0 = sample0;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample4 = sample4;
-    Uint16 last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapLE16(sample0);
-            dst[1] = SDL_SwapLE16(sample1);
-            dst[2] = SDL_SwapLE16(sample2);
-            dst[3] = SDL_SwapLE16(sample3);
-            dst[4] = SDL_SwapLE16(sample4);
-            dst[5] = SDL_SwapLE16(sample5);
-            dst += 6;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
-            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample7 = SDL_SwapLE16(src[7]);
-    Uint16 sample6 = SDL_SwapLE16(src[6]);
-    Uint16 sample5 = SDL_SwapLE16(src[5]);
-    Uint16 sample4 = SDL_SwapLE16(src[4]);
-    Uint16 sample3 = SDL_SwapLE16(src[3]);
-    Uint16 sample2 = SDL_SwapLE16(src[2]);
-    Uint16 sample1 = SDL_SwapLE16(src[1]);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 last_sample7 = sample7;
-    Uint16 last_sample6 = sample6;
-    Uint16 last_sample5 = sample5;
-    Uint16 last_sample4 = sample4;
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = SDL_SwapLE16(sample7);
-        dst[6] = SDL_SwapLE16(sample6);
-        dst[5] = SDL_SwapLE16(sample5);
-        dst[4] = SDL_SwapLE16(sample4);
-        dst[3] = SDL_SwapLE16(sample3);
-        dst[2] = SDL_SwapLE16(sample2);
-        dst[1] = SDL_SwapLE16(sample1);
-        dst[0] = SDL_SwapLE16(sample0);
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
-            sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
-            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
-            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapLE16(src[0]);
-    Uint16 sample1 = SDL_SwapLE16(src[1]);
-    Uint16 sample2 = SDL_SwapLE16(src[2]);
-    Uint16 sample3 = SDL_SwapLE16(src[3]);
-    Uint16 sample4 = SDL_SwapLE16(src[4]);
-    Uint16 sample5 = SDL_SwapLE16(src[5]);
-    Uint16 sample6 = SDL_SwapLE16(src[6]);
-    Uint16 sample7 = SDL_SwapLE16(src[7]);
-    Uint16 last_sample0 = sample0;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample4 = sample4;
-    Uint16 last_sample5 = sample5;
-    Uint16 last_sample6 = sample6;
-    Uint16 last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapLE16(sample0);
-            dst[1] = SDL_SwapLE16(sample1);
-            dst[2] = SDL_SwapLE16(sample2);
-            dst[3] = SDL_SwapLE16(sample3);
-            dst[4] = SDL_SwapLE16(sample4);
-            dst[5] = SDL_SwapLE16(sample5);
-            dst[6] = SDL_SwapLE16(sample6);
-            dst[7] = SDL_SwapLE16(sample7);
-            dst += 8;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
-            sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
-            sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
-            sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-            dst++;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
-        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
-    Sint16 last_sample0 = sample0;
-    Sint16 last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
-            dst += 2;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
-    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
-    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
-        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
-        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
-        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
-    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
-    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
-    Sint16 last_sample0 = sample0;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
-            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
-            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
-            dst += 4;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 192;
-    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
-    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
-    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
-    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
-    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 last_sample5 = sample5;
-    Sint16 last_sample4 = sample4;
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = ((Sint16) SDL_SwapLE16(sample5));
-        dst[4] = ((Sint16) SDL_SwapLE16(sample4));
-        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
-        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
-        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
-        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
-            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 192;
-    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
-    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
-    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
-    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
-    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
-    Sint16 last_sample0 = sample0;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample4 = sample4;
-    Sint16 last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
-            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
-            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
-            dst[4] = ((Sint16) SDL_SwapLE16(sample4));
-            dst[5] = ((Sint16) SDL_SwapLE16(sample5));
-            dst += 6;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
-            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
-    Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
-    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
-    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
-    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
-    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
-    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 last_sample7 = sample7;
-    Sint16 last_sample6 = sample6;
-    Sint16 last_sample5 = sample5;
-    Sint16 last_sample4 = sample4;
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = ((Sint16) SDL_SwapLE16(sample7));
-        dst[6] = ((Sint16) SDL_SwapLE16(sample6));
-        dst[5] = ((Sint16) SDL_SwapLE16(sample5));
-        dst[4] = ((Sint16) SDL_SwapLE16(sample4));
-        dst[3] = ((Sint16) SDL_SwapLE16(sample3));
-        dst[2] = ((Sint16) SDL_SwapLE16(sample2));
-        dst[1] = ((Sint16) SDL_SwapLE16(sample1));
-        dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
-            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
-            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
-            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
-    Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
-    Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
-    Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
-    Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
-    Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
-    Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
-    Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
-    Sint16 last_sample0 = sample0;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample4 = sample4;
-    Sint16 last_sample5 = sample5;
-    Sint16 last_sample6 = sample6;
-    Sint16 last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapLE16(sample0));
-            dst[1] = ((Sint16) SDL_SwapLE16(sample1));
-            dst[2] = ((Sint16) SDL_SwapLE16(sample2));
-            dst[3] = ((Sint16) SDL_SwapLE16(sample3));
-            dst[4] = ((Sint16) SDL_SwapLE16(sample4));
-            dst[5] = ((Sint16) SDL_SwapLE16(sample5));
-            dst[6] = ((Sint16) SDL_SwapLE16(sample6));
-            dst[7] = ((Sint16) SDL_SwapLE16(sample7));
-            dst += 8;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
-            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
-            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
-            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = SDL_SwapBE16(sample0);
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapBE16(sample0);
-            dst++;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample1 = SDL_SwapBE16(src[1]);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = SDL_SwapBE16(sample1);
-        dst[0] = SDL_SwapBE16(sample0);
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 sample1 = SDL_SwapBE16(src[1]);
-    Uint16 last_sample0 = sample0;
-    Uint16 last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapBE16(sample0);
-            dst[1] = SDL_SwapBE16(sample1);
-            dst += 2;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample3 = SDL_SwapBE16(src[3]);
-    Uint16 sample2 = SDL_SwapBE16(src[2]);
-    Uint16 sample1 = SDL_SwapBE16(src[1]);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = SDL_SwapBE16(sample3);
-        dst[2] = SDL_SwapBE16(sample2);
-        dst[1] = SDL_SwapBE16(sample1);
-        dst[0] = SDL_SwapBE16(sample0);
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 sample1 = SDL_SwapBE16(src[1]);
-    Uint16 sample2 = SDL_SwapBE16(src[2]);
-    Uint16 sample3 = SDL_SwapBE16(src[3]);
-    Uint16 last_sample0 = sample0;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapBE16(sample0);
-            dst[1] = SDL_SwapBE16(sample1);
-            dst[2] = SDL_SwapBE16(sample2);
-            dst[3] = SDL_SwapBE16(sample3);
-            dst += 4;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 192;
-    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample5 = SDL_SwapBE16(src[5]);
-    Uint16 sample4 = SDL_SwapBE16(src[4]);
-    Uint16 sample3 = SDL_SwapBE16(src[3]);
-    Uint16 sample2 = SDL_SwapBE16(src[2]);
-    Uint16 sample1 = SDL_SwapBE16(src[1]);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 last_sample5 = sample5;
-    Uint16 last_sample4 = sample4;
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = SDL_SwapBE16(sample5);
-        dst[4] = SDL_SwapBE16(sample4);
-        dst[3] = SDL_SwapBE16(sample3);
-        dst[2] = SDL_SwapBE16(sample2);
-        dst[1] = SDL_SwapBE16(sample1);
-        dst[0] = SDL_SwapBE16(sample0);
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
-            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 192;
-    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 sample1 = SDL_SwapBE16(src[1]);
-    Uint16 sample2 = SDL_SwapBE16(src[2]);
-    Uint16 sample3 = SDL_SwapBE16(src[3]);
-    Uint16 sample4 = SDL_SwapBE16(src[4]);
-    Uint16 sample5 = SDL_SwapBE16(src[5]);
-    Uint16 last_sample0 = sample0;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample4 = sample4;
-    Uint16 last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapBE16(sample0);
-            dst[1] = SDL_SwapBE16(sample1);
-            dst[2] = SDL_SwapBE16(sample2);
-            dst[3] = SDL_SwapBE16(sample3);
-            dst[4] = SDL_SwapBE16(sample4);
-            dst[5] = SDL_SwapBE16(sample5);
-            dst += 6;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
-            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Uint16 sample7 = SDL_SwapBE16(src[7]);
-    Uint16 sample6 = SDL_SwapBE16(src[6]);
-    Uint16 sample5 = SDL_SwapBE16(src[5]);
-    Uint16 sample4 = SDL_SwapBE16(src[4]);
-    Uint16 sample3 = SDL_SwapBE16(src[3]);
-    Uint16 sample2 = SDL_SwapBE16(src[2]);
-    Uint16 sample1 = SDL_SwapBE16(src[1]);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 last_sample7 = sample7;
-    Uint16 last_sample6 = sample6;
-    Uint16 last_sample5 = sample5;
-    Uint16 last_sample4 = sample4;
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = SDL_SwapBE16(sample7);
-        dst[6] = SDL_SwapBE16(sample6);
-        dst[5] = SDL_SwapBE16(sample5);
-        dst[4] = SDL_SwapBE16(sample4);
-        dst[3] = SDL_SwapBE16(sample3);
-        dst[2] = SDL_SwapBE16(sample2);
-        dst[1] = SDL_SwapBE16(sample1);
-        dst[0] = SDL_SwapBE16(sample0);
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
-            sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
-            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
-            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Uint16 sample0 = SDL_SwapBE16(src[0]);
-    Uint16 sample1 = SDL_SwapBE16(src[1]);
-    Uint16 sample2 = SDL_SwapBE16(src[2]);
-    Uint16 sample3 = SDL_SwapBE16(src[3]);
-    Uint16 sample4 = SDL_SwapBE16(src[4]);
-    Uint16 sample5 = SDL_SwapBE16(src[5]);
-    Uint16 sample6 = SDL_SwapBE16(src[6]);
-    Uint16 sample7 = SDL_SwapBE16(src[7]);
-    Uint16 last_sample0 = sample0;
-    Uint16 last_sample1 = sample1;
-    Uint16 last_sample2 = sample2;
-    Uint16 last_sample3 = sample3;
-    Uint16 last_sample4 = sample4;
-    Uint16 last_sample5 = sample5;
-    Uint16 last_sample6 = sample6;
-    Uint16 last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapBE16(sample0);
-            dst[1] = SDL_SwapBE16(sample1);
-            dst[2] = SDL_SwapBE16(sample2);
-            dst[3] = SDL_SwapBE16(sample3);
-            dst[4] = SDL_SwapBE16(sample4);
-            dst[5] = SDL_SwapBE16(sample5);
-            dst[6] = SDL_SwapBE16(sample6);
-            dst[7] = SDL_SwapBE16(sample7);
-            dst += 8;
-            sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
-            sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
-            sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
-            sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
-            sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 32;
-    const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-            dst++;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
-        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
-    Sint16 last_sample0 = sample0;
-    Sint16 last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
-            dst += 2;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
-    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
-    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
-        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
-        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
-        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
-    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
-    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
-    Sint16 last_sample0 = sample0;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
-            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
-            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
-            dst += 4;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 192;
-    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
-    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
-    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
-    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
-    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 last_sample5 = sample5;
-    Sint16 last_sample4 = sample4;
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = ((Sint16) SDL_SwapBE16(sample5));
-        dst[4] = ((Sint16) SDL_SwapBE16(sample4));
-        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
-        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
-        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
-        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
-            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 192;
-    const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
-    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
-    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
-    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
-    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
-    Sint16 last_sample0 = sample0;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample4 = sample4;
-    Sint16 last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
-            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
-            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
-            dst[4] = ((Sint16) SDL_SwapBE16(sample4));
-            dst[5] = ((Sint16) SDL_SwapBE16(sample5));
-            dst += 6;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
-            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
-    Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
-    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
-    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
-    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
-    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
-    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 last_sample7 = sample7;
-    Sint16 last_sample6 = sample6;
-    Sint16 last_sample5 = sample5;
-    Sint16 last_sample4 = sample4;
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = ((Sint16) SDL_SwapBE16(sample7));
-        dst[6] = ((Sint16) SDL_SwapBE16(sample6));
-        dst[5] = ((Sint16) SDL_SwapBE16(sample5));
-        dst[4] = ((Sint16) SDL_SwapBE16(sample4));
-        dst[3] = ((Sint16) SDL_SwapBE16(sample3));
-        dst[2] = ((Sint16) SDL_SwapBE16(sample2));
-        dst[1] = ((Sint16) SDL_SwapBE16(sample1));
-        dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
-            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
-            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
-            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
-    Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
-    Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
-    Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
-    Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
-    Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
-    Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
-    Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
-    Sint16 last_sample0 = sample0;
-    Sint16 last_sample1 = sample1;
-    Sint16 last_sample2 = sample2;
-    Sint16 last_sample3 = sample3;
-    Sint16 last_sample4 = sample4;
-    Sint16 last_sample5 = sample5;
-    Sint16 last_sample6 = sample6;
-    Sint16 last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint16) SDL_SwapBE16(sample0));
-            dst[1] = ((Sint16) SDL_SwapBE16(sample1));
-            dst[2] = ((Sint16) SDL_SwapBE16(sample2));
-            dst[3] = ((Sint16) SDL_SwapBE16(sample3));
-            dst[4] = ((Sint16) SDL_SwapBE16(sample4));
-            dst[5] = ((Sint16) SDL_SwapBE16(sample5));
-            dst[6] = ((Sint16) SDL_SwapBE16(sample6));
-            dst[7] = ((Sint16) SDL_SwapBE16(sample7));
-            dst += 8;
-            sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
-            sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
-            sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
-            sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
-            sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
-            sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
-            sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
-            sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-            dst++;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
-        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
-    Sint32 last_sample0 = sample0;
-    Sint32 last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
-            dst += 2;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
-    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
-    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
-        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
-        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
-        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
-    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
-    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
-    Sint32 last_sample0 = sample0;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
-            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
-            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
-            dst += 4;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 384;
-    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
-    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
-    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
-    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
-    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 last_sample5 = sample5;
-    Sint32 last_sample4 = sample4;
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = ((Sint32) SDL_SwapLE32(sample5));
-        dst[4] = ((Sint32) SDL_SwapLE32(sample4));
-        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
-        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
-        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
-        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
-            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 384;
-    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
-    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
-    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
-    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
-    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
-    Sint32 last_sample0 = sample0;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample4 = sample4;
-    Sint32 last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
-            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
-            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
-            dst[4] = ((Sint32) SDL_SwapLE32(sample4));
-            dst[5] = ((Sint32) SDL_SwapLE32(sample5));
-            dst += 6;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
-            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 512;
-    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
-    Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
-    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
-    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
-    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
-    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
-    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 last_sample7 = sample7;
-    Sint32 last_sample6 = sample6;
-    Sint32 last_sample5 = sample5;
-    Sint32 last_sample4 = sample4;
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = ((Sint32) SDL_SwapLE32(sample7));
-        dst[6] = ((Sint32) SDL_SwapLE32(sample6));
-        dst[5] = ((Sint32) SDL_SwapLE32(sample5));
-        dst[4] = ((Sint32) SDL_SwapLE32(sample4));
-        dst[3] = ((Sint32) SDL_SwapLE32(sample3));
-        dst[2] = ((Sint32) SDL_SwapLE32(sample2));
-        dst[1] = ((Sint32) SDL_SwapLE32(sample1));
-        dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
-            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
-            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
-            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 512;
-    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
-    Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
-    Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
-    Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
-    Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
-    Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
-    Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
-    Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
-    Sint32 last_sample0 = sample0;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample4 = sample4;
-    Sint32 last_sample5 = sample5;
-    Sint32 last_sample6 = sample6;
-    Sint32 last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapLE32(sample0));
-            dst[1] = ((Sint32) SDL_SwapLE32(sample1));
-            dst[2] = ((Sint32) SDL_SwapLE32(sample2));
-            dst[3] = ((Sint32) SDL_SwapLE32(sample3));
-            dst[4] = ((Sint32) SDL_SwapLE32(sample4));
-            dst[5] = ((Sint32) SDL_SwapLE32(sample5));
-            dst[6] = ((Sint32) SDL_SwapLE32(sample6));
-            dst[7] = ((Sint32) SDL_SwapLE32(sample7));
-            dst += 8;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
-            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
-            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
-            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-            dst++;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
-        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
-    Sint32 last_sample0 = sample0;
-    Sint32 last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
-            dst += 2;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
-    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
-    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
-        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
-        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
-        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
-    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
-    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
-    Sint32 last_sample0 = sample0;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
-            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
-            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
-            dst += 4;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 384;
-    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
-    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
-    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
-    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
-    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 last_sample5 = sample5;
-    Sint32 last_sample4 = sample4;
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = ((Sint32) SDL_SwapBE32(sample5));
-        dst[4] = ((Sint32) SDL_SwapBE32(sample4));
-        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
-        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
-        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
-        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
-            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 384;
-    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
-    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
-    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
-    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
-    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
-    Sint32 last_sample0 = sample0;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample4 = sample4;
-    Sint32 last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
-            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
-            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
-            dst[4] = ((Sint32) SDL_SwapBE32(sample4));
-            dst[5] = ((Sint32) SDL_SwapBE32(sample5));
-            dst += 6;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
-            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 512;
-    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
-    register int eps = 0;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
-    Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
-    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
-    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
-    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
-    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
-    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 last_sample7 = sample7;
-    Sint32 last_sample6 = sample6;
-    Sint32 last_sample5 = sample5;
-    Sint32 last_sample4 = sample4;
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = ((Sint32) SDL_SwapBE32(sample7));
-        dst[6] = ((Sint32) SDL_SwapBE32(sample6));
-        dst[5] = ((Sint32) SDL_SwapBE32(sample5));
-        dst[4] = ((Sint32) SDL_SwapBE32(sample4));
-        dst[3] = ((Sint32) SDL_SwapBE32(sample3));
-        dst[2] = ((Sint32) SDL_SwapBE32(sample2));
-        dst[1] = ((Sint32) SDL_SwapBE32(sample1));
-        dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
-            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
-            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
-            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 512;
-    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
-    register int eps = 0;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
-    Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
-    Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
-    Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
-    Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
-    Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
-    Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
-    Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
-    Sint32 last_sample0 = sample0;
-    Sint32 last_sample1 = sample1;
-    Sint32 last_sample2 = sample2;
-    Sint32 last_sample3 = sample3;
-    Sint32 last_sample4 = sample4;
-    Sint32 last_sample5 = sample5;
-    Sint32 last_sample6 = sample6;
-    Sint32 last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = ((Sint32) SDL_SwapBE32(sample0));
-            dst[1] = ((Sint32) SDL_SwapBE32(sample1));
-            dst[2] = ((Sint32) SDL_SwapBE32(sample2));
-            dst[3] = ((Sint32) SDL_SwapBE32(sample3));
-            dst[4] = ((Sint32) SDL_SwapBE32(sample4));
-            dst[5] = ((Sint32) SDL_SwapBE32(sample5));
-            dst[6] = ((Sint32) SDL_SwapBE32(sample6));
-            dst[7] = ((Sint32) SDL_SwapBE32(sample7));
-            dst += 8;
-            sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
-            sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
-            sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
-            sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
-            sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
-            sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
-            sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
-            sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = SDL_SwapFloatLE(sample0);
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatLE(sample0);
-            dst++;
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf);
-    float sample1 = SDL_SwapFloatLE(src[1]);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float last_sample1 = sample1;
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = SDL_SwapFloatLE(sample1);
-        dst[0] = SDL_SwapFloatLE(sample0);
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float sample1 = SDL_SwapFloatLE(src[1]);
-    float last_sample0 = sample0;
-    float last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatLE(sample0);
-            dst[1] = SDL_SwapFloatLE(sample1);
-            dst += 2;
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf);
-    float sample3 = SDL_SwapFloatLE(src[3]);
-    float sample2 = SDL_SwapFloatLE(src[2]);
-    float sample1 = SDL_SwapFloatLE(src[1]);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float last_sample3 = sample3;
-    float last_sample2 = sample2;
-    float last_sample1 = sample1;
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = SDL_SwapFloatLE(sample3);
-        dst[2] = SDL_SwapFloatLE(sample2);
-        dst[1] = SDL_SwapFloatLE(sample1);
-        dst[0] = SDL_SwapFloatLE(sample0);
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float sample1 = SDL_SwapFloatLE(src[1]);
-    float sample2 = SDL_SwapFloatLE(src[2]);
-    float sample3 = SDL_SwapFloatLE(src[3]);
-    float last_sample0 = sample0;
-    float last_sample1 = sample1;
-    float last_sample2 = sample2;
-    float last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatLE(sample0);
-            dst[1] = SDL_SwapFloatLE(sample1);
-            dst[2] = SDL_SwapFloatLE(sample2);
-            dst[3] = SDL_SwapFloatLE(sample3);
-            dst += 4;
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 384;
-    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf);
-    float sample5 = SDL_SwapFloatLE(src[5]);
-    float sample4 = SDL_SwapFloatLE(src[4]);
-    float sample3 = SDL_SwapFloatLE(src[3]);
-    float sample2 = SDL_SwapFloatLE(src[2]);
-    float sample1 = SDL_SwapFloatLE(src[1]);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float last_sample5 = sample5;
-    float last_sample4 = sample4;
-    float last_sample3 = sample3;
-    float last_sample2 = sample2;
-    float last_sample1 = sample1;
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = SDL_SwapFloatLE(sample5);
-        dst[4] = SDL_SwapFloatLE(sample4);
-        dst[3] = SDL_SwapFloatLE(sample3);
-        dst[2] = SDL_SwapFloatLE(sample2);
-        dst[1] = SDL_SwapFloatLE(sample1);
-        dst[0] = SDL_SwapFloatLE(sample0);
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
-            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 384;
-    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float sample1 = SDL_SwapFloatLE(src[1]);
-    float sample2 = SDL_SwapFloatLE(src[2]);
-    float sample3 = SDL_SwapFloatLE(src[3]);
-    float sample4 = SDL_SwapFloatLE(src[4]);
-    float sample5 = SDL_SwapFloatLE(src[5]);
-    float last_sample0 = sample0;
-    float last_sample1 = sample1;
-    float last_sample2 = sample2;
-    float last_sample3 = sample3;
-    float last_sample4 = sample4;
-    float last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatLE(sample0);
-            dst[1] = SDL_SwapFloatLE(sample1);
-            dst[2] = SDL_SwapFloatLE(sample2);
-            dst[3] = SDL_SwapFloatLE(sample3);
-            dst[4] = SDL_SwapFloatLE(sample4);
-            dst[5] = SDL_SwapFloatLE(sample5);
-            dst += 6;
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
-            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 512;
-    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf);
-    float sample7 = SDL_SwapFloatLE(src[7]);
-    float sample6 = SDL_SwapFloatLE(src[6]);
-    float sample5 = SDL_SwapFloatLE(src[5]);
-    float sample4 = SDL_SwapFloatLE(src[4]);
-    float sample3 = SDL_SwapFloatLE(src[3]);
-    float sample2 = SDL_SwapFloatLE(src[2]);
-    float sample1 = SDL_SwapFloatLE(src[1]);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float last_sample7 = sample7;
-    float last_sample6 = sample6;
-    float last_sample5 = sample5;
-    float last_sample4 = sample4;
-    float last_sample3 = sample3;
-    float last_sample2 = sample2;
-    float last_sample1 = sample1;
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = SDL_SwapFloatLE(sample7);
-        dst[6] = SDL_SwapFloatLE(sample6);
-        dst[5] = SDL_SwapFloatLE(sample5);
-        dst[4] = SDL_SwapFloatLE(sample4);
-        dst[3] = SDL_SwapFloatLE(sample3);
-        dst[2] = SDL_SwapFloatLE(sample2);
-        dst[1] = SDL_SwapFloatLE(sample1);
-        dst[0] = SDL_SwapFloatLE(sample0);
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
-            sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
-            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
-            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 512;
-    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatLE(src[0]);
-    float sample1 = SDL_SwapFloatLE(src[1]);
-    float sample2 = SDL_SwapFloatLE(src[2]);
-    float sample3 = SDL_SwapFloatLE(src[3]);
-    float sample4 = SDL_SwapFloatLE(src[4]);
-    float sample5 = SDL_SwapFloatLE(src[5]);
-    float sample6 = SDL_SwapFloatLE(src[6]);
-    float sample7 = SDL_SwapFloatLE(src[7]);
-    float last_sample0 = sample0;
-    float last_sample1 = sample1;
-    float last_sample2 = sample2;
-    float last_sample3 = sample3;
-    float last_sample4 = sample4;
-    float last_sample5 = sample5;
-    float last_sample6 = sample6;
-    float last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatLE(sample0);
-            dst[1] = SDL_SwapFloatLE(sample1);
-            dst[2] = SDL_SwapFloatLE(sample2);
-            dst[3] = SDL_SwapFloatLE(sample3);
-            dst[4] = SDL_SwapFloatLE(sample4);
-            dst[5] = SDL_SwapFloatLE(sample5);
-            dst[6] = SDL_SwapFloatLE(sample6);
-            dst[7] = SDL_SwapFloatLE(sample7);
-            dst += 8;
-            sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
-            sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
-            sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
-            sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 1;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[0] = SDL_SwapFloatBE(sample0);
-        dst--;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src--;
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 64;
-    const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float last_sample0 = sample0;
-    while (dst < target) {
-        src++;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatBE(sample0);
-            dst++;
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample0 = sample0;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf);
-    float sample1 = SDL_SwapFloatBE(src[1]);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float last_sample1 = sample1;
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[1] = SDL_SwapFloatBE(sample1);
-        dst[0] = SDL_SwapFloatBE(sample0);
-        dst -= 2;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 2;
-            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 128;
-    const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float sample1 = SDL_SwapFloatBE(src[1]);
-    float last_sample0 = sample0;
-    float last_sample1 = sample1;
-    while (dst < target) {
-        src += 2;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatBE(sample0);
-            dst[1] = SDL_SwapFloatBE(sample1);
-            dst += 2;
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf);
-    float sample3 = SDL_SwapFloatBE(src[3]);
-    float sample2 = SDL_SwapFloatBE(src[2]);
-    float sample1 = SDL_SwapFloatBE(src[1]);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float last_sample3 = sample3;
-    float last_sample2 = sample2;
-    float last_sample1 = sample1;
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[3] = SDL_SwapFloatBE(sample3);
-        dst[2] = SDL_SwapFloatBE(sample2);
-        dst[1] = SDL_SwapFloatBE(sample1);
-        dst[0] = SDL_SwapFloatBE(sample0);
-        dst -= 4;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 4;
-            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 256;
-    const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float sample1 = SDL_SwapFloatBE(src[1]);
-    float sample2 = SDL_SwapFloatBE(src[2]);
-    float sample3 = SDL_SwapFloatBE(src[3]);
-    float last_sample0 = sample0;
-    float last_sample1 = sample1;
-    float last_sample2 = sample2;
-    float last_sample3 = sample3;
-    while (dst < target) {
-        src += 4;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatBE(sample0);
-            dst[1] = SDL_SwapFloatBE(sample1);
-            dst[2] = SDL_SwapFloatBE(sample2);
-            dst[3] = SDL_SwapFloatBE(sample3);
-            dst += 4;
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 384;
-    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 6;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf);
-    float sample5 = SDL_SwapFloatBE(src[5]);
-    float sample4 = SDL_SwapFloatBE(src[4]);
-    float sample3 = SDL_SwapFloatBE(src[3]);
-    float sample2 = SDL_SwapFloatBE(src[2]);
-    float sample1 = SDL_SwapFloatBE(src[1]);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float last_sample5 = sample5;
-    float last_sample4 = sample4;
-    float last_sample3 = sample3;
-    float last_sample2 = sample2;
-    float last_sample1 = sample1;
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[5] = SDL_SwapFloatBE(sample5);
-        dst[4] = SDL_SwapFloatBE(sample4);
-        dst[3] = SDL_SwapFloatBE(sample3);
-        dst[2] = SDL_SwapFloatBE(sample2);
-        dst[1] = SDL_SwapFloatBE(sample1);
-        dst[0] = SDL_SwapFloatBE(sample0);
-        dst -= 6;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 6;
-            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
-            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 384;
-    const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float sample1 = SDL_SwapFloatBE(src[1]);
-    float sample2 = SDL_SwapFloatBE(src[2]);
-    float sample3 = SDL_SwapFloatBE(src[3]);
-    float sample4 = SDL_SwapFloatBE(src[4]);
-    float sample5 = SDL_SwapFloatBE(src[5]);
-    float last_sample0 = sample0;
-    float last_sample1 = sample1;
-    float last_sample2 = sample2;
-    float last_sample3 = sample3;
-    float last_sample4 = sample4;
-    float last_sample5 = sample5;
-    while (dst < target) {
-        src += 6;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatBE(sample0);
-            dst[1] = SDL_SwapFloatBE(sample1);
-            dst[2] = SDL_SwapFloatBE(sample2);
-            dst[3] = SDL_SwapFloatBE(sample3);
-            dst[4] = SDL_SwapFloatBE(sample4);
-            dst[5] = SDL_SwapFloatBE(sample5);
-            dst += 6;
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
-            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 512;
-    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
-    register int eps = 0;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf);
-    float sample7 = SDL_SwapFloatBE(src[7]);
-    float sample6 = SDL_SwapFloatBE(src[6]);
-    float sample5 = SDL_SwapFloatBE(src[5]);
-    float sample4 = SDL_SwapFloatBE(src[4]);
-    float sample3 = SDL_SwapFloatBE(src[3]);
-    float sample2 = SDL_SwapFloatBE(src[2]);
-    float sample1 = SDL_SwapFloatBE(src[1]);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float last_sample7 = sample7;
-    float last_sample6 = sample6;
-    float last_sample5 = sample5;
-    float last_sample4 = sample4;
-    float last_sample3 = sample3;
-    float last_sample2 = sample2;
-    float last_sample1 = sample1;
-    float last_sample0 = sample0;
-    while (dst >= target) {
-        dst[7] = SDL_SwapFloatBE(sample7);
-        dst[6] = SDL_SwapFloatBE(sample6);
-        dst[5] = SDL_SwapFloatBE(sample5);
-        dst[4] = SDL_SwapFloatBE(sample4);
-        dst[3] = SDL_SwapFloatBE(sample3);
-        dst[2] = SDL_SwapFloatBE(sample2);
-        dst[1] = SDL_SwapFloatBE(sample1);
-        dst[0] = SDL_SwapFloatBE(sample0);
-        dst -= 8;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            src -= 8;
-            sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
-            sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
-            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
-            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            last_sample7 = sample7;
-            last_sample6 = sample6;
-            last_sample5 = sample5;
-            last_sample4 = sample4;
-            last_sample3 = sample3;
-            last_sample2 = sample2;
-            last_sample1 = sample1;
-            last_sample0 = sample0;
-            eps -= dstsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - 512;
-    const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32;
-    register int eps = 0;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    float sample0 = SDL_SwapFloatBE(src[0]);
-    float sample1 = SDL_SwapFloatBE(src[1]);
-    float sample2 = SDL_SwapFloatBE(src[2]);
-    float sample3 = SDL_SwapFloatBE(src[3]);
-    float sample4 = SDL_SwapFloatBE(src[4]);
-    float sample5 = SDL_SwapFloatBE(src[5]);
-    float sample6 = SDL_SwapFloatBE(src[6]);
-    float sample7 = SDL_SwapFloatBE(src[7]);
-    float last_sample0 = sample0;
-    float last_sample1 = sample1;
-    float last_sample2 = sample2;
-    float last_sample3 = sample3;
-    float last_sample4 = sample4;
-    float last_sample5 = sample5;
-    float last_sample6 = sample6;
-    float last_sample7 = sample7;
-    while (dst < target) {
-        src += 8;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-            dst[0] = SDL_SwapFloatBE(sample0);
-            dst[1] = SDL_SwapFloatBE(sample1);
-            dst[2] = SDL_SwapFloatBE(sample2);
-            dst[3] = SDL_SwapFloatBE(sample3);
-            dst[4] = SDL_SwapFloatBE(sample4);
-            dst[5] = SDL_SwapFloatBE(sample5);
-            dst[6] = SDL_SwapFloatBE(sample6);
-            dst[7] = SDL_SwapFloatBE(sample7);
-            dst += 8;
-            sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
-            sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
-            sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
-            sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
-            sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
-            sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
-            sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
-            sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
-            last_sample0 = sample0;
-            last_sample1 = sample1;
-            last_sample2 = sample2;
-            last_sample3 = sample3;
-            last_sample4 = sample4;
-            last_sample5 = sample5;
-            last_sample6 = sample6;
-            last_sample7 = sample7;
-            eps -= srcsize;
-        }
-    }
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-
-#if !LESS_RESAMPLERS
-
-static void SDLCALL
-SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        src--;
-        dst[1] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[0] = (Uint8) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        src += 2;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        src--;
-        dst[3] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[0] = (Uint8) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        src += 4;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample0 = (Sint16) src[0];
-        src -= 2;
-        dst[3] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) sample1;
-        dst[0] = (Uint8) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    Sint16 last_sample1 = (Sint16) src[1];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        const Sint16 sample1 = (Sint16) src[1];
-        src += 4;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample0 = (Sint16) src[0];
-        src -= 2;
-        dst[7] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[6] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
-        dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[1] = (Uint8) sample1;
-        dst[0] = (Uint8) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    Sint16 last_sample1 = (Sint16) src[1];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        const Sint16 sample1 = (Sint16) src[1];
-        src += 8;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample0 = (Sint16) src[0];
-        src -= 4;
-        dst[7] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[6] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Uint8) sample3;
-        dst[2] = (Uint8) sample2;
-        dst[1] = (Uint8) sample1;
-        dst[0] = (Uint8) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample3 = (Sint16) src[3];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample3 = (Sint16) src[3];
-        src += 8;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample0 = (Sint16) src[0];
-        src -= 4;
-        dst[15] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[14] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[13] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[12] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
-        dst[6] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
-        dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
-        dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[3] = (Uint8) sample3;
-        dst[2] = (Uint8) sample2;
-        dst[1] = (Uint8) sample1;
-        dst[0] = (Uint8) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample3 = (Sint16) src[3];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample3 = (Sint16) src[3];
-        src += 16;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample5 = (Sint16) src[5];
-    Sint16 last_sample4 = (Sint16) src[4];
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample5 = (Sint16) src[5];
-        const Sint16 sample4 = (Sint16) src[4];
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample0 = (Sint16) src[0];
-        src -= 6;
-        dst[11] = (Uint8) ((sample5 + last_sample5) >> 1);
-        dst[10] = (Uint8) ((sample4 + last_sample4) >> 1);
-        dst[9] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[8] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[7] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[6] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[5] = (Uint8) sample5;
-        dst[4] = (Uint8) sample4;
-        dst[3] = (Uint8) sample3;
-        dst[2] = (Uint8) sample2;
-        dst[1] = (Uint8) sample1;
-        dst[0] = (Uint8) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample4 = (Sint16) src[4];
-    Sint16 last_sample5 = (Sint16) src[5];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample4 = (Sint16) src[4];
-        const Sint16 sample5 = (Sint16) src[5];
-        src += 12;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 4;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample5 = (Sint16) src[5];
-    Sint16 last_sample4 = (Sint16) src[4];
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample5 = (Sint16) src[5];
-        const Sint16 sample4 = (Sint16) src[4];
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample0 = (Sint16) src[0];
-        src -= 6;
-        dst[23] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[22] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[21] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[20] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[19] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[18] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[17] = (Uint8) ((sample5 + last_sample5) >> 1);
-        dst[16] = (Uint8) ((sample4 + last_sample4) >> 1);
-        dst[15] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[14] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[13] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[12] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[11] = (Uint8) (((3 * sample5) + last_sample5) >> 2);
-        dst[10] = (Uint8) (((3 * sample4) + last_sample4) >> 2);
-        dst[9] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
-        dst[8] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
-        dst[7] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
-        dst[6] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[5] = (Uint8) sample5;
-        dst[4] = (Uint8) sample4;
-        dst[3] = (Uint8) sample3;
-        dst[2] = (Uint8) sample2;
-        dst[1] = (Uint8) sample1;
-        dst[0] = (Uint8) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample4 = (Sint16) src[4];
-    Sint16 last_sample5 = (Sint16) src[5];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample4 = (Sint16) src[4];
-        const Sint16 sample5 = (Sint16) src[5];
-        src += 24;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 2;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample7 = (Sint16) src[7];
-    Sint16 last_sample6 = (Sint16) src[6];
-    Sint16 last_sample5 = (Sint16) src[5];
-    Sint16 last_sample4 = (Sint16) src[4];
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample7 = (Sint16) src[7];
-        const Sint16 sample6 = (Sint16) src[6];
-        const Sint16 sample5 = (Sint16) src[5];
-        const Sint16 sample4 = (Sint16) src[4];
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample0 = (Sint16) src[0];
-        src -= 8;
-        dst[15] = (Uint8) ((sample7 + last_sample7) >> 1);
-        dst[14] = (Uint8) ((sample6 + last_sample6) >> 1);
-        dst[13] = (Uint8) ((sample5 + last_sample5) >> 1);
-        dst[12] = (Uint8) ((sample4 + last_sample4) >> 1);
-        dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Uint8) sample7;
-        dst[6] = (Uint8) sample6;
-        dst[5] = (Uint8) sample5;
-        dst[4] = (Uint8) sample4;
-        dst[3] = (Uint8) sample3;
-        dst[2] = (Uint8) sample2;
-        dst[1] = (Uint8) sample1;
-        dst[0] = (Uint8) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample4 = (Sint16) src[4];
-    Sint16 last_sample5 = (Sint16) src[5];
-    Sint16 last_sample6 = (Sint16) src[6];
-    Sint16 last_sample7 = (Sint16) src[7];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample4 = (Sint16) src[4];
-        const Sint16 sample5 = (Sint16) src[5];
-        const Sint16 sample6 = (Sint16) src[6];
-        const Sint16 sample7 = (Sint16) src[7];
-        src += 16;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Uint8) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Uint8) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 4;
-    const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint8 *target = ((const Uint8 *) cvt->buf);
-    Sint16 last_sample7 = (Sint16) src[7];
-    Sint16 last_sample6 = (Sint16) src[6];
-    Sint16 last_sample5 = (Sint16) src[5];
-    Sint16 last_sample4 = (Sint16) src[4];
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample0 = (Sint16) src[0];
-    while (dst >= target) {
-        const Sint16 sample7 = (Sint16) src[7];
-        const Sint16 sample6 = (Sint16) src[6];
-        const Sint16 sample5 = (Sint16) src[5];
-        const Sint16 sample4 = (Sint16) src[4];
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample0 = (Sint16) src[0];
-        src -= 8;
-        dst[31] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2);
-        dst[30] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2);
-        dst[29] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[28] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[27] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[26] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[25] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[24] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[23] = (Uint8) ((sample7 + last_sample7) >> 1);
-        dst[22] = (Uint8) ((sample6 + last_sample6) >> 1);
-        dst[21] = (Uint8) ((sample5 + last_sample5) >> 1);
-        dst[20] = (Uint8) ((sample4 + last_sample4) >> 1);
-        dst[19] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[18] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[17] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[16] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[15] = (Uint8) (((3 * sample7) + last_sample7) >> 2);
-        dst[14] = (Uint8) (((3 * sample6) + last_sample6) >> 2);
-        dst[13] = (Uint8) (((3 * sample5) + last_sample5) >> 2);
-        dst[12] = (Uint8) (((3 * sample4) + last_sample4) >> 2);
-        dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
-        dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
-        dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
-        dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[7] = (Uint8) sample7;
-        dst[6] = (Uint8) sample6;
-        dst[5] = (Uint8) sample5;
-        dst[4] = (Uint8) sample4;
-        dst[3] = (Uint8) sample3;
-        dst[2] = (Uint8) sample2;
-        dst[1] = (Uint8) sample1;
-        dst[0] = (Uint8) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    const Uint8 *src = (Uint8 *) cvt->buf;
-    const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) src[0];
-    Sint16 last_sample1 = (Sint16) src[1];
-    Sint16 last_sample2 = (Sint16) src[2];
-    Sint16 last_sample3 = (Sint16) src[3];
-    Sint16 last_sample4 = (Sint16) src[4];
-    Sint16 last_sample5 = (Sint16) src[5];
-    Sint16 last_sample6 = (Sint16) src[6];
-    Sint16 last_sample7 = (Sint16) src[7];
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) src[0];
-        const Sint16 sample1 = (Sint16) src[1];
-        const Sint16 sample2 = (Sint16) src[2];
-        const Sint16 sample3 = (Sint16) src[3];
-        const Sint16 sample4 = (Sint16) src[4];
-        const Sint16 sample5 = (Sint16) src[5];
-        const Sint16 sample6 = (Sint16) src[6];
-        const Sint16 sample7 = (Sint16) src[7];
-        src += 32;
-        dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Uint8) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Uint8) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 2;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src--;
-        dst[1] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[0] = (Sint8) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src += 2;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 4;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src--;
-        dst[3] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[2] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[0] = (Sint8) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src += 4;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 2;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src -= 2;
-        dst[3] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) sample1;
-        dst[0] = (Sint8) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        src += 4;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 4;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src -= 2;
-        dst[7] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[6] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[5] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
-        dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[1] = (Sint8) sample1;
-        dst[0] = (Sint8) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        src += 8;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 2;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src -= 4;
-        dst[7] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[6] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[5] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint8) sample3;
-        dst[2] = (Sint8) sample2;
-        dst[1] = (Sint8) sample1;
-        dst[0] = (Sint8) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        src += 8;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 4;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src -= 4;
-        dst[15] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[14] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[13] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[12] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[11] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
-        dst[6] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
-        dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
-        dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[3] = (Sint8) sample3;
-        dst[2] = (Sint8) sample2;
-        dst[1] = (Sint8) sample1;
-        dst[0] = (Sint8) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        src += 16;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 2;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
-    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
-        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src -= 6;
-        dst[11] = (Sint8) ((sample5 + last_sample5) >> 1);
-        dst[10] = (Sint8) ((sample4 + last_sample4) >> 1);
-        dst[9] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[8] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[7] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[6] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[5] = (Sint8) sample5;
-        dst[4] = (Sint8) sample4;
-        dst[3] = (Sint8) sample3;
-        dst[2] = (Sint8) sample2;
-        dst[1] = (Sint8) sample1;
-        dst[0] = (Sint8) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
-    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
-        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
-        src += 12;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 4;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
-    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
-        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src -= 6;
-        dst[23] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[22] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[21] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[20] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[19] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[18] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[17] = (Sint8) ((sample5 + last_sample5) >> 1);
-        dst[16] = (Sint8) ((sample4 + last_sample4) >> 1);
-        dst[15] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[14] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[13] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[12] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[11] = (Sint8) (((3 * sample5) + last_sample5) >> 2);
-        dst[10] = (Sint8) (((3 * sample4) + last_sample4) >> 2);
-        dst[9] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
-        dst[8] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
-        dst[7] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
-        dst[6] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[5] = (Sint8) sample5;
-        dst[4] = (Sint8) sample4;
-        dst[3] = (Sint8) sample3;
-        dst[2] = (Sint8) sample2;
-        dst[1] = (Sint8) sample1;
-        dst[0] = (Sint8) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
-    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
-        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
-        src += 24;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 2;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
-    Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
-    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
-    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
-        const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
-        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
-        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src -= 8;
-        dst[15] = (Sint8) ((sample7 + last_sample7) >> 1);
-        dst[14] = (Sint8) ((sample6 + last_sample6) >> 1);
-        dst[13] = (Sint8) ((sample5 + last_sample5) >> 1);
-        dst[12] = (Sint8) ((sample4 + last_sample4) >> 1);
-        dst[11] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint8) sample7;
-        dst[6] = (Sint8) sample6;
-        dst[5] = (Sint8) sample5;
-        dst[4] = (Sint8) sample4;
-        dst[3] = (Sint8) sample3;
-        dst[2] = (Sint8) sample2;
-        dst[1] = (Sint8) sample1;
-        dst[0] = (Sint8) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
-    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
-    Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
-    Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
-        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
-        const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
-        const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
-        src += 16;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint8) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint8) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 4;
-    const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint8 *target = ((const Sint8 *) cvt->buf);
-    Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
-    Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
-    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
-    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    while (dst >= target) {
-        const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
-        const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
-        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
-        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        src -= 8;
-        dst[31] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2);
-        dst[30] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2);
-        dst[29] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[28] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[27] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[26] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[25] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[24] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[23] = (Sint8) ((sample7 + last_sample7) >> 1);
-        dst[22] = (Sint8) ((sample6 + last_sample6) >> 1);
-        dst[21] = (Sint8) ((sample5 + last_sample5) >> 1);
-        dst[20] = (Sint8) ((sample4 + last_sample4) >> 1);
-        dst[19] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[18] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[17] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[16] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[15] = (Sint8) (((3 * sample7) + last_sample7) >> 2);
-        dst[14] = (Sint8) (((3 * sample6) + last_sample6) >> 2);
-        dst[13] = (Sint8) (((3 * sample5) + last_sample5) >> 2);
-        dst[12] = (Sint8) (((3 * sample4) + last_sample4) >> 2);
-        dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
-        dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
-        dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
-        dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
-        dst[7] = (Sint8) sample7;
-        dst[6] = (Sint8) sample6;
-        dst[5] = (Sint8) sample5;
-        dst[4] = (Sint8) sample4;
-        dst[3] = (Sint8) sample3;
-        dst[2] = (Sint8) sample2;
-        dst[1] = (Sint8) sample1;
-        dst[0] = (Sint8) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    const Sint8 *src = (Sint8 *) cvt->buf;
-    const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
-    Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
-    Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
-    Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
-    Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
-    Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
-    Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
-    Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
-    Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
-    while (dst < target) {
-        const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
-        const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
-        const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
-        const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
-        const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
-        const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
-        const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
-        const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
-        src += 32;
-        dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint8) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint8) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src--;
-        dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[0] = (Uint16) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src += 2;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src--;
-        dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[0] = (Uint16) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src += 4;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src -= 2;
-        dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        src += 4;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src -= 2;
-        dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        src += 8;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src -= 4;
-        dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        src += 8;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src -= 4;
-        dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        src += 16;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
-        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src -= 6;
-        dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[5] = (Uint16) sample5;
-        dst[4] = (Uint16) sample4;
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
-        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
-        src += 12;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
-        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src -= 6;
-        dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[17] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[16] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[15] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[14] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[13] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[12] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
-        dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
-        dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[5] = (Uint16) sample5;
-        dst[4] = (Uint16) sample4;
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
-        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
-        src += 24;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
-    Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
-        const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
-        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
-        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src -= 8;
-        dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
-        dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
-        dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Uint16) sample7;
-        dst[6] = (Uint16) sample6;
-        dst[5] = (Uint16) sample5;
-        dst[4] = (Uint16) sample4;
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
-    Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
-    Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
-        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
-        const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
-        const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
-        src += 16;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
-    Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
-        const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
-        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
-        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        src -= 8;
-        dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2);
-        dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2);
-        dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[23] = (Uint16) ((sample7 + last_sample7) >> 1);
-        dst[22] = (Uint16) ((sample6 + last_sample6) >> 1);
-        dst[21] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[20] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[19] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[18] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[17] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[16] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2);
-        dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2);
-        dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
-        dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
-        dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[7] = (Uint16) sample7;
-        dst[6] = (Uint16) sample6;
-        dst[5] = (Uint16) sample5;
-        dst[4] = (Uint16) sample4;
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
-    Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
-    Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
-        const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
-        const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
-        const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
-        const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
-        src += 32;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src--;
-        dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[0] = (Sint16) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src += 2;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src--;
-        dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[0] = (Sint16) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src += 4;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src -= 2;
-        dst[3] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        src += 4;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src -= 2;
-        dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        src += 8;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src -= 4;
-        dst[7] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[6] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        src += 8;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src -= 4;
-        dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        src += 16;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src -= 6;
-        dst[11] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[10] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[9] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[8] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[7] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[6] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[5] = (Sint16) sample5;
-        dst[4] = (Sint16) sample4;
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-        src += 12;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src -= 6;
-        dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[17] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[16] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[15] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[14] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[13] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[12] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
-        dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
-        dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[5] = (Sint16) sample5;
-        dst[4] = (Sint16) sample4;
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-        src += 24;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
-    Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
-        const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src -= 8;
-        dst[15] = (Sint16) ((sample7 + last_sample7) >> 1);
-        dst[14] = (Sint16) ((sample6 + last_sample6) >> 1);
-        dst[13] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[12] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint16) sample7;
-        dst[6] = (Sint16) sample6;
-        dst[5] = (Sint16) sample5;
-        dst[4] = (Sint16) sample4;
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-    Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
-    Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-        const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
-        const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
-        src += 16;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
-    Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
-        const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        src -= 8;
-        dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2);
-        dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2);
-        dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[23] = (Sint16) ((sample7 + last_sample7) >> 1);
-        dst[22] = (Sint16) ((sample6 + last_sample6) >> 1);
-        dst[21] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[20] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[19] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[18] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[17] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[16] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2);
-        dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2);
-        dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
-        dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
-        dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[7] = (Sint16) sample7;
-        dst[6] = (Sint16) sample6;
-        dst[5] = (Sint16) sample5;
-        dst[4] = (Sint16) sample4;
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-    Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
-    Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
-        const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
-        const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
-        src += 32;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src--;
-        dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[0] = (Uint16) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src += 2;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src--;
-        dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[0] = (Uint16) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src += 4;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src -= 2;
-        dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        src += 4;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src -= 2;
-        dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        src += 8;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src -= 4;
-        dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        src += 8;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src -= 4;
-        dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        src += 16;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
-        const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src -= 6;
-        dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[5] = (Uint16) sample5;
-        dst[4] = (Uint16) sample4;
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
-        const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
-        src += 12;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
-        const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src -= 6;
-        dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[17] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[16] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[15] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[14] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[13] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[12] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
-        dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
-        dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[5] = (Uint16) sample5;
-        dst[4] = (Uint16) sample4;
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
-        const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
-        src += 24;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
-    Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
-        const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
-        const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
-        const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src -= 8;
-        dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
-        dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
-        dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Uint16) sample7;
-        dst[6] = (Uint16) sample6;
-        dst[5] = (Uint16) sample5;
-        dst[4] = (Uint16) sample4;
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
-    Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
-    Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
-        const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
-        const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
-        const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
-        src += 16;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4;
-    const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Uint16 *target = ((const Uint16 *) cvt->buf);
-    Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
-    Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    while (dst >= target) {
-        const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
-        const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
-        const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
-        const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        src -= 8;
-        dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2);
-        dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2);
-        dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[23] = (Uint16) ((sample7 + last_sample7) >> 1);
-        dst[22] = (Uint16) ((sample6 + last_sample6) >> 1);
-        dst[21] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[20] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[19] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[18] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[17] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[16] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2);
-        dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2);
-        dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
-        dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
-        dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[7] = (Uint16) sample7;
-        dst[6] = (Uint16) sample6;
-        dst[5] = (Uint16) sample5;
-        dst[4] = (Uint16) sample4;
-        dst[3] = (Uint16) sample3;
-        dst[2] = (Uint16) sample2;
-        dst[1] = (Uint16) sample1;
-        dst[0] = (Uint16) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    const Uint16 *src = (Uint16 *) cvt->buf;
-    const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
-    Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
-    Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
-    Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
-    Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
-    Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
-    Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
-    Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
-        const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
-        const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
-        const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
-        const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
-        const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
-        const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
-        const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
-        src += 32;
-        dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src--;
-        dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[0] = (Sint16) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src += 2;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src--;
-        dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[0] = (Sint16) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src += 4;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src -= 2;
-        dst[3] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        src += 4;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src -= 2;
-        dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        src += 8;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src -= 4;
-        dst[7] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[6] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        src += 8;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src -= 4;
-        dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        src += 16;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src -= 6;
-        dst[11] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[10] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[9] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[8] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[7] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[6] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[5] = (Sint16) sample5;
-        dst[4] = (Sint16) sample4;
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-        src += 12;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src -= 6;
-        dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[17] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[16] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[15] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[14] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[13] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[12] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
-        dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
-        dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[5] = (Sint16) sample5;
-        dst[4] = (Sint16) sample4;
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-        src += 24;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
-    Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
-        const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src -= 8;
-        dst[15] = (Sint16) ((sample7 + last_sample7) >> 1);
-        dst[14] = (Sint16) ((sample6 + last_sample6) >> 1);
-        dst[13] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[12] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint16) sample7;
-        dst[6] = (Sint16) sample6;
-        dst[5] = (Sint16) sample5;
-        dst[4] = (Sint16) sample4;
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-    Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
-    Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-        const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
-        const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
-        src += 16;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4;
-    const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint16 *target = ((const Sint16 *) cvt->buf);
-    Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
-    Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    while (dst >= target) {
-        const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
-        const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        src -= 8;
-        dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2);
-        dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2);
-        dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[23] = (Sint16) ((sample7 + last_sample7) >> 1);
-        dst[22] = (Sint16) ((sample6 + last_sample6) >> 1);
-        dst[21] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[20] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[19] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[18] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[17] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[16] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2);
-        dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2);
-        dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
-        dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
-        dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
-        dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
-        dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
-        dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
-        dst[7] = (Sint16) sample7;
-        dst[6] = (Sint16) sample6;
-        dst[5] = (Sint16) sample5;
-        dst[4] = (Sint16) sample4;
-        dst[3] = (Sint16) sample3;
-        dst[2] = (Sint16) sample2;
-        dst[1] = (Sint16) sample1;
-        dst[0] = (Sint16) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    const Sint16 *src = (Sint16 *) cvt->buf;
-    const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
-    Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-    Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-    Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-    Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-    Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-    Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-    Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
-    Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
-    while (dst < target) {
-        const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
-        const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
-        const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
-        const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
-        const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
-        const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
-        const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
-        const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
-        src += 32;
-        dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src--;
-        dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[0] = (Sint32) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src += 2;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src--;
-        dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[0] = (Sint32) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src += 4;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src -= 2;
-        dst[3] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        src += 4;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src -= 2;
-        dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
-        dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        src += 8;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src -= 4;
-        dst[7] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[6] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        src += 8;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src -= 4;
-        dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
-        dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
-        dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
-        dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        src += 16;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src -= 6;
-        dst[11] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[10] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[9] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[8] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[7] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[6] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[5] = (Sint32) sample5;
-        dst[4] = (Sint32) sample4;
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-        src += 12;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src -= 6;
-        dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[17] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[16] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[15] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[14] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[13] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[12] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
-        dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
-        dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
-        dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
-        dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
-        dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[5] = (Sint32) sample5;
-        dst[4] = (Sint32) sample4;
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-        src += 24;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
-    Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
-        const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src -= 8;
-        dst[15] = (Sint32) ((sample7 + last_sample7) >> 1);
-        dst[14] = (Sint32) ((sample6 + last_sample6) >> 1);
-        dst[13] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[12] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint32) sample7;
-        dst[6] = (Sint32) sample6;
-        dst[5] = (Sint32) sample5;
-        dst[4] = (Sint32) sample4;
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-    Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
-    Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-        const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
-        const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
-        src += 16;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
-    Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
-        const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        src -= 8;
-        dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2);
-        dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2);
-        dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[23] = (Sint32) ((sample7 + last_sample7) >> 1);
-        dst[22] = (Sint32) ((sample6 + last_sample6) >> 1);
-        dst[21] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[20] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[19] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[18] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[17] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[16] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2);
-        dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2);
-        dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
-        dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
-        dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
-        dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
-        dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
-        dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[7] = (Sint32) sample7;
-        dst[6] = (Sint32) sample6;
-        dst[5] = (Sint32) sample5;
-        dst[4] = (Sint32) sample4;
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-    Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
-    Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
-        const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
-        const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
-        src += 32;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src--;
-        dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[0] = (Sint32) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src += 2;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src--;
-        dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[0] = (Sint32) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src += 4;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src -= 2;
-        dst[3] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        src += 4;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src -= 2;
-        dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
-        dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        src += 8;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src -= 4;
-        dst[7] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[6] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        src += 8;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src -= 4;
-        dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
-        dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
-        dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
-        dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        src += 16;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src -= 6;
-        dst[11] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[10] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[9] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[8] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[7] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[6] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[5] = (Sint32) sample5;
-        dst[4] = (Sint32) sample4;
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-        src += 12;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src -= 6;
-        dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[17] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[16] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[15] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[14] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[13] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[12] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
-        dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
-        dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
-        dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
-        dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
-        dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[5] = (Sint32) sample5;
-        dst[4] = (Sint32) sample4;
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-        src += 24;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
-    Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
-        const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src -= 8;
-        dst[15] = (Sint32) ((sample7 + last_sample7) >> 1);
-        dst[14] = (Sint32) ((sample6 + last_sample6) >> 1);
-        dst[13] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[12] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[7] = (Sint32) sample7;
-        dst[6] = (Sint32) sample6;
-        dst[5] = (Sint32) sample5;
-        dst[4] = (Sint32) sample4;
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-    Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
-    Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-        const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
-        const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
-        src += 16;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4;
-    const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
-    const Sint32 *target = ((const Sint32 *) cvt->buf);
-    Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
-    Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    while (dst >= target) {
-        const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
-        const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        src -= 8;
-        dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2);
-        dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2);
-        dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
-        dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
-        dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
-        dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
-        dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
-        dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
-        dst[23] = (Sint32) ((sample7 + last_sample7) >> 1);
-        dst[22] = (Sint32) ((sample6 + last_sample6) >> 1);
-        dst[21] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[20] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[19] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[18] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[17] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[16] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2);
-        dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2);
-        dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
-        dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
-        dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
-        dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
-        dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
-        dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
-        dst[7] = (Sint32) sample7;
-        dst[6] = (Sint32) sample6;
-        dst[5] = (Sint32) sample5;
-        dst[4] = (Sint32) sample4;
-        dst[3] = (Sint32) sample3;
-        dst[2] = (Sint32) sample2;
-        dst[1] = (Sint32) sample1;
-        dst[0] = (Sint32) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    const Sint32 *src = (Sint32 *) cvt->buf;
-    const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
-    Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-    Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-    Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-    Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-    Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-    Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-    Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
-    Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
-    while (dst < target) {
-        const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
-        const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
-        const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
-        const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
-        const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
-        const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
-        const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
-        const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
-        src += 32;
-        dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
-        dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
-        dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
-        dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
-        dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
-        dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
-        dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
-        dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src--;
-        dst[1] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[0] = (float) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src += 2;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src--;
-        dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[2] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[0] = (float) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src += 4;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src -= 2;
-        dst[3] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        src += 4;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src -= 2;
-        dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
-        dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[5] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[4] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
-        dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        src += 8;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src -= 4;
-        dst[7] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[6] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[5] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[4] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        src += 8;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src -= 4;
-        dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
-        dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
-        dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
-        dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[11] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[10] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[9] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[8] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
-        dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
-        dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
-        dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        src += 16;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
-    double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample5 = (double) SDL_SwapFloatLE(src[5]);
-        const double sample4 = (double) SDL_SwapFloatLE(src[4]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src -= 6;
-        dst[11] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[10] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[9] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[8] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[7] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[6] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[5] = (float) sample5;
-        dst[4] = (float) sample4;
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
-    double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample4 = (double) SDL_SwapFloatLE(src[4]);
-        const double sample5 = (double) SDL_SwapFloatLE(src[5]);
-        src += 12;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[4] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[5] = (float) ((sample5 + last_sample5) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
-    double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample5 = (double) SDL_SwapFloatLE(src[5]);
-        const double sample4 = (double) SDL_SwapFloatLE(src[4]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src -= 6;
-        dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
-        dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
-        dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
-        dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
-        dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
-        dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[17] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[16] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[15] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[14] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[13] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[12] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
-        dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
-        dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
-        dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
-        dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
-        dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[5] = (float) sample5;
-        dst[4] = (float) sample4;
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
-    double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample4 = (double) SDL_SwapFloatLE(src[4]);
-        const double sample5 = (double) SDL_SwapFloatLE(src[5]);
-        src += 24;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[4] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[5] = (float) ((sample5 + last_sample5) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
-    double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
-    double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
-    double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample7 = (double) SDL_SwapFloatLE(src[7]);
-        const double sample6 = (double) SDL_SwapFloatLE(src[6]);
-        const double sample5 = (double) SDL_SwapFloatLE(src[5]);
-        const double sample4 = (double) SDL_SwapFloatLE(src[4]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src -= 8;
-        dst[15] = (float) ((sample7 + last_sample7) * 0.5);
-        dst[14] = (float) ((sample6 + last_sample6) * 0.5);
-        dst[13] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[12] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[11] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[10] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[9] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[8] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[7] = (float) sample7;
-        dst[6] = (float) sample6;
-        dst[5] = (float) sample5;
-        dst[4] = (float) sample4;
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
-    double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
-    double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
-    double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample4 = (double) SDL_SwapFloatLE(src[4]);
-        const double sample5 = (double) SDL_SwapFloatLE(src[5]);
-        const double sample6 = (double) SDL_SwapFloatLE(src[6]);
-        const double sample7 = (double) SDL_SwapFloatLE(src[7]);
-        src += 16;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[4] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[5] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[6] = (float) ((sample6 + last_sample6) * 0.5);
-        dst[7] = (float) ((sample7 + last_sample7) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
-    double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
-    double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
-    double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    while (dst >= target) {
-        const double sample7 = (double) SDL_SwapFloatLE(src[7]);
-        const double sample6 = (double) SDL_SwapFloatLE(src[6]);
-        const double sample5 = (double) SDL_SwapFloatLE(src[5]);
-        const double sample4 = (double) SDL_SwapFloatLE(src[4]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        src -= 8;
-        dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25);
-        dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25);
-        dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
-        dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
-        dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
-        dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
-        dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
-        dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[23] = (float) ((sample7 + last_sample7) * 0.5);
-        dst[22] = (float) ((sample6 + last_sample6) * 0.5);
-        dst[21] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[20] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[19] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[18] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[17] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[16] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25);
-        dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25);
-        dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
-        dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
-        dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
-        dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
-        dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
-        dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[7] = (float) sample7;
-        dst[6] = (float) sample6;
-        dst[5] = (float) sample5;
-        dst[4] = (float) sample4;
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
-    double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
-    double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
-    double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
-    double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatLE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatLE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatLE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatLE(src[3]);
-        const double sample4 = (double) SDL_SwapFloatLE(src[4]);
-        const double sample5 = (double) SDL_SwapFloatLE(src[5]);
-        const double sample6 = (double) SDL_SwapFloatLE(src[6]);
-        const double sample7 = (double) SDL_SwapFloatLE(src[7]);
-        src += 32;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[4] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[5] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[6] = (float) ((sample6 + last_sample6) * 0.5);
-        dst[7] = (float) ((sample7 + last_sample7) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src--;
-        dst[1] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[0] = (float) sample0;
-        last_sample0 = sample0;
-        dst -= 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src += 2;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src--;
-        dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[2] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[0] = (float) sample0;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 1 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src += 4;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        last_sample0 = sample0;
-        dst++;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src -= 2;
-        dst[3] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        src += 4;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src -= 2;
-        dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
-        dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[5] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[4] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
-        dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 2 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        src += 8;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        dst += 2;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src -= 4;
-        dst[7] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[6] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[5] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[4] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        src += 8;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src -= 4;
-        dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
-        dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
-        dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
-        dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[11] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[10] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[9] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[8] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
-        dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
-        dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
-        dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 4 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        src += 16;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        dst += 4;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
-    double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample5 = (double) SDL_SwapFloatBE(src[5]);
-        const double sample4 = (double) SDL_SwapFloatBE(src[4]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src -= 6;
-        dst[11] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[10] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[9] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[8] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[7] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[6] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[5] = (float) sample5;
-        dst[4] = (float) sample4;
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 12;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
-    double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample4 = (double) SDL_SwapFloatBE(src[4]);
-        const double sample5 = (double) SDL_SwapFloatBE(src[5]);
-        src += 12;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[4] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[5] = (float) ((sample5 + last_sample5) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
-    double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample5 = (double) SDL_SwapFloatBE(src[5]);
-        const double sample4 = (double) SDL_SwapFloatBE(src[4]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src -= 6;
-        dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
-        dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
-        dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
-        dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
-        dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
-        dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[17] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[16] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[15] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[14] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[13] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[12] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
-        dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
-        dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
-        dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
-        dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
-        dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[5] = (float) sample5;
-        dst[4] = (float) sample4;
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 24;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 6 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
-    double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample4 = (double) SDL_SwapFloatBE(src[4]);
-        const double sample5 = (double) SDL_SwapFloatBE(src[5]);
-        src += 24;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[4] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[5] = (float) ((sample5 + last_sample5) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        dst += 6;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 2;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
-    double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
-    double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
-    double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample7 = (double) SDL_SwapFloatBE(src[7]);
-        const double sample6 = (double) SDL_SwapFloatBE(src[6]);
-        const double sample5 = (double) SDL_SwapFloatBE(src[5]);
-        const double sample4 = (double) SDL_SwapFloatBE(src[4]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src -= 8;
-        dst[15] = (float) ((sample7 + last_sample7) * 0.5);
-        dst[14] = (float) ((sample6 + last_sample6) * 0.5);
-        dst[13] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[12] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[11] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[10] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[9] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[8] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[7] = (float) sample7;
-        dst[6] = (float) sample6;
-        dst[5] = (float) sample5;
-        dst[4] = (float) sample4;
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 16;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 2;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
-    double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
-    double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
-    double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample4 = (double) SDL_SwapFloatBE(src[4]);
-        const double sample5 = (double) SDL_SwapFloatBE(src[5]);
-        const double sample6 = (double) SDL_SwapFloatBE(src[6]);
-        const double sample7 = (double) SDL_SwapFloatBE(src[7]);
-        src += 16;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[4] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[5] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[6] = (float) ((sample6 + last_sample6) * 0.5);
-        dst[7] = (float) ((sample7 + last_sample7) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt * 4;
-    float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4;
-    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
-    const float *target = ((const float *) cvt->buf);
-    double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
-    double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
-    double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
-    double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    while (dst >= target) {
-        const double sample7 = (double) SDL_SwapFloatBE(src[7]);
-        const double sample6 = (double) SDL_SwapFloatBE(src[6]);
-        const double sample5 = (double) SDL_SwapFloatBE(src[5]);
-        const double sample4 = (double) SDL_SwapFloatBE(src[4]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        src -= 8;
-        dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25);
-        dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25);
-        dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
-        dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
-        dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
-        dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
-        dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
-        dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
-        dst[23] = (float) ((sample7 + last_sample7) * 0.5);
-        dst[22] = (float) ((sample6 + last_sample6) * 0.5);
-        dst[21] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[20] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[19] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[18] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[17] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[16] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25);
-        dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25);
-        dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
-        dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
-        dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
-        dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
-        dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
-        dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
-        dst[7] = (float) sample7;
-        dst[6] = (float) sample6;
-        dst[5] = (float) sample5;
-        dst[4] = (float) sample4;
-        dst[3] = (float) sample3;
-        dst[2] = (float) sample2;
-        dst[1] = (float) sample1;
-        dst[0] = (float) sample0;
-        last_sample7 = sample7;
-        last_sample6 = sample6;
-        last_sample5 = sample5;
-        last_sample4 = sample4;
-        last_sample3 = sample3;
-        last_sample2 = sample2;
-        last_sample1 = sample1;
-        last_sample0 = sample0;
-        dst -= 32;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-static void SDLCALL
-SDL_Downsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 8 channels.\n");
-#endif
-
-    const int dstsize = cvt->len_cvt / 4;
-    float *dst = (float *) cvt->buf;
-    const float *src = (float *) cvt->buf;
-    const float *target = (const float *) (cvt->buf + dstsize);
-    double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
-    double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
-    double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
-    double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
-    double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
-    double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
-    double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
-    double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
-    while (dst < target) {
-        const double sample0 = (double) SDL_SwapFloatBE(src[0]);
-        const double sample1 = (double) SDL_SwapFloatBE(src[1]);
-        const double sample2 = (double) SDL_SwapFloatBE(src[2]);
-        const double sample3 = (double) SDL_SwapFloatBE(src[3]);
-        const double sample4 = (double) SDL_SwapFloatBE(src[4]);
-        const double sample5 = (double) SDL_SwapFloatBE(src[5]);
-        const double sample6 = (double) SDL_SwapFloatBE(src[6]);
-        const double sample7 = (double) SDL_SwapFloatBE(src[7]);
-        src += 32;
-        dst[0] = (float) ((sample0 + last_sample0) * 0.5);
-        dst[1] = (float) ((sample1 + last_sample1) * 0.5);
-        dst[2] = (float) ((sample2 + last_sample2) * 0.5);
-        dst[3] = (float) ((sample3 + last_sample3) * 0.5);
-        dst[4] = (float) ((sample4 + last_sample4) * 0.5);
-        dst[5] = (float) ((sample5 + last_sample5) * 0.5);
-        dst[6] = (float) ((sample6 + last_sample6) * 0.5);
-        dst[7] = (float) ((sample7 + last_sample7) * 0.5);
-        last_sample0 = sample0;
-        last_sample1 = sample1;
-        last_sample2 = sample2;
-        last_sample3 = sample3;
-        last_sample4 = sample4;
-        last_sample5 = sample5;
-        last_sample6 = sample6;
-        last_sample7 = sample7;
-        dst += 8;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-#endif  /* !LESS_RESAMPLERS */
-#endif  /* !NO_RESAMPLERS */
-
-
-const SDL_AudioRateFilters sdl_audio_rate_filters[] =
-{
-#if !NO_RESAMPLERS
-    { AUDIO_U8, 1, 0, 0, SDL_Downsample_U8_1c },
-    { AUDIO_U8, 1, 1, 0, SDL_Upsample_U8_1c },
-    { AUDIO_U8, 2, 0, 0, SDL_Downsample_U8_2c },
-    { AUDIO_U8, 2, 1, 0, SDL_Upsample_U8_2c },
-    { AUDIO_U8, 4, 0, 0, SDL_Downsample_U8_4c },
-    { AUDIO_U8, 4, 1, 0, SDL_Upsample_U8_4c },
-    { AUDIO_U8, 6, 0, 0, SDL_Downsample_U8_6c },
-    { AUDIO_U8, 6, 1, 0, SDL_Upsample_U8_6c },
-    { AUDIO_U8, 8, 0, 0, SDL_Downsample_U8_8c },
-    { AUDIO_U8, 8, 1, 0, SDL_Upsample_U8_8c },
-    { AUDIO_S8, 1, 0, 0, SDL_Downsample_S8_1c },
-    { AUDIO_S8, 1, 1, 0, SDL_Upsample_S8_1c },
-    { AUDIO_S8, 2, 0, 0, SDL_Downsample_S8_2c },
-    { AUDIO_S8, 2, 1, 0, SDL_Upsample_S8_2c },
-    { AUDIO_S8, 4, 0, 0, SDL_Downsample_S8_4c },
-    { AUDIO_S8, 4, 1, 0, SDL_Upsample_S8_4c },
-    { AUDIO_S8, 6, 0, 0, SDL_Downsample_S8_6c },
-    { AUDIO_S8, 6, 1, 0, SDL_Upsample_S8_6c },
-    { AUDIO_S8, 8, 0, 0, SDL_Downsample_S8_8c },
-    { AUDIO_S8, 8, 1, 0, SDL_Upsample_S8_8c },
-    { AUDIO_U16LSB, 1, 0, 0, SDL_Downsample_U16LSB_1c },
-    { AUDIO_U16LSB, 1, 1, 0, SDL_Upsample_U16LSB_1c },
-    { AUDIO_U16LSB, 2, 0, 0, SDL_Downsample_U16LSB_2c },
-    { AUDIO_U16LSB, 2, 1, 0, SDL_Upsample_U16LSB_2c },
-    { AUDIO_U16LSB, 4, 0, 0, SDL_Downsample_U16LSB_4c },
-    { AUDIO_U16LSB, 4, 1, 0, SDL_Upsample_U16LSB_4c },
-    { AUDIO_U16LSB, 6, 0, 0, SDL_Downsample_U16LSB_6c },
-    { AUDIO_U16LSB, 6, 1, 0, SDL_Upsample_U16LSB_6c },
-    { AUDIO_U16LSB, 8, 0, 0, SDL_Downsample_U16LSB_8c },
-    { AUDIO_U16LSB, 8, 1, 0, SDL_Upsample_U16LSB_8c },
-    { AUDIO_S16LSB, 1, 0, 0, SDL_Downsample_S16LSB_1c },
-    { AUDIO_S16LSB, 1, 1, 0, SDL_Upsample_S16LSB_1c },
-    { AUDIO_S16LSB, 2, 0, 0, SDL_Downsample_S16LSB_2c },
-    { AUDIO_S16LSB, 2, 1, 0, SDL_Upsample_S16LSB_2c },
-    { AUDIO_S16LSB, 4, 0, 0, SDL_Downsample_S16LSB_4c },
-    { AUDIO_S16LSB, 4, 1, 0, SDL_Upsample_S16LSB_4c },
-    { AUDIO_S16LSB, 6, 0, 0, SDL_Downsample_S16LSB_6c },
-    { AUDIO_S16LSB, 6, 1, 0, SDL_Upsample_S16LSB_6c },
-    { AUDIO_S16LSB, 8, 0, 0, SDL_Downsample_S16LSB_8c },
-    { AUDIO_S16LSB, 8, 1, 0, SDL_Upsample_S16LSB_8c },
-    { AUDIO_U16MSB, 1, 0, 0, SDL_Downsample_U16MSB_1c },
-    { AUDIO_U16MSB, 1, 1, 0, SDL_Upsample_U16MSB_1c },
-    { AUDIO_U16MSB, 2, 0, 0, SDL_Downsample_U16MSB_2c },
-    { AUDIO_U16MSB, 2, 1, 0, SDL_Upsample_U16MSB_2c },
-    { AUDIO_U16MSB, 4, 0, 0, SDL_Downsample_U16MSB_4c },
-    { AUDIO_U16MSB, 4, 1, 0, SDL_Upsample_U16MSB_4c },
-    { AUDIO_U16MSB, 6, 0, 0, SDL_Downsample_U16MSB_6c },
-    { AUDIO_U16MSB, 6, 1, 0, SDL_Upsample_U16MSB_6c },
-    { AUDIO_U16MSB, 8, 0, 0, SDL_Downsample_U16MSB_8c },
-    { AUDIO_U16MSB, 8, 1, 0, SDL_Upsample_U16MSB_8c },
-    { AUDIO_S16MSB, 1, 0, 0, SDL_Downsample_S16MSB_1c },
-    { AUDIO_S16MSB, 1, 1, 0, SDL_Upsample_S16MSB_1c },
-    { AUDIO_S16MSB, 2, 0, 0, SDL_Downsample_S16MSB_2c },
-    { AUDIO_S16MSB, 2, 1, 0, SDL_Upsample_S16MSB_2c },
-    { AUDIO_S16MSB, 4, 0, 0, SDL_Downsample_S16MSB_4c },
-    { AUDIO_S16MSB, 4, 1, 0, SDL_Upsample_S16MSB_4c },
-    { AUDIO_S16MSB, 6, 0, 0, SDL_Downsample_S16MSB_6c },
-    { AUDIO_S16MSB, 6, 1, 0, SDL_Upsample_S16MSB_6c },
-    { AUDIO_S16MSB, 8, 0, 0, SDL_Downsample_S16MSB_8c },
-    { AUDIO_S16MSB, 8, 1, 0, SDL_Upsample_S16MSB_8c },
-    { AUDIO_S32LSB, 1, 0, 0, SDL_Downsample_S32LSB_1c },
-    { AUDIO_S32LSB, 1, 1, 0, SDL_Upsample_S32LSB_1c },
-    { AUDIO_S32LSB, 2, 0, 0, SDL_Downsample_S32LSB_2c },
-    { AUDIO_S32LSB, 2, 1, 0, SDL_Upsample_S32LSB_2c },
-    { AUDIO_S32LSB, 4, 0, 0, SDL_Downsample_S32LSB_4c },
-    { AUDIO_S32LSB, 4, 1, 0, SDL_Upsample_S32LSB_4c },
-    { AUDIO_S32LSB, 6, 0, 0, SDL_Downsample_S32LSB_6c },
-    { AUDIO_S32LSB, 6, 1, 0, SDL_Upsample_S32LSB_6c },
-    { AUDIO_S32LSB, 8, 0, 0, SDL_Downsample_S32LSB_8c },
-    { AUDIO_S32LSB, 8, 1, 0, SDL_Upsample_S32LSB_8c },
-    { AUDIO_S32MSB, 1, 0, 0, SDL_Downsample_S32MSB_1c },
-    { AUDIO_S32MSB, 1, 1, 0, SDL_Upsample_S32MSB_1c },
-    { AUDIO_S32MSB, 2, 0, 0, SDL_Downsample_S32MSB_2c },
-    { AUDIO_S32MSB, 2, 1, 0, SDL_Upsample_S32MSB_2c },
-    { AUDIO_S32MSB, 4, 0, 0, SDL_Downsample_S32MSB_4c },
-    { AUDIO_S32MSB, 4, 1, 0, SDL_Upsample_S32MSB_4c },
-    { AUDIO_S32MSB, 6, 0, 0, SDL_Downsample_S32MSB_6c },
-    { AUDIO_S32MSB, 6, 1, 0, SDL_Upsample_S32MSB_6c },
-    { AUDIO_S32MSB, 8, 0, 0, SDL_Downsample_S32MSB_8c },
-    { AUDIO_S32MSB, 8, 1, 0, SDL_Upsample_S32MSB_8c },
-    { AUDIO_F32LSB, 1, 0, 0, SDL_Downsample_F32LSB_1c },
-    { AUDIO_F32LSB, 1, 1, 0, SDL_Upsample_F32LSB_1c },
-    { AUDIO_F32LSB, 2, 0, 0, SDL_Downsample_F32LSB_2c },
-    { AUDIO_F32LSB, 2, 1, 0, SDL_Upsample_F32LSB_2c },
-    { AUDIO_F32LSB, 4, 0, 0, SDL_Downsample_F32LSB_4c },
-    { AUDIO_F32LSB, 4, 1, 0, SDL_Upsample_F32LSB_4c },
-    { AUDIO_F32LSB, 6, 0, 0, SDL_Downsample_F32LSB_6c },
-    { AUDIO_F32LSB, 6, 1, 0, SDL_Upsample_F32LSB_6c },
-    { AUDIO_F32LSB, 8, 0, 0, SDL_Downsample_F32LSB_8c },
-    { AUDIO_F32LSB, 8, 1, 0, SDL_Upsample_F32LSB_8c },
-    { AUDIO_F32MSB, 1, 0, 0, SDL_Downsample_F32MSB_1c },
-    { AUDIO_F32MSB, 1, 1, 0, SDL_Upsample_F32MSB_1c },
-    { AUDIO_F32MSB, 2, 0, 0, SDL_Downsample_F32MSB_2c },
-    { AUDIO_F32MSB, 2, 1, 0, SDL_Upsample_F32MSB_2c },
-    { AUDIO_F32MSB, 4, 0, 0, SDL_Downsample_F32MSB_4c },
-    { AUDIO_F32MSB, 4, 1, 0, SDL_Upsample_F32MSB_4c },
-    { AUDIO_F32MSB, 6, 0, 0, SDL_Downsample_F32MSB_6c },
-    { AUDIO_F32MSB, 6, 1, 0, SDL_Upsample_F32MSB_6c },
-    { AUDIO_F32MSB, 8, 0, 0, SDL_Downsample_F32MSB_8c },
-    { AUDIO_F32MSB, 8, 1, 0, SDL_Upsample_F32MSB_8c },
-#if !LESS_RESAMPLERS
-    { AUDIO_U8, 1, 0, 2, SDL_Downsample_U8_1c_x2 },
-    { AUDIO_U8, 1, 1, 2, SDL_Upsample_U8_1c_x2 },
-    { AUDIO_U8, 1, 0, 4, SDL_Downsample_U8_1c_x4 },
-    { AUDIO_U8, 1, 1, 4, SDL_Upsample_U8_1c_x4 },
-    { AUDIO_U8, 2, 0, 2, SDL_Downsample_U8_2c_x2 },
-    { AUDIO_U8, 2, 1, 2, SDL_Upsample_U8_2c_x2 },
-    { AUDIO_U8, 2, 0, 4, SDL_Downsample_U8_2c_x4 },
-    { AUDIO_U8, 2, 1, 4, SDL_Upsample_U8_2c_x4 },
-    { AUDIO_U8, 4, 0, 2, SDL_Downsample_U8_4c_x2 },
-    { AUDIO_U8, 4, 1, 2, SDL_Upsample_U8_4c_x2 },
-    { AUDIO_U8, 4, 0, 4, SDL_Downsample_U8_4c_x4 },
-    { AUDIO_U8, 4, 1, 4, SDL_Upsample_U8_4c_x4 },
-    { AUDIO_U8, 6, 0, 2, SDL_Downsample_U8_6c_x2 },
-    { AUDIO_U8, 6, 1, 2, SDL_Upsample_U8_6c_x2 },
-    { AUDIO_U8, 6, 0, 4, SDL_Downsample_U8_6c_x4 },
-    { AUDIO_U8, 6, 1, 4, SDL_Upsample_U8_6c_x4 },
-    { AUDIO_U8, 8, 0, 2, SDL_Downsample_U8_8c_x2 },
-    { AUDIO_U8, 8, 1, 2, SDL_Upsample_U8_8c_x2 },
-    { AUDIO_U8, 8, 0, 4, SDL_Downsample_U8_8c_x4 },
-    { AUDIO_U8, 8, 1, 4, SDL_Upsample_U8_8c_x4 },
-    { AUDIO_S8, 1, 0, 2, SDL_Downsample_S8_1c_x2 },
-    { AUDIO_S8, 1, 1, 2, SDL_Upsample_S8_1c_x2 },
-    { AUDIO_S8, 1, 0, 4, SDL_Downsample_S8_1c_x4 },
-    { AUDIO_S8, 1, 1, 4, SDL_Upsample_S8_1c_x4 },
-    { AUDIO_S8, 2, 0, 2, SDL_Downsample_S8_2c_x2 },
-    { AUDIO_S8, 2, 1, 2, SDL_Upsample_S8_2c_x2 },
-    { AUDIO_S8, 2, 0, 4, SDL_Downsample_S8_2c_x4 },
-    { AUDIO_S8, 2, 1, 4, SDL_Upsample_S8_2c_x4 },
-    { AUDIO_S8, 4, 0, 2, SDL_Downsample_S8_4c_x2 },
-    { AUDIO_S8, 4, 1, 2, SDL_Upsample_S8_4c_x2 },
-    { AUDIO_S8, 4, 0, 4, SDL_Downsample_S8_4c_x4 },
-    { AUDIO_S8, 4, 1, 4, SDL_Upsample_S8_4c_x4 },
-    { AUDIO_S8, 6, 0, 2, SDL_Downsample_S8_6c_x2 },
-    { AUDIO_S8, 6, 1, 2, SDL_Upsample_S8_6c_x2 },
-    { AUDIO_S8, 6, 0, 4, SDL_Downsample_S8_6c_x4 },
-    { AUDIO_S8, 6, 1, 4, SDL_Upsample_S8_6c_x4 },
-    { AUDIO_S8, 8, 0, 2, SDL_Downsample_S8_8c_x2 },
-    { AUDIO_S8, 8, 1, 2, SDL_Upsample_S8_8c_x2 },
-    { AUDIO_S8, 8, 0, 4, SDL_Downsample_S8_8c_x4 },
-    { AUDIO_S8, 8, 1, 4, SDL_Upsample_S8_8c_x4 },
-    { AUDIO_U16LSB, 1, 0, 2, SDL_Downsample_U16LSB_1c_x2 },
-    { AUDIO_U16LSB, 1, 1, 2, SDL_Upsample_U16LSB_1c_x2 },
-    { AUDIO_U16LSB, 1, 0, 4, SDL_Downsample_U16LSB_1c_x4 },
-    { AUDIO_U16LSB, 1, 1, 4, SDL_Upsample_U16LSB_1c_x4 },
-    { AUDIO_U16LSB, 2, 0, 2, SDL_Downsample_U16LSB_2c_x2 },
-    { AUDIO_U16LSB, 2, 1, 2, SDL_Upsample_U16LSB_2c_x2 },
-    { AUDIO_U16LSB, 2, 0, 4, SDL_Downsample_U16LSB_2c_x4 },
-    { AUDIO_U16LSB, 2, 1, 4, SDL_Upsample_U16LSB_2c_x4 },
-    { AUDIO_U16LSB, 4, 0, 2, SDL_Downsample_U16LSB_4c_x2 },
-    { AUDIO_U16LSB, 4, 1, 2, SDL_Upsample_U16LSB_4c_x2 },
-    { AUDIO_U16LSB, 4, 0, 4, SDL_Downsample_U16LSB_4c_x4 },
-    { AUDIO_U16LSB, 4, 1, 4, SDL_Upsample_U16LSB_4c_x4 },
-    { AUDIO_U16LSB, 6, 0, 2, SDL_Downsample_U16LSB_6c_x2 },
-    { AUDIO_U16LSB, 6, 1, 2, SDL_Upsample_U16LSB_6c_x2 },
-    { AUDIO_U16LSB, 6, 0, 4, SDL_Downsample_U16LSB_6c_x4 },
-    { AUDIO_U16LSB, 6, 1, 4, SDL_Upsample_U16LSB_6c_x4 },
-    { AUDIO_U16LSB, 8, 0, 2, SDL_Downsample_U16LSB_8c_x2 },
-    { AUDIO_U16LSB, 8, 1, 2, SDL_Upsample_U16LSB_8c_x2 },
-    { AUDIO_U16LSB, 8, 0, 4, SDL_Downsample_U16LSB_8c_x4 },
-    { AUDIO_U16LSB, 8, 1, 4, SDL_Upsample_U16LSB_8c_x4 },
-    { AUDIO_S16LSB, 1, 0, 2, SDL_Downsample_S16LSB_1c_x2 },
-    { AUDIO_S16LSB, 1, 1, 2, SDL_Upsample_S16LSB_1c_x2 },
-    { AUDIO_S16LSB, 1, 0, 4, SDL_Downsample_S16LSB_1c_x4 },
-    { AUDIO_S16LSB, 1, 1, 4, SDL_Upsample_S16LSB_1c_x4 },
-    { AUDIO_S16LSB, 2, 0, 2, SDL_Downsample_S16LSB_2c_x2 },
-    { AUDIO_S16LSB, 2, 1, 2, SDL_Upsample_S16LSB_2c_x2 },
-    { AUDIO_S16LSB, 2, 0, 4, SDL_Downsample_S16LSB_2c_x4 },
-    { AUDIO_S16LSB, 2, 1, 4, SDL_Upsample_S16LSB_2c_x4 },
-    { AUDIO_S16LSB, 4, 0, 2, SDL_Downsample_S16LSB_4c_x2 },
-    { AUDIO_S16LSB, 4, 1, 2, SDL_Upsample_S16LSB_4c_x2 },
-    { AUDIO_S16LSB, 4, 0, 4, SDL_Downsample_S16LSB_4c_x4 },
-    { AUDIO_S16LSB, 4, 1, 4, SDL_Upsample_S16LSB_4c_x4 },
-    { AUDIO_S16LSB, 6, 0, 2, SDL_Downsample_S16LSB_6c_x2 },
-    { AUDIO_S16LSB, 6, 1, 2, SDL_Upsample_S16LSB_6c_x2 },
-    { AUDIO_S16LSB, 6, 0, 4, SDL_Downsample_S16LSB_6c_x4 },
-    { AUDIO_S16LSB, 6, 1, 4, SDL_Upsample_S16LSB_6c_x4 },
-    { AUDIO_S16LSB, 8, 0, 2, SDL_Downsample_S16LSB_8c_x2 },
-    { AUDIO_S16LSB, 8, 1, 2, SDL_Upsample_S16LSB_8c_x2 },
-    { AUDIO_S16LSB, 8, 0, 4, SDL_Downsample_S16LSB_8c_x4 },
-    { AUDIO_S16LSB, 8, 1, 4, SDL_Upsample_S16LSB_8c_x4 },
-    { AUDIO_U16MSB, 1, 0, 2, SDL_Downsample_U16MSB_1c_x2 },
-    { AUDIO_U16MSB, 1, 1, 2, SDL_Upsample_U16MSB_1c_x2 },
-    { AUDIO_U16MSB, 1, 0, 4, SDL_Downsample_U16MSB_1c_x4 },
-    { AUDIO_U16MSB, 1, 1, 4, SDL_Upsample_U16MSB_1c_x4 },
-    { AUDIO_U16MSB, 2, 0, 2, SDL_Downsample_U16MSB_2c_x2 },
-    { AUDIO_U16MSB, 2, 1, 2, SDL_Upsample_U16MSB_2c_x2 },
-    { AUDIO_U16MSB, 2, 0, 4, SDL_Downsample_U16MSB_2c_x4 },
-    { AUDIO_U16MSB, 2, 1, 4, SDL_Upsample_U16MSB_2c_x4 },
-    { AUDIO_U16MSB, 4, 0, 2, SDL_Downsample_U16MSB_4c_x2 },
-    { AUDIO_U16MSB, 4, 1, 2, SDL_Upsample_U16MSB_4c_x2 },
-    { AUDIO_U16MSB, 4, 0, 4, SDL_Downsample_U16MSB_4c_x4 },
-    { AUDIO_U16MSB, 4, 1, 4, SDL_Upsample_U16MSB_4c_x4 },
-    { AUDIO_U16MSB, 6, 0, 2, SDL_Downsample_U16MSB_6c_x2 },
-    { AUDIO_U16MSB, 6, 1, 2, SDL_Upsample_U16MSB_6c_x2 },
-    { AUDIO_U16MSB, 6, 0, 4, SDL_Downsample_U16MSB_6c_x4 },
-    { AUDIO_U16MSB, 6, 1, 4, SDL_Upsample_U16MSB_6c_x4 },
-    { AUDIO_U16MSB, 8, 0, 2, SDL_Downsample_U16MSB_8c_x2 },
-    { AUDIO_U16MSB, 8, 1, 2, SDL_Upsample_U16MSB_8c_x2 },
-    { AUDIO_U16MSB, 8, 0, 4, SDL_Downsample_U16MSB_8c_x4 },
-    { AUDIO_U16MSB, 8, 1, 4, SDL_Upsample_U16MSB_8c_x4 },
-    { AUDIO_S16MSB, 1, 0, 2, SDL_Downsample_S16MSB_1c_x2 },
-    { AUDIO_S16MSB, 1, 1, 2, SDL_Upsample_S16MSB_1c_x2 },
-    { AUDIO_S16MSB, 1, 0, 4, SDL_Downsample_S16MSB_1c_x4 },
-    { AUDIO_S16MSB, 1, 1, 4, SDL_Upsample_S16MSB_1c_x4 },
-    { AUDIO_S16MSB, 2, 0, 2, SDL_Downsample_S16MSB_2c_x2 },
-    { AUDIO_S16MSB, 2, 1, 2, SDL_Upsample_S16MSB_2c_x2 },
-    { AUDIO_S16MSB, 2, 0, 4, SDL_Downsample_S16MSB_2c_x4 },
-    { AUDIO_S16MSB, 2, 1, 4, SDL_Upsample_S16MSB_2c_x4 },
-    { AUDIO_S16MSB, 4, 0, 2, SDL_Downsample_S16MSB_4c_x2 },
-    { AUDIO_S16MSB, 4, 1, 2, SDL_Upsample_S16MSB_4c_x2 },
-    { AUDIO_S16MSB, 4, 0, 4, SDL_Downsample_S16MSB_4c_x4 },
-    { AUDIO_S16MSB, 4, 1, 4, SDL_Upsample_S16MSB_4c_x4 },
-    { AUDIO_S16MSB, 6, 0, 2, SDL_Downsample_S16MSB_6c_x2 },
-    { AUDIO_S16MSB, 6, 1, 2, SDL_Upsample_S16MSB_6c_x2 },
-    { AUDIO_S16MSB, 6, 0, 4, SDL_Downsample_S16MSB_6c_x4 },
-    { AUDIO_S16MSB, 6, 1, 4, SDL_Upsample_S16MSB_6c_x4 },
-    { AUDIO_S16MSB, 8, 0, 2, SDL_Downsample_S16MSB_8c_x2 },
-    { AUDIO_S16MSB, 8, 1, 2, SDL_Upsample_S16MSB_8c_x2 },
-    { AUDIO_S16MSB, 8, 0, 4, SDL_Downsample_S16MSB_8c_x4 },
-    { AUDIO_S16MSB, 8, 1, 4, SDL_Upsample_S16MSB_8c_x4 },
-    { AUDIO_S32LSB, 1, 0, 2, SDL_Downsample_S32LSB_1c_x2 },
-    { AUDIO_S32LSB, 1, 1, 2, SDL_Upsample_S32LSB_1c_x2 },
-    { AUDIO_S32LSB, 1, 0, 4, SDL_Downsample_S32LSB_1c_x4 },
-    { AUDIO_S32LSB, 1, 1, 4, SDL_Upsample_S32LSB_1c_x4 },
-    { AUDIO_S32LSB, 2, 0, 2, SDL_Downsample_S32LSB_2c_x2 },
-    { AUDIO_S32LSB, 2, 1, 2, SDL_Upsample_S32LSB_2c_x2 },
-    { AUDIO_S32LSB, 2, 0, 4, SDL_Downsample_S32LSB_2c_x4 },
-    { AUDIO_S32LSB, 2, 1, 4, SDL_Upsample_S32LSB_2c_x4 },
-    { AUDIO_S32LSB, 4, 0, 2, SDL_Downsample_S32LSB_4c_x2 },
-    { AUDIO_S32LSB, 4, 1, 2, SDL_Upsample_S32LSB_4c_x2 },
-    { AUDIO_S32LSB, 4, 0, 4, SDL_Downsample_S32LSB_4c_x4 },
-    { AUDIO_S32LSB, 4, 1, 4, SDL_Upsample_S32LSB_4c_x4 },
-    { AUDIO_S32LSB, 6, 0, 2, SDL_Downsample_S32LSB_6c_x2 },
-    { AUDIO_S32LSB, 6, 1, 2, SDL_Upsample_S32LSB_6c_x2 },
-    { AUDIO_S32LSB, 6, 0, 4, SDL_Downsample_S32LSB_6c_x4 },
-    { AUDIO_S32LSB, 6, 1, 4, SDL_Upsample_S32LSB_6c_x4 },
-    { AUDIO_S32LSB, 8, 0, 2, SDL_Downsample_S32LSB_8c_x2 },
-    { AUDIO_S32LSB, 8, 1, 2, SDL_Upsample_S32LSB_8c_x2 },
-    { AUDIO_S32LSB, 8, 0, 4, SDL_Downsample_S32LSB_8c_x4 },
-    { AUDIO_S32LSB, 8, 1, 4, SDL_Upsample_S32LSB_8c_x4 },
-    { AUDIO_S32MSB, 1, 0, 2, SDL_Downsample_S32MSB_1c_x2 },
-    { AUDIO_S32MSB, 1, 1, 2, SDL_Upsample_S32MSB_1c_x2 },
-    { AUDIO_S32MSB, 1, 0, 4, SDL_Downsample_S32MSB_1c_x4 },
-    { AUDIO_S32MSB, 1, 1, 4, SDL_Upsample_S32MSB_1c_x4 },
-    { AUDIO_S32MSB, 2, 0, 2, SDL_Downsample_S32MSB_2c_x2 },
-    { AUDIO_S32MSB, 2, 1, 2, SDL_Upsample_S32MSB_2c_x2 },
-    { AUDIO_S32MSB, 2, 0, 4, SDL_Downsample_S32MSB_2c_x4 },
-    { AUDIO_S32MSB, 2, 1, 4, SDL_Upsample_S32MSB_2c_x4 },
-    { AUDIO_S32MSB, 4, 0, 2, SDL_Downsample_S32MSB_4c_x2 },
-    { AUDIO_S32MSB, 4, 1, 2, SDL_Upsample_S32MSB_4c_x2 },
-    { AUDIO_S32MSB, 4, 0, 4, SDL_Downsample_S32MSB_4c_x4 },
-    { AUDIO_S32MSB, 4, 1, 4, SDL_Upsample_S32MSB_4c_x4 },
-    { AUDIO_S32MSB, 6, 0, 2, SDL_Downsample_S32MSB_6c_x2 },
-    { AUDIO_S32MSB, 6, 1, 2, SDL_Upsample_S32MSB_6c_x2 },
-    { AUDIO_S32MSB, 6, 0, 4, SDL_Downsample_S32MSB_6c_x4 },
-    { AUDIO_S32MSB, 6, 1, 4, SDL_Upsample_S32MSB_6c_x4 },
-    { AUDIO_S32MSB, 8, 0, 2, SDL_Downsample_S32MSB_8c_x2 },
-    { AUDIO_S32MSB, 8, 1, 2, SDL_Upsample_S32MSB_8c_x2 },
-    { AUDIO_S32MSB, 8, 0, 4, SDL_Downsample_S32MSB_8c_x4 },
-    { AUDIO_S32MSB, 8, 1, 4, SDL_Upsample_S32MSB_8c_x4 },
-    { AUDIO_F32LSB, 1, 0, 2, SDL_Downsample_F32LSB_1c_x2 },
-    { AUDIO_F32LSB, 1, 1, 2, SDL_Upsample_F32LSB_1c_x2 },
-    { AUDIO_F32LSB, 1, 0, 4, SDL_Downsample_F32LSB_1c_x4 },
-    { AUDIO_F32LSB, 1, 1, 4, SDL_Upsample_F32LSB_1c_x4 },
-    { AUDIO_F32LSB, 2, 0, 2, SDL_Downsample_F32LSB_2c_x2 },
-    { AUDIO_F32LSB, 2, 1, 2, SDL_Upsample_F32LSB_2c_x2 },
-    { AUDIO_F32LSB, 2, 0, 4, SDL_Downsample_F32LSB_2c_x4 },
-    { AUDIO_F32LSB, 2, 1, 4, SDL_Upsample_F32LSB_2c_x4 },
-    { AUDIO_F32LSB, 4, 0, 2, SDL_Downsample_F32LSB_4c_x2 },
-    { AUDIO_F32LSB, 4, 1, 2, SDL_Upsample_F32LSB_4c_x2 },
-    { AUDIO_F32LSB, 4, 0, 4, SDL_Downsample_F32LSB_4c_x4 },
-    { AUDIO_F32LSB, 4, 1, 4, SDL_Upsample_F32LSB_4c_x4 },
-    { AUDIO_F32LSB, 6, 0, 2, SDL_Downsample_F32LSB_6c_x2 },
-    { AUDIO_F32LSB, 6, 1, 2, SDL_Upsample_F32LSB_6c_x2 },
-    { AUDIO_F32LSB, 6, 0, 4, SDL_Downsample_F32LSB_6c_x4 },
-    { AUDIO_F32LSB, 6, 1, 4, SDL_Upsample_F32LSB_6c_x4 },
-    { AUDIO_F32LSB, 8, 0, 2, SDL_Downsample_F32LSB_8c_x2 },
-    { AUDIO_F32LSB, 8, 1, 2, SDL_Upsample_F32LSB_8c_x2 },
-    { AUDIO_F32LSB, 8, 0, 4, SDL_Downsample_F32LSB_8c_x4 },
-    { AUDIO_F32LSB, 8, 1, 4, SDL_Upsample_F32LSB_8c_x4 },
-    { AUDIO_F32MSB, 1, 0, 2, SDL_Downsample_F32MSB_1c_x2 },
-    { AUDIO_F32MSB, 1, 1, 2, SDL_Upsample_F32MSB_1c_x2 },
-    { AUDIO_F32MSB, 1, 0, 4, SDL_Downsample_F32MSB_1c_x4 },
-    { AUDIO_F32MSB, 1, 1, 4, SDL_Upsample_F32MSB_1c_x4 },
-    { AUDIO_F32MSB, 2, 0, 2, SDL_Downsample_F32MSB_2c_x2 },
-    { AUDIO_F32MSB, 2, 1, 2, SDL_Upsample_F32MSB_2c_x2 },
-    { AUDIO_F32MSB, 2, 0, 4, SDL_Downsample_F32MSB_2c_x4 },
-    { AUDIO_F32MSB, 2, 1, 4, SDL_Upsample_F32MSB_2c_x4 },
-    { AUDIO_F32MSB, 4, 0, 2, SDL_Downsample_F32MSB_4c_x2 },
-    { AUDIO_F32MSB, 4, 1, 2, SDL_Upsample_F32MSB_4c_x2 },
-    { AUDIO_F32MSB, 4, 0, 4, SDL_Downsample_F32MSB_4c_x4 },
-    { AUDIO_F32MSB, 4, 1, 4, SDL_Upsample_F32MSB_4c_x4 },
-    { AUDIO_F32MSB, 6, 0, 2, SDL_Downsample_F32MSB_6c_x2 },
-    { AUDIO_F32MSB, 6, 1, 2, SDL_Upsample_F32MSB_6c_x2 },
-    { AUDIO_F32MSB, 6, 0, 4, SDL_Downsample_F32MSB_6c_x4 },
-    { AUDIO_F32MSB, 6, 1, 4, SDL_Upsample_F32MSB_6c_x4 },
-    { AUDIO_F32MSB, 8, 0, 2, SDL_Downsample_F32MSB_8c_x2 },
-    { AUDIO_F32MSB, 8, 1, 2, SDL_Upsample_F32MSB_8c_x2 },
-    { AUDIO_F32MSB, 8, 0, 4, SDL_Downsample_F32MSB_8c_x4 },
-    { AUDIO_F32MSB, 8, 1, 4, SDL_Upsample_F32MSB_8c_x4 },
-#endif  /* !LESS_RESAMPLERS */
-#endif  /* !NO_RESAMPLERS */
-    { 0, 0, 0, 0, NULL }
-};
-
-/* 390 converters generated. */
-
-/* *INDENT-ON* */
-
 /* vi: set ts=4 sw=4 expandtab: */

+ 0 - 761
src/audio/sdlgenaudiocvt.pl

@@ -1,761 +0,0 @@
-#!/usr/bin/perl -w
-
-use warnings;
-use strict;
-
-my @audiotypes = qw(
-    U8
-    S8
-    U16LSB
-    S16LSB
-    U16MSB
-    S16MSB
-    S32LSB
-    S32MSB
-    F32LSB
-    F32MSB
-);
-
-my @channels = ( 1, 2, 4, 6, 8 );
-my %funcs;
-my $custom_converters = 0;
-
-
-sub getTypeConvertHashId {
-    my ($from, $to) = @_;
-    return "TYPECONVERTER $from/$to";
-}
-
-
-sub getResamplerHashId {
-    my ($from, $channels, $upsample, $multiple) = @_;
-    return "RESAMPLER $from/$channels/$upsample/$multiple";
-}
-
-
-sub outputHeader {
-    print <<EOF;
-/* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <slouken\@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "../SDL_internal.h"
-#include "SDL_audio.h"
-#include "SDL_audio_c.h"
-
-#ifndef DEBUG_CONVERT
-#define DEBUG_CONVERT 0
-#endif
-
-
-/* If you can guarantee your data and need space, you can eliminate code... */
-
-/* Just build the arbitrary resamplers if you're saving code space. */
-#ifndef LESS_RESAMPLERS
-#define LESS_RESAMPLERS 0
-#endif
-
-/* Don't build any resamplers if you're REALLY saving code space. */
-#ifndef NO_RESAMPLERS
-#define NO_RESAMPLERS 0
-#endif
-
-/* Don't build any type converters if you're saving code space. */
-#ifndef NO_CONVERTERS
-#define NO_CONVERTERS 0
-#endif
-
-
-/* *INDENT-OFF* */
-
-EOF
-
-    my @vals = ( 127, 32767, 2147483647 );
-    foreach (@vals) {
-        my $val = $_;
-        my $fval = 1.0 / $val;
-        print("#define DIVBY${val} ${fval}f\n");
-    }
-
-    print("\n");
-}
-
-sub outputFooter {
-    print <<EOF;
-/* $custom_converters converters generated. */
-
-/* *INDENT-ON* */
-
-/* vi: set ts=4 sw=4 expandtab: */
-EOF
-}
-
-sub splittype {
-    my $t = shift;
-    my ($signed, $size, $endian) = $t =~ /([USF])(\d+)([LM]SB|)/;
-    my $float = ($signed eq 'F') ? 1 : 0;
-    $signed = (($float) or ($signed eq 'S')) ? 1 : 0;
-    $endian = 'NONE' if ($endian eq '');
-
-    my $ctype = '';
-    if ($float) {
-        $ctype = (($size == 32) ? 'float' : 'double');
-    } else {
-        $ctype = (($signed) ? 'S' : 'U') . "int${size}";
-    }
-
-    return ($signed, $float, $size, $endian, $ctype);
-}
-
-sub getSwapFunc {
-    my ($size, $signed, $float, $endian, $val) = @_;
-    my $BEorLE = (($endian eq 'MSB') ? 'BE' : 'LE');
-    my $code = '';
-
-    if ($float) {
-        $code = "SDL_SwapFloat${BEorLE}($val)";
-    } else {
-        if ($size > 8) {
-            $code = "SDL_Swap${BEorLE}${size}($val)";
-        } else {
-            $code = $val;
-        }
-
-        if (($signed) and (!$float)) {
-            $code = "((Sint${size}) $code)";
-        }
-    }
-
-    return "${code}";
-}
-
-
-sub maxIntVal {
-    my $size = shift;
-    if ($size == 8) {
-        return 0x7F;
-    } elsif ($size == 16) {
-        return 0x7FFF;
-    } elsif ($size == 32) {
-        return 0x7FFFFFFF;
-    }
-
-    die("bug in script.\n");
-}
-
-sub getFloatToIntMult {
-    my $size = shift;
-    my $val = maxIntVal($size) . '.0';
-    $val .= 'f' if ($size < 32);
-    return $val;
-}
-
-sub getIntToFloatDivBy {
-    my $size = shift;
-    return 'DIVBY' . maxIntVal($size);
-}
-
-sub getSignFlipVal {
-    my $size = shift;
-    if ($size == 8) {
-        return '0x80';
-    } elsif ($size == 16) {
-        return '0x8000';
-    } elsif ($size == 32) {
-        return '0x80000000';
-    }
-
-    die("bug in script.\n");
-}
-
-sub buildCvtFunc {
-    my ($from, $to) = @_;
-    my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from);
-    my ($tsigned, $tfloat, $tsize, $tendian, $tctype) = splittype($to);
-    my $diffs = 0;
-    $diffs++ if ($fsize != $tsize);
-    $diffs++ if ($fsigned != $tsigned);
-    $diffs++ if ($ffloat != $tfloat);
-    $diffs++ if ($fendian ne $tendian);
-
-    return if ($diffs == 0);
-
-    my $hashid = getTypeConvertHashId($from, $to);
-    if (1) { # !!! FIXME: if ($diffs > 1) {
-        my $sym = "SDL_Convert_${from}_to_${to}";
-        $funcs{$hashid} = $sym;
-        $custom_converters++;
-
-        # Always unsigned for ints, for possible byteswaps.
-        my $srctype = (($ffloat) ? 'float' : "Uint${fsize}");
-
-        print <<EOF;
-static void SDLCALL
-${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const $srctype *src;
-    $tctype *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_${from} to AUDIO_${to}.\\n");
-#endif
-
-EOF
-
-        if ($fsize < $tsize) {
-            my $mult = $tsize / $fsize;
-            print <<EOF;
-    src = ((const $srctype *) (cvt->buf + cvt->len_cvt)) - 1;
-    dst = (($tctype *) (cvt->buf + cvt->len_cvt * $mult)) - 1;
-    for (i = cvt->len_cvt / sizeof ($srctype); i; --i, --src, --dst) {
-EOF
-        } else {
-            print <<EOF;
-    src = (const $srctype *) cvt->buf;
-    dst = ($tctype *) cvt->buf;
-    for (i = cvt->len_cvt / sizeof ($srctype); i; --i, ++src, ++dst) {
-EOF
-        }
-
-        # Have to convert to/from float/int.
-        # !!! FIXME: cast through double for int32<->float?
-        my $code = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, '*src');
-        if ($ffloat != $tfloat) {
-            if ($ffloat) {
-                my $mult = getFloatToIntMult($tsize);
-                if (!$tsigned) {   # bump from -1.0f/1.0f to 0.0f/2.0f
-                    $code = "($code + 1.0f)";
-                }
-                $code = "(($tctype) ($code * $mult))";
-            } else {
-                # $divby will be the reciprocal, to avoid pipeline stalls
-                #  from floating point division...so multiply it.
-                my $divby = getIntToFloatDivBy($fsize);
-                $code = "(((float) $code) * $divby)";
-                if (!$fsigned) {   # bump from 0.0f/2.0f to -1.0f/1.0f.
-                    $code = "($code - 1.0f)";
-                }
-            }
-        } else {
-            # All integer conversions here.
-            if ($fsigned != $tsigned) {
-                my $signflipval = getSignFlipVal($fsize);
-                $code = "(($code) ^ $signflipval)";
-            }
-
-            my $shiftval = abs($fsize - $tsize);
-            if ($fsize < $tsize) {
-                $code = "((($tctype) $code) << $shiftval)";
-            } elsif ($fsize > $tsize) {
-                $code = "(($tctype) ($code >> $shiftval))";
-            }
-        }
-
-        my $swap = getSwapFunc($tsize, $tsigned, $tfloat, $tendian, 'val');
-
-        print <<EOF;
-        const $tctype val = $code;
-        *dst = ${swap};
-    }
-
-EOF
-
-        if ($fsize > $tsize) {
-            my $divby = $fsize / $tsize;
-            print("    cvt->len_cvt /= $divby;\n");
-        } elsif ($fsize < $tsize) {
-            my $mult = $tsize / $fsize;
-            print("    cvt->len_cvt *= $mult;\n");
-        }
-
-        print <<EOF;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_$to);
-    }
-}
-
-EOF
-
-    } else {
-        if ($fsigned != $tsigned) {
-            $funcs{$hashid} = 'SDL_ConvertSigned';
-        } elsif ($ffloat != $tfloat) {
-            $funcs{$hashid} = 'SDL_ConvertFloat';
-        } elsif ($fsize != $tsize) {
-            $funcs{$hashid} = 'SDL_ConvertSize';
-        } elsif ($fendian ne $tendian) {
-            $funcs{$hashid} = 'SDL_ConvertEndian';
-        } else {
-            die("error in script.\n");
-        }
-    }
-}
-
-
-sub buildTypeConverters {
-    print "#if !NO_CONVERTERS\n\n";
-    foreach (@audiotypes) {
-        my $from = $_;
-        foreach (@audiotypes) {
-            my $to = $_;
-            buildCvtFunc($from, $to);
-        }
-    }
-    print "#endif  /* !NO_CONVERTERS */\n\n\n";
-
-    print "const SDL_AudioTypeFilters sdl_audio_type_filters[] =\n{\n";
-    print "#if !NO_CONVERTERS\n";
-    foreach (@audiotypes) {
-        my $from = $_;
-        foreach (@audiotypes) {
-            my $to = $_;
-            if ($from ne $to) {
-                my $hashid = getTypeConvertHashId($from, $to);
-                my $sym = $funcs{$hashid};
-                print("    { AUDIO_$from, AUDIO_$to, $sym },\n");
-            }
-        }
-    }
-    print "#endif  /* !NO_CONVERTERS */\n";
-
-    print("    { 0, 0, NULL }\n");
-    print "};\n\n\n";
-}
-
-sub getBiggerCtype {
-    my ($isfloat, $size) = @_;
-
-    if ($isfloat) {
-        if ($size == 32) {
-            return 'double';
-        }
-        die("bug in script.\n");
-    }
-
-    if ($size == 8) {
-        return 'Sint16';
-    } elsif ($size == 16) {
-        return 'Sint32'
-    } elsif ($size == 32) {
-        return 'Sint64'
-    }
-
-    die("bug in script.\n");
-}
-
-
-# These handle arbitrary resamples...44100Hz to 48000Hz, for example.
-# Man, this code is skanky.
-sub buildArbitraryResampleFunc {
-    # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc().
-    my ($from, $channels, $upsample) = @_;
-    my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from);
-
-    my $bigger = getBiggerCtype($ffloat, $fsize);
-    my $interp = ($ffloat) ? '* 0.5' : '>> 1';
-
-    my $resample = ($upsample) ? 'Upsample' : 'Downsample';
-    my $hashid = getResamplerHashId($from, $channels, $upsample, 0);
-    my $sym = "SDL_${resample}_${from}_${channels}c";
-    $funcs{$hashid} = $sym;
-    $custom_converters++;
-
-    my $fudge = $fsize * $channels * 2;  # !!! FIXME
-    my $eps_adjust = ($upsample) ? 'dstsize' : 'srcsize';
-    my $incr = '';
-    my $incr2 = '';
-    my $block_align = $channels * $fsize/8;
-
-
-    # !!! FIXME: DEBUG_CONVERT should report frequencies.
-    print <<EOF;
-static void SDLCALL
-${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "$resample arbitrary (x%f) AUDIO_${from}, ${channels} channels.\\n", cvt->rate_incr);
-#endif
-
-    const int srcsize = cvt->len_cvt - $fudge;
-    const int dstsize = (int) (((double)(cvt->len_cvt/${block_align})) * cvt->rate_incr) * ${block_align};
-    register int eps = 0;
-EOF
-
-    my $endcomparison = '!=';
-
-    # Upsampling (growing the buffer) needs to work backwards, since we
-    #  overwrite the buffer as we go.
-    if ($upsample) {
-        $endcomparison = '>=';  # dst > target
-        print <<EOF;
-    $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
-    const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
-    const $fctype *target = ((const $fctype *) cvt->buf);
-EOF
-    } else {
-        $endcomparison = '<';  # dst < target
-        print <<EOF;
-    $fctype *dst = ($fctype *) cvt->buf;
-    const $fctype *src = ($fctype *) cvt->buf;
-    const $fctype *target = (const $fctype *) (cvt->buf + dstsize);
-EOF
-    }
-
-    for (my $i = 0; $i < $channels; $i++) {
-        my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
-        my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]");
-        print <<EOF;
-    $fctype sample${idx} = $val;
-EOF
-    }
-
-    for (my $i = 0; $i < $channels; $i++) {
-        my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
-        print <<EOF;
-    $fctype last_sample${idx} = sample${idx};
-EOF
-    }
-
-    print <<EOF;
-    while (dst $endcomparison target) {
-EOF
-
-    if ($upsample) {
-        for (my $i = 0; $i < $channels; $i++) {
-            # !!! FIXME: don't do this swap every write, just when the samples change.
-            my $idx = (($channels - $i) - 1);
-            my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "sample${idx}");
-            print <<EOF;
-        dst[$idx] = $val;
-EOF
-        }
-
-        $incr = ($channels == 1) ? 'dst--' : "dst -= $channels";
-        $incr2 = ($channels == 1) ? 'src--' : "src -= $channels";
-
-        print <<EOF;
-        $incr;
-        eps += srcsize;
-        if ((eps << 1) >= dstsize) {
-            $incr2;
-EOF
-    } else {  # downsample.
-        $incr = ($channels == 1) ? 'src++' : "src += $channels";
-        print <<EOF;
-        $incr;
-        eps += dstsize;
-        if ((eps << 1) >= srcsize) {
-EOF
-        for (my $i = 0; $i < $channels; $i++) {
-            my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "sample${i}");
-            print <<EOF;
-            dst[$i] = $val;
-EOF
-        }
-
-        $incr = ($channels == 1) ? 'dst++' : "dst += $channels";
-        print <<EOF;
-            $incr;
-EOF
-    }
-
-    for (my $i = 0; $i < $channels; $i++) {
-        my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
-        my $swapped = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]");
-        print <<EOF;
-            sample${idx} = ($fctype) (((($bigger) $swapped) + (($bigger) last_sample${idx})) $interp);
-EOF
-    }
-
-    for (my $i = 0; $i < $channels; $i++) {
-        my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
-        print <<EOF;
-            last_sample${idx} = sample${idx};
-EOF
-    }
-
-    print <<EOF;
-            eps -= $eps_adjust;
-        }
-    }
-EOF
-
-        print <<EOF;
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-EOF
-
-}
-
-# These handle clean resamples...doubling and quadrupling the sample rate, etc.
-sub buildMultipleResampleFunc {
-    # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc().
-    my ($from, $channels, $upsample, $multiple) = @_;
-    my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from);
-
-    my $bigger = getBiggerCtype($ffloat, $fsize);
-    my $interp = ($ffloat) ? '* 0.5' : '>> 1';
-    my $interp2 = ($ffloat) ? '* 0.25' : '>> 2';
-    my $mult3 = ($ffloat) ? '3.0' : '3';
-    my $lencvtop = ($upsample) ? '*' : '/';
-
-    my $resample = ($upsample) ? 'Upsample' : 'Downsample';
-    my $hashid = getResamplerHashId($from, $channels, $upsample, $multiple);
-    my $sym = "SDL_${resample}_${from}_${channels}c_x${multiple}";
-    $funcs{$hashid} = $sym;
-    $custom_converters++;
-
-    # !!! FIXME: DEBUG_CONVERT should report frequencies.
-    print <<EOF;
-static void SDLCALL
-${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-#if DEBUG_CONVERT
-    fprintf(stderr, "$resample (x${multiple}) AUDIO_${from}, ${channels} channels.\\n");
-#endif
-
-    const int dstsize = cvt->len_cvt $lencvtop $multiple;
-EOF
-
-    my $endcomparison = '!=';
-
-    # Upsampling (growing the buffer) needs to work backwards, since we
-    #  overwrite the buffer as we go.
-    if ($upsample) {
-        $endcomparison = '>=';  # dst > target
-        print <<EOF;
-    $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels * $multiple;
-    const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
-    const $fctype *target = ((const $fctype *) cvt->buf);
-EOF
-    } else {
-        $endcomparison = '<';  # dst < target
-        print <<EOF;
-    $fctype *dst = ($fctype *) cvt->buf;
-    const $fctype *src = ($fctype *) cvt->buf;
-    const $fctype *target = (const $fctype *) (cvt->buf + dstsize);
-EOF
-    }
-
-    for (my $i = 0; $i < $channels; $i++) {
-        my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
-        my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]");
-        print <<EOF;
-    $bigger last_sample${idx} = ($bigger) $val;
-EOF
-    }
-
-    print <<EOF;
-    while (dst $endcomparison target) {
-EOF
-
-    for (my $i = 0; $i < $channels; $i++) {
-        my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
-        my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]");
-        print <<EOF;
-        const $bigger sample${idx} = ($bigger) $val;
-EOF
-    }
-
-    my $incr = '';
-    if ($upsample) {
-        $incr = ($channels == 1) ? 'src--' : "src -= $channels";
-    } else {
-        my $amount = $channels * $multiple;
-        $incr = "src += $amount";  # can't ever be 1, so no "++" version.
-    }
-
-
-    print <<EOF;
-        $incr;
-EOF
-
-    # !!! FIXME: This really begs for some Altivec or SSE, etc.
-    if ($upsample) {
-        if ($multiple == 2) {
-            for (my $i = $channels-1; $i >= 0; $i--) {
-                my $dsti = $i + $channels;
-                print <<EOF;
-        dst[$dsti] = ($fctype) ((sample${i} + last_sample${i}) $interp);
-EOF
-            }
-            for (my $i = $channels-1; $i >= 0; $i--) {
-                my $dsti = $i;
-                print <<EOF;
-        dst[$dsti] = ($fctype) sample${i};
-EOF
-            }
-        } elsif ($multiple == 4) {
-            for (my $i = $channels-1; $i >= 0; $i--) {
-                my $dsti = $i + ($channels * 3);
-                print <<EOF;
-        dst[$dsti] = ($fctype) ((sample${i} + ($mult3 * last_sample${i})) $interp2);
-EOF
-            }
-
-            for (my $i = $channels-1; $i >= 0; $i--) {
-                my $dsti = $i + ($channels * 2);
-                print <<EOF;
-        dst[$dsti] = ($fctype) ((sample${i} + last_sample${i}) $interp);
-EOF
-            }
-
-            for (my $i = $channels-1; $i >= 0; $i--) {
-                my $dsti = $i + ($channels * 1);
-                print <<EOF;
-        dst[$dsti] = ($fctype) ((($mult3 * sample${i}) + last_sample${i}) $interp2);
-EOF
-            }
-
-            for (my $i = $channels-1; $i >= 0; $i--) {
-                my $dsti = $i + ($channels * 0);
-                print <<EOF;
-        dst[$dsti] = ($fctype) sample${i};
-EOF
-            }
-        } else {
-            die('bug in program.');  # we only handle x2 and x4.
-        }
-    } else {  # downsample.
-        if ($multiple == 2) {
-            for (my $i = 0; $i < $channels; $i++) {
-                print <<EOF;
-        dst[$i] = ($fctype) ((sample${i} + last_sample${i}) $interp);
-EOF
-            }
-        } elsif ($multiple == 4) {
-            # !!! FIXME: interpolate all 4 samples?
-            for (my $i = 0; $i < $channels; $i++) {
-                print <<EOF;
-        dst[$i] = ($fctype) ((sample${i} + last_sample${i}) $interp);
-EOF
-            }
-        } else {
-            die('bug in program.');  # we only handle x2 and x4.
-        }
-    }
-
-    for (my $i = 0; $i < $channels; $i++) {
-        my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
-        print <<EOF;
-        last_sample${idx} = sample${idx};
-EOF
-    }
-
-    if ($upsample) {
-        my $amount = $channels * $multiple;
-        $incr = "dst -= $amount";  # can't ever be 1, so no "--" version.
-    } else {
-        $incr = ($channels == 1) ? 'dst++' : "dst += $channels";
-    }
-
-    print <<EOF;
-        $incr;
-    }
-
-    cvt->len_cvt = dstsize;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, format);
-    }
-}
-
-EOF
-
-}
-
-sub buildResamplers {
-    print "#if !NO_RESAMPLERS\n\n";
-    foreach (@audiotypes) {
-        my $from = $_;
-        foreach (@channels) {
-            my $channel = $_;
-            buildArbitraryResampleFunc($from, $channel, 1);
-            buildArbitraryResampleFunc($from, $channel, 0);
-        }
-    }
-
-    print "\n#if !LESS_RESAMPLERS\n\n";
-    foreach (@audiotypes) {
-        my $from = $_;
-        foreach (@channels) {
-            my $channel = $_;
-            for (my $multiple = 2; $multiple <= 4; $multiple += 2) {
-                buildMultipleResampleFunc($from, $channel, 1, $multiple);
-                buildMultipleResampleFunc($from, $channel, 0, $multiple);
-            }
-        }
-    }
-
-    print "#endif  /* !LESS_RESAMPLERS */\n";
-    print "#endif  /* !NO_RESAMPLERS */\n\n\n";
-
-    print "const SDL_AudioRateFilters sdl_audio_rate_filters[] =\n{\n";
-    print "#if !NO_RESAMPLERS\n";
-    foreach (@audiotypes) {
-        my $from = $_;
-        foreach (@channels) {
-            my $channel = $_;
-            for (my $upsample = 0; $upsample <= 1; $upsample++) {
-                my $hashid = getResamplerHashId($from, $channel, $upsample, 0);
-                my $sym = $funcs{$hashid};
-                print("    { AUDIO_$from, $channel, $upsample, 0, $sym },\n");
-            }
-        }
-    }
-
-    print "#if !LESS_RESAMPLERS\n";
-    foreach (@audiotypes) {
-        my $from = $_;
-        foreach (@channels) {
-            my $channel = $_;
-            for (my $multiple = 2; $multiple <= 4; $multiple += 2) {
-                for (my $upsample = 0; $upsample <= 1; $upsample++) {
-                    my $hashid = getResamplerHashId($from, $channel, $upsample, $multiple);
-                    my $sym = $funcs{$hashid};
-                    print("    { AUDIO_$from, $channel, $upsample, $multiple, $sym },\n");
-                }
-            }
-        }
-    }
-
-    print "#endif  /* !LESS_RESAMPLERS */\n";
-    print "#endif  /* !NO_RESAMPLERS */\n";
-    print("    { 0, 0, 0, 0, NULL }\n");
-    print "};\n\n";
-}
-
-
-# mainline ...
-
-outputHeader();
-buildTypeConverters();
-buildResamplers();
-outputFooter();
-
-exit 0;
-
-# end of sdlgenaudiocvt.pl ...
-