Browse Source

Update to SDL 2.0.7.
Added SDLHaptic, SDLSurface and SDLVideo modules.
Windows and Linux now build from source.

woollybah 7 years ago
parent
commit
764980f301
100 changed files with 4918 additions and 17671 deletions
  1. 1 1
      d3d9sdlmax2d.mod/d3d9sdlmax2d.bmx
  2. 1 1
      sdl.mod/SDL/COPYING.txt
  3. 3 3
      sdl.mod/SDL/README-SDL.txt
  4. 1 1
      sdl.mod/SDL/README.txt
  5. 16 15
      sdl.mod/SDL/include/SDL.h
  6. 11 9
      sdl.mod/SDL/include/SDL_assert.h
  7. 17 8
      sdl.mod/SDL/include/SDL_atomic.h
  8. 245 25
      sdl.mod/SDL/include/SDL_audio.h
  9. 20 5
      sdl.mod/SDL/include/SDL_bits.h
  10. 62 5
      sdl.mod/SDL/include/SDL_blendmode.h
  11. 4 4
      sdl.mod/SDL/include/SDL_clipboard.h
  12. 5 7
      sdl.mod/SDL/include/SDL_config.h
  13. 91 43
      sdl.mod/SDL/include/SDL_config.h.cmake
  14. 90 42
      sdl.mod/SDL/include/SDL_config.h.in
  15. 40 16
      sdl.mod/SDL/include/SDL_config_android.h
  16. 46 19
      sdl.mod/SDL/include/SDL_config_iphoneos.h
  17. 59 15
      sdl.mod/SDL/include/SDL_config_macosx.h
  18. 5 4
      sdl.mod/SDL/include/SDL_config_minimal.h
  19. 19 17
      sdl.mod/SDL/include/SDL_config_pandora.h
  20. 27 13
      sdl.mod/SDL/include/SDL_config_psp.h
  21. 55 30
      sdl.mod/SDL/include/SDL_config_windows.h
  22. 70 36
      sdl.mod/SDL/include/SDL_config_winrt.h
  23. 50 31
      sdl.mod/SDL/include/SDL_config_wiz.h
  24. 1 1
      sdl.mod/SDL/include/SDL_copying.h
  25. 31 11
      sdl.mod/SDL/include/SDL_cpuinfo.h
  26. 3 3
      sdl.mod/SDL/include/SDL_egl.h
  27. 25 4
      sdl.mod/SDL/include/SDL_endian.h
  28. 4 4
      sdl.mod/SDL/include/SDL_error.h
  29. 37 33
      sdl.mod/SDL/include/SDL_events.h
  30. 4 4
      sdl.mod/SDL/include/SDL_filesystem.h
  31. 60 16
      sdl.mod/SDL/include/SDL_gamecontroller.h
  32. 4 4
      sdl.mod/SDL/include/SDL_gesture.h
  33. 40 36
      sdl.mod/SDL/include/SDL_haptic.h
  34. 304 25
      sdl.mod/SDL/include/SDL_hints.h
  35. 127 14
      sdl.mod/SDL/include/SDL_joystick.h
  36. 5 5
      sdl.mod/SDL/include/SDL_keyboard.h
  37. 13 5
      sdl.mod/SDL/include/SDL_keycode.h
  38. 4 4
      sdl.mod/SDL/include/SDL_loadso.h
  39. 5 5
      sdl.mod/SDL/include/SDL_log.h
  40. 13 6
      sdl.mod/SDL/include/SDL_main.h
  41. 4 4
      sdl.mod/SDL/include/SDL_messagebox.h
  42. 9 7
      sdl.mod/SDL/include/SDL_mouse.h
  43. 4 4
      sdl.mod/SDL/include/SDL_mutex.h
  44. 4 4
      sdl.mod/SDL/include/SDL_name.h
  45. 11 4
      sdl.mod/SDL/include/SDL_opengl.h
  46. 2 1
      sdl.mod/SDL/include/SDL_opengles.h
  47. 3 1
      sdl.mod/SDL/include/SDL_opengles2.h
  48. 21 5
      sdl.mod/SDL/include/SDL_pixels.h
  49. 37 20
      sdl.mod/SDL/include/SDL_platform.h
  50. 4 4
      sdl.mod/SDL/include/SDL_power.h
  51. 4 4
      sdl.mod/SDL/include/SDL_quit.h
  52. 4 4
      sdl.mod/SDL/include/SDL_rect.h
  53. 59 8
      sdl.mod/SDL/include/SDL_render.h
  54. 33 10
      sdl.mod/SDL/include/SDL_rwops.h
  55. 17 5
      sdl.mod/SDL/include/SDL_scancode.h
  56. 9 8
      sdl.mod/SDL/include/SDL_shape.h
  57. 89 13
      sdl.mod/SDL/include/SDL_stdinc.h
  58. 49 6
      sdl.mod/SDL/include/SDL_surface.h
  59. 35 9
      sdl.mod/SDL/include/SDL_system.h
  60. 37 14
      sdl.mod/SDL/include/SDL_syswm.h
  61. 11 10
      sdl.mod/SDL/include/SDL_test.h
  62. 7 7
      sdl.mod/SDL/include/SDL_test_assert.h
  63. 4 4
      sdl.mod/SDL/include/SDL_test_common.h
  64. 4 4
      sdl.mod/SDL/include/SDL_test_compare.h
  65. 5 5
      sdl.mod/SDL/include/SDL_test_crc32.h
  66. 11 6
      sdl.mod/SDL/include/SDL_test_font.h
  67. 18 18
      sdl.mod/SDL/include/SDL_test_fuzzer.h
  68. 15 4
      sdl.mod/SDL/include/SDL_test_harness.h
  69. 15 15
      sdl.mod/SDL/include/SDL_test_images.h
  70. 4 4
      sdl.mod/SDL/include/SDL_test_log.h
  71. 4 4
      sdl.mod/SDL/include/SDL_test_md5.h
  72. 63 0
      sdl.mod/SDL/include/SDL_test_memory.h
  73. 4 4
      sdl.mod/SDL/include/SDL_test_random.h
  74. 37 16
      sdl.mod/SDL/include/SDL_thread.h
  75. 4 4
      sdl.mod/SDL/include/SDL_timer.h
  76. 4 4
      sdl.mod/SDL/include/SDL_touch.h
  77. 1 1
      sdl.mod/SDL/include/SDL_types.h
  78. 5 5
      sdl.mod/SDL/include/SDL_version.h
  79. 203 36
      sdl.mod/SDL/include/SDL_video.h
  80. 257 0
      sdl.mod/SDL/include/SDL_vulkan.h
  81. 23 2
      sdl.mod/SDL/include/begin_code.h
  82. 2 2
      sdl.mod/SDL/include/close_code.h
  83. 16 17
      sdl.mod/SDL/src/SDL.c
  84. 71 14
      sdl.mod/SDL/src/SDL_assert.c
  85. 1 1
      sdl.mod/SDL/src/SDL_assert_c.h
  86. 339 0
      sdl.mod/SDL/src/SDL_dataqueue.c
  87. 55 0
      sdl.mod/SDL/src/SDL_dataqueue.h
  88. 77 59
      sdl.mod/SDL/src/SDL_error.c
  89. 4 4
      sdl.mod/SDL/src/SDL_error_c.h
  90. 14 1
      sdl.mod/SDL/src/SDL_hints.c
  91. 18 4
      sdl.mod/SDL/src/SDL_internal.h
  92. 23 13
      sdl.mod/SDL/src/SDL_log.c
  93. 79 22
      sdl.mod/SDL/src/atomic/SDL_atomic.c
  94. 18 1
      sdl.mod/SDL/src/atomic/SDL_spinlock.c
  95. 480 301
      sdl.mod/SDL/src/audio/SDL_audio.c
  96. 47 23
      sdl.mod/SDL/src/audio/SDL_audio_c.h
  97. 422 696
      sdl.mod/SDL/src/audio/SDL_audiocvt.c
  98. 4 3
      sdl.mod/SDL/src/audio/SDL_audiodev.c
  99. 1 1
      sdl.mod/SDL/src/audio/SDL_audiodev_c.h
  100. 495 15691
      sdl.mod/SDL/src/audio/SDL_audiotypecvt.c

+ 1 - 1
d3d9sdlmax2d.mod/d3d9sdlmax2d.bmx

@@ -132,7 +132,7 @@ Type TD3D9ImageFrame Extends TImageFrame
 			For Local y=0 Until pixmap.height
 				Local src:Byte Ptr=pixmap.pixels+y*pixmap.pitch
 				Local dst:Byte Ptr=lockedrect.pBits+y*lockedrect.Pitch
-				MemCopy dst,src,pixmap.width*4
+				MemCopy dst,src,Size_T(pixmap.width*4)
 			Next
 		
 			dstsurf.UnlockRect

+ 1 - 1
sdl.mod/SDL/COPYING.txt

@@ -1,6 +1,6 @@
 
 Simple DirectMedia Layer
-Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
   
 This software is provided 'as-is', without any express or implied
 warranty.  In no event will the authors be held liable for any damages

+ 3 - 3
sdl.mod/SDL/README-SDL.txt

@@ -2,11 +2,11 @@
 Please distribute this file with the SDL runtime environment:
 
 The Simple DirectMedia Layer (SDL for short) is a cross-platform library
-designed to make it easy to write multi-media software, such as games and
-emulators.
+designed to make it easy to write multi-media software, such as games
+and emulators.
 
 The Simple DirectMedia Layer library source code is available from:
-http://www.libsdl.org/
+https://www.libsdl.org/
 
 This library is distributed under the terms of the zlib license:
 http://www.zlib.net/zlib_license.html

+ 1 - 1
sdl.mod/SDL/README.txt

@@ -6,7 +6,7 @@
                                 Version 2.0
 
 ---
-http://www.libsdl.org/
+https://www.libsdl.org/
 
 Simple DirectMedia Layer is a cross-platform development library designed
 to provide low level access to audio, keyboard, mouse, joystick, and graphics

+ 16 - 15
sdl.mod/SDL/include/SDL.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -26,8 +26,8 @@
  */
 
 
-#ifndef _SDL_H
-#define _SDL_H
+#ifndef SDL_h_
+#define SDL_h_
 
 #include "SDL_main.h"
 #include "SDL_stdinc.h"
@@ -40,10 +40,10 @@
 #include "SDL_error.h"
 #include "SDL_events.h"
 #include "SDL_filesystem.h"
-#include "SDL_joystick.h"
 #include "SDL_gamecontroller.h"
 #include "SDL_haptic.h"
 #include "SDL_hints.h"
+#include "SDL_joystick.h"
 #include "SDL_loadso.h"
 #include "SDL_log.h"
 #include "SDL_messagebox.h"
@@ -51,6 +51,7 @@
 #include "SDL_power.h"
 #include "SDL_render.h"
 #include "SDL_rwops.h"
+#include "SDL_shape.h"
 #include "SDL_system.h"
 #include "SDL_thread.h"
 #include "SDL_timer.h"
@@ -72,14 +73,14 @@ extern "C" {
  *  specify the subsystems which you will be using in your application.
  */
 /* @{ */
-#define SDL_INIT_TIMER          0x00000001
-#define SDL_INIT_AUDIO          0x00000010
-#define SDL_INIT_VIDEO          0x00000020  /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
-#define SDL_INIT_JOYSTICK       0x00000200  /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
-#define SDL_INIT_HAPTIC         0x00001000
-#define SDL_INIT_GAMECONTROLLER 0x00002000  /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
-#define SDL_INIT_EVENTS         0x00004000
-#define SDL_INIT_NOPARACHUTE    0x00100000  /**< compatibility; this flag is ignored. */
+#define SDL_INIT_TIMER          0x00000001u
+#define SDL_INIT_AUDIO          0x00000010u
+#define SDL_INIT_VIDEO          0x00000020u  /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
+#define SDL_INIT_JOYSTICK       0x00000200u  /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
+#define SDL_INIT_HAPTIC         0x00001000u
+#define SDL_INIT_GAMECONTROLLER 0x00002000u  /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
+#define SDL_INIT_EVENTS         0x00004000u
+#define SDL_INIT_NOPARACHUTE    0x00100000u  /**< compatibility; this flag is ignored. */
 #define SDL_INIT_EVERYTHING ( \
                 SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
                 SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
@@ -95,8 +96,8 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
  *  This function initializes specific SDL subsystems
  *
  *  Subsystem initialization is ref-counted, you must call
- *  SDL_QuitSubSystem for each SDL_InitSubSystem to correctly
- *  shutdown a subsystem manually (or call SDL_Quit to force shutdown).
+ *  SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly
+ *  shutdown a subsystem manually (or call SDL_Quit() to force shutdown).
  *  If a subsystem is already loaded then this call will
  *  increase the ref-count and return.
  */
@@ -127,6 +128,6 @@ extern DECLSPEC void SDLCALL SDL_Quit(void);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_H */
+#endif /* SDL_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 9
sdl.mod/SDL/include/SDL_assert.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_assert_h
-#define _SDL_assert_h
+#ifndef SDL_assert_h_
+#define SDL_assert_h_
 
 #include "SDL_config.h"
 
@@ -51,9 +51,11 @@ assert can have unique static variables associated with it.
 /* Don't include intrin.h here because it contains C++ code */
     extern void __cdecl __debugbreak(void);
     #define SDL_TriggerBreakpoint() __debugbreak()
-#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
+#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
     #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
-#elif defined(HAVE_SIGNAL_H)
+#elif defined(__386__) && defined(__WATCOMC__)
+    #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
+#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
     #include <signal.h>
     #define SDL_TriggerBreakpoint() raise(SIGTRAP)
 #else
@@ -63,7 +65,7 @@ assert can have unique static variables associated with it.
 
 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
 #   define SDL_FUNCTION __func__
-#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
 #   define SDL_FUNCTION __FUNCTION__
 #else
 #   define SDL_FUNCTION "???"
@@ -201,7 +203,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
  *
  *  This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
  *
- *  \return SDL_AssertState value of how to handle the assertion failure.
+ *  Return SDL_AssertState value of how to handle the assertion failure.
  *
  *  \param handler Callback function, called when an assertion fails.
  *  \param userdata A pointer passed to the callback as-is.
@@ -250,7 +252,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse
  *  <code>
  *  const SDL_AssertData *item = SDL_GetAssertionReport();
  *  while (item) {
- *      printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
+ *      printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
  *             item->condition, item->function, item->filename,
  *             item->linenum, item->trigger_count,
  *             item->always_ignore ? "yes" : "no");
@@ -284,6 +286,6 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_assert_h */
+#endif /* SDL_assert_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 17 - 8
sdl.mod/SDL/include/SDL_atomic.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -56,8 +56,8 @@
  * All of the atomic operations that modify memory are full memory barriers.
  */
 
-#ifndef _SDL_atomic_h_
-#define _SDL_atomic_h_
+#ifndef SDL_atomic_h_
+#define SDL_atomic_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_platform.h"
@@ -118,13 +118,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
  * The compiler barrier prevents the compiler from reordering
  * reads and writes to globally visible variables across the call.
  */
-#if defined(_MSC_VER) && (_MSC_VER > 1200)
+#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
 void _ReadWriteBarrier(void);
 #pragma intrinsic(_ReadWriteBarrier)
 #define SDL_CompilerBarrier()   _ReadWriteBarrier()
 #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
 /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
 #define SDL_CompilerBarrier()   __asm__ __volatile__ ("" : : : "memory")
+#elif defined(__WATCOMC__)
+extern _inline void SDL_CompilerBarrier (void);
+#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
 #else
 #define SDL_CompilerBarrier()   \
 { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
@@ -149,18 +152,24 @@ void _ReadWriteBarrier(void);
  * For more information on these semantics, take a look at the blog post:
  * http://preshing.com/20120913/acquire-and-release-semantics
  */
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
+
 #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("lwsync" : : : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("lwsync" : : : "memory")
+#elif defined(__GNUC__) && defined(__aarch64__)
+#define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 #elif defined(__GNUC__) && defined(__arm__)
 #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("dmb ish" : : : "memory")
-#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
+#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
 #ifdef __thumb__
 /* The mcr instruction isn't available in thumb mode, use real functions */
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
+#define SDL_MemoryBarrierRelease()   SDL_MemoryBarrierReleaseFunction()
+#define SDL_MemoryBarrierAcquire()   SDL_MemoryBarrierAcquireFunction()
 #else
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
@@ -263,6 +272,6 @@ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
 
 #include "close_code.h"
 
-#endif /* _SDL_atomic_h_ */
+#endif /* SDL_atomic_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 245 - 25
sdl.mod/SDL/include/SDL_audio.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Access to the raw audio mixing buffer for the SDL library.
  */
 
-#ifndef _SDL_audio_h
-#define _SDL_audio_h
+#ifndef SDL_audio_h_
+#define SDL_audio_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -164,6 +164,15 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
 
 /**
  *  The calculated values in this structure are calculated by SDL_OpenAudio().
+ *
+ *  For multi-channel audio, the default SDL channel mapping is:
+ *  2:  FL FR                       (stereo)
+ *  3:  FL FR LFE                   (2.1 surround)
+ *  4:  FL FR BL BR                 (quad)
+ *  5:  FL FR FC BL BR              (quad + center)
+ *  6:  FL FR FC LFE SL SR          (5.1 surround - last two can also be BL BR)
+ *  7:  FL FR FC LFE BC SL SR       (6.1 surround)
+ *  8:  FL FR FC LFE BL BR SL SR    (7.1 surround)
  */
 typedef struct SDL_AudioSpec
 {
@@ -171,7 +180,7 @@ typedef struct SDL_AudioSpec
     SDL_AudioFormat format;     /**< Audio data format */
     Uint8 channels;             /**< Number of channels: 1 mono, 2 stereo */
     Uint8 silence;              /**< Audio buffer silence value (calculated) */
-    Uint16 samples;             /**< Audio buffer size in samples (power of 2) */
+    Uint16 samples;             /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
     Uint16 padding;             /**< Necessary for some compile environments */
     Uint32 size;                /**< Audio buffer size in bytes (calculated) */
     SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
@@ -184,7 +193,23 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
                                           SDL_AudioFormat format);
 
 /**
- *  A structure to hold a set of audio conversion filters and buffers.
+ *  \brief Upper limit of filters in SDL_AudioCVT
+ *
+ *  The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
+ *  currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
+ *  one of which is the terminating NULL pointer.
+ */
+#define SDL_AUDIOCVT_MAX_FILTERS 9
+
+/**
+ *  \struct SDL_AudioCVT
+ *  \brief A structure to hold a set of audio conversion filters and buffers.
+ *
+ *  Note that various parts of the conversion pipeline can take advantage
+ *  of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
+ *  you to pass it aligned data, but can possibly run much faster if you
+ *  set both its (buf) field to a pointer that is aligned to 16 bytes, and its
+ *  (len) field to something that's a multiple of 16, if possible.
  */
 #ifdef __GNUC__
 /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
@@ -208,7 +233,7 @@ typedef struct SDL_AudioCVT
     int len_cvt;                /**< Length of converted audio buffer */
     int len_mult;               /**< buffer must be len*len_mult big */
     double len_ratio;           /**< Given len, final size is len*len_ratio */
-    SDL_AudioFilter filters[10];        /**< Filter list */
+    SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
     int filter_index;           /**< Current audio conversion function */
 } SDL_AUDIOCVT_PACKED SDL_AudioCVT;
 
@@ -278,7 +303,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
  *      protect data structures that it accesses by calling SDL_LockAudio()
  *      and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL
  *      pointer here, and call SDL_QueueAudio() with some frequency, to queue
- *      more audio samples to be played.
+ *      more audio samples to be played (or for capture devices, call
+ *      SDL_DequeueAudio() with some frequency, to obtain audio samples).
  *    - \c desired->userdata is passed as the first parameter to your callback
  *      function. If you passed a NULL callback, this value is ignored.
  *
@@ -433,10 +459,10 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
  *  This function takes a source format and rate and a destination format
  *  and rate, and initializes the \c cvt structure with information needed
  *  by SDL_ConvertAudio() to convert a buffer of audio data from one format
- *  to the other.
+ *  to the other. An unsupported format causes an error and -1 will be returned.
  *
- *  \return -1 if the format conversion is not supported, 0 if there's
- *  no conversion needed, or 1 if the audio filter is set up.
+ *  \return 0 if no conversion is needed, 1 if the audio filter is set up,
+ *  or -1 on error.
  */
 extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
                                               SDL_AudioFormat src_format,
@@ -455,9 +481,137 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
  *  The data conversion may expand the size of the audio data, so the buffer
  *  \c cvt->buf should be allocated after the \c cvt structure is initialized by
  *  SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
+ *
+ *  \return 0 on success or -1 if \c cvt->buf is NULL.
  */
 extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
 
+/* SDL_AudioStream is a new audio conversion interface.
+   The benefits vs SDL_AudioCVT:
+    - it can handle resampling data in chunks without generating
+      artifacts, when it doesn't have the complete buffer available.
+    - it can handle incoming data in any variable size.
+    - You push data as you have it, and pull it when you need it
+ */
+/* this is opaque to the outside world. */
+struct _SDL_AudioStream;
+typedef struct _SDL_AudioStream SDL_AudioStream;
+
+/**
+ *  Create a new audio stream
+ *
+ *  \param src_format The format of the source audio
+ *  \param src_channels The number of channels of the source audio
+ *  \param src_rate The sampling rate of the source audio
+ *  \param dst_format The format of the desired audio output
+ *  \param dst_channels The number of channels of the desired audio output
+ *  \param dst_rate The sampling rate of the desired audio output
+ *  \return 0 on success, or -1 on error.
+ *
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
+                                           const Uint8 src_channels,
+                                           const int src_rate,
+                                           const SDL_AudioFormat dst_format,
+                                           const Uint8 dst_channels,
+                                           const int dst_rate);
+
+/**
+ *  Add data to be converted/resampled to the stream
+ *
+ *  \param stream The stream the audio data is being added to
+ *  \param buf A pointer to the audio data to add
+ *  \param len The number of bytes to write to the stream
+ *  \return 0 on success, or -1 on error.
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
+
+/**
+ *  Get converted/resampled data from the stream
+ *
+ *  \param stream The stream the audio is being requested from
+ *  \param buf A buffer to fill with audio data
+ *  \param len The maximum number of bytes to fill
+ *  \return The number of bytes read from the stream, or -1 on error
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
+
+/**
+ * Get the number of converted/resampled bytes available. The stream may be
+ *  buffering data behind the scenes until it has enough to resample
+ *  correctly, so this number might be lower than what you expect, or even
+ *  be zero. Add more data or flush the stream if you need the data now.
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
+
+/**
+ * Tell the stream that you're done sending data, and anything being buffered
+ *  should be converted/resampled and made available immediately.
+ *
+ * It is legal to add more data to a stream after flushing, but there will
+ *  be audio gaps in the output. Generally this is intended to signal the
+ *  end of input, so the complete output becomes available.
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
+
+/**
+ *  Clear any pending data in the stream without converting it
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
+
+/**
+ * Free an audio stream
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ */
+extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
+
 #define SDL_MIX_MAXVOLUME 128
 /**
  *  This takes two audio buffers of the playing audio format and mixes
@@ -482,6 +636,10 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
 /**
  *  Queue more audio on non-callback devices.
  *
+ *  (If you are looking to retrieve queued audio from a non-callback capture
+ *  device, you want SDL_DequeueAudio() instead. This will return -1 to
+ *  signify an error if you use it with capture devices.)
+ *
  *  SDL offers two ways to feed audio to the device: you can either supply a
  *  callback that SDL triggers with some frequency to obtain more audio
  *  (pull method), or you can supply no callback, and then SDL will expect
@@ -509,28 +667,83 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
  *  \param dev The device ID to which we will queue audio.
  *  \param data The data to queue to the device for later playback.
  *  \param len The number of bytes (not samples!) to which (data) points.
- *  \return zero on success, -1 on error.
+ *  \return 0 on success, or -1 on error.
  *
  *  \sa SDL_GetQueuedAudioSize
  *  \sa SDL_ClearQueuedAudio
  */
 extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len);
 
+/**
+ *  Dequeue more audio on non-callback devices.
+ *
+ *  (If you are looking to queue audio for output on a non-callback playback
+ *  device, you want SDL_QueueAudio() instead. This will always return 0
+ *  if you use it with playback devices.)
+ *
+ *  SDL offers two ways to retrieve audio from a capture device: you can
+ *  either supply a callback that SDL triggers with some frequency as the
+ *  device records more audio data, (push method), or you can supply no
+ *  callback, and then SDL will expect you to retrieve data at regular
+ *  intervals (pull method) with this function.
+ *
+ *  There are no limits on the amount of data you can queue, short of
+ *  exhaustion of address space. Data from the device will keep queuing as
+ *  necessary without further intervention from you. This means you will
+ *  eventually run out of memory if you aren't routinely dequeueing data.
+ *
+ *  Capture devices will not queue data when paused; if you are expecting
+ *  to not need captured audio for some length of time, use
+ *  SDL_PauseAudioDevice() to stop the capture device from queueing more
+ *  data. This can be useful during, say, level loading times. When
+ *  unpaused, capture devices will start queueing data from that point,
+ *  having flushed any capturable data available while paused.
+ *
+ *  This function is thread-safe, but dequeueing from the same device from
+ *  two threads at once does not promise which thread will dequeued data
+ *  first.
+ *
+ *  You may not dequeue audio from a device that is using an
+ *  application-supplied callback; doing so returns an error. You have to use
+ *  the audio callback, or dequeue audio with this function, but not both.
+ *
+ *  You should not call SDL_LockAudio() on the device before queueing; SDL
+ *  handles locking internally for this function.
+ *
+ *  \param dev The device ID from which we will dequeue audio.
+ *  \param data A pointer into where audio data should be copied.
+ *  \param len The number of bytes (not samples!) to which (data) points.
+ *  \return number of bytes dequeued, which could be less than requested.
+ *
+ *  \sa SDL_GetQueuedAudioSize
+ *  \sa SDL_ClearQueuedAudio
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len);
+
 /**
  *  Get the number of bytes of still-queued audio.
  *
- *  This is the number of bytes that have been queued for playback with
- *  SDL_QueueAudio(), but have not yet been sent to the hardware.
+ *  For playback device:
+ *
+ *    This is the number of bytes that have been queued for playback with
+ *    SDL_QueueAudio(), but have not yet been sent to the hardware. This
+ *    number may shrink at any time, so this only informs of pending data.
+ *
+ *    Once we've sent it to the hardware, this function can not decide the
+ *    exact byte boundary of what has been played. It's possible that we just
+ *    gave the hardware several kilobytes right before you called this
+ *    function, but it hasn't played any of it yet, or maybe half of it, etc.
+ *
+ *  For capture devices:
  *
- *  Once we've sent it to the hardware, this function can not decide the exact
- *  byte boundary of what has been played. It's possible that we just gave the
- *  hardware several kilobytes right before you called this function, but it
- *  hasn't played any of it yet, or maybe half of it, etc.
+ *    This is the number of bytes that have been captured by the device and
+ *    are waiting for you to dequeue. This number may grow at any time, so
+ *    this only informs of the lower-bound of available data.
  *
  *  You may not queue audio on a device that is using an application-supplied
  *  callback; calling this function on such a device always returns 0.
- *  You have to use the audio callback or queue audio with SDL_QueueAudio(),
- *  but not both.
+ *  You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
+ *  the audio callback, but not both.
  *
  *  You should not call SDL_LockAudio() on the device before querying; SDL
  *  handles locking internally for this function.
@@ -544,10 +757,17 @@ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *da
 extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
 
 /**
- *  Drop any queued audio data waiting to be sent to the hardware.
+ *  Drop any queued audio data. For playback devices, this is any queued data
+ *  still waiting to be submitted to the hardware. For capture devices, this
+ *  is any data that was queued by the device that hasn't yet been dequeued by
+ *  the application.
  *
- *  Immediately after this call, SDL_GetQueuedAudioSize() will return 0 and
- *  the hardware will start playing silence if more audio isn't queued.
+ *  Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For
+ *  playback devices, the hardware will start playing silence if more audio
+ *  isn't queued. Unpaused capture devices will start filling the queue again
+ *  as soon as they have more data available (which, depending on the state
+ *  of the hardware and the thread, could be before this function call
+ *  returns!).
  *
  *  This will not prevent playback of queued audio that's already been sent
  *  to the hardware, as we can not undo that, so expect there to be some
@@ -557,8 +777,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
  *
  *  You may not queue audio on a device that is using an application-supplied
  *  callback; calling this function on such a device is always a no-op.
- *  You have to use the audio callback or queue audio with SDL_QueueAudio(),
- *  but not both.
+ *  You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
+ *  the audio callback, but not both.
  *
  *  You should not call SDL_LockAudio() on the device before clearing the
  *  queue; SDL handles locking internally for this function.
@@ -600,6 +820,6 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_audio_h */
+#endif /* SDL_audio_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 20 - 5
sdl.mod/SDL/include/SDL_bits.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Functions for fiddling with bits and bitmasks.
  */
 
-#ifndef _SDL_bits_h
-#define _SDL_bits_h
+#ifndef SDL_bits_h_
+#define SDL_bits_h_
 
 #include "SDL_stdinc.h"
 
@@ -47,10 +47,20 @@ extern "C" {
  *
  *  \return Index of the most significant bit, or -1 if the value is 0.
  */
+#if defined(__WATCOMC__) && defined(__386__)
+extern _inline int _SDL_clz_watcom (Uint32);
+#pragma aux _SDL_clz_watcom = \
+    "bsr eax, eax" \
+    "xor eax, 31" \
+    parm [eax] nomemory \
+    value [eax] \
+    modify exact [eax] nomemory;
+#endif
+
 SDL_FORCE_INLINE int
 SDL_MostSignificantBitIndex32(Uint32 x)
 {
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
     /* Count Leading Zeroes builtin in GCC.
      * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
      */
@@ -58,6 +68,11 @@ SDL_MostSignificantBitIndex32(Uint32 x)
         return -1;
     }
     return 31 - __builtin_clz(x);
+#elif defined(__WATCOMC__) && defined(__386__)
+    if (x == 0) {
+        return -1;
+    }
+    return 31 - _SDL_clz_watcom(x);
 #else
     /* Based off of Bit Twiddling Hacks by Sean Eron Anderson
      * <[email protected]>, released in the public domain.
@@ -92,6 +107,6 @@ SDL_MostSignificantBitIndex32(Uint32 x)
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_bits_h */
+#endif /* SDL_bits_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 62 - 5
sdl.mod/SDL/include/SDL_blendmode.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header file declaring the SDL_BlendMode enumeration
  */
 
-#ifndef _SDL_blendmode_h
-#define _SDL_blendmode_h
+#ifndef SDL_blendmode_h_
+#define SDL_blendmode_h_
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -47,17 +47,74 @@ typedef enum
     SDL_BLENDMODE_ADD = 0x00000002,      /**< additive blending
                                               dstRGB = (srcRGB * srcA) + dstRGB
                                               dstA = dstA */
-    SDL_BLENDMODE_MOD = 0x00000004       /**< color modulate
+    SDL_BLENDMODE_MOD = 0x00000004,      /**< color modulate
                                               dstRGB = srcRGB * dstRGB
                                               dstA = dstA */
+    SDL_BLENDMODE_INVALID = 0x7FFFFFFF
+
+    /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
+
 } SDL_BlendMode;
 
+/**
+ *  \brief The blend operation used when combining source and destination pixel components
+ */
+typedef enum
+{
+    SDL_BLENDOPERATION_ADD              = 0x1,  /**< dst + src: supported by all renderers */
+    SDL_BLENDOPERATION_SUBTRACT         = 0x2,  /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
+    SDL_BLENDOPERATION_REV_SUBTRACT     = 0x3,  /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
+    SDL_BLENDOPERATION_MINIMUM          = 0x4,  /**< min(dst, src) : supported by D3D11 */
+    SDL_BLENDOPERATION_MAXIMUM          = 0x5   /**< max(dst, src) : supported by D3D11 */
+
+} SDL_BlendOperation;
+
+/**
+ *  \brief The normalized factor used to multiply pixel components
+ */
+typedef enum
+{
+    SDL_BLENDFACTOR_ZERO                = 0x1,  /**< 0, 0, 0, 0 */
+    SDL_BLENDFACTOR_ONE                 = 0x2,  /**< 1, 1, 1, 1 */
+    SDL_BLENDFACTOR_SRC_COLOR           = 0x3,  /**< srcR, srcG, srcB, srcA */
+    SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4,  /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
+    SDL_BLENDFACTOR_SRC_ALPHA           = 0x5,  /**< srcA, srcA, srcA, srcA */
+    SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6,  /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
+    SDL_BLENDFACTOR_DST_COLOR           = 0x7,  /**< dstR, dstG, dstB, dstA */
+    SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8,  /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
+    SDL_BLENDFACTOR_DST_ALPHA           = 0x9,  /**< dstA, dstA, dstA, dstA */
+    SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA   /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
+
+} SDL_BlendFactor;
+
+/**
+ *  \brief Create a custom blend mode, which may or may not be supported by a given renderer
+ *
+ *  \param srcColorFactor
+ *  \param dstColorFactor
+ *  \param colorOperation
+ *  \param srcAlphaFactor
+ *  \param dstAlphaFactor
+ *  \param alphaOperation
+ *
+ *  The result of the blend mode operation will be:
+ *      dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
+ *  and
+ *      dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
+ */
+extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
+                                                                 SDL_BlendFactor dstColorFactor,
+                                                                 SDL_BlendOperation colorOperation,
+                                                                 SDL_BlendFactor srcAlphaFactor,
+                                                                 SDL_BlendFactor dstAlphaFactor,
+                                                                 SDL_BlendOperation alphaOperation);
+
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 }
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_blendmode_h */
+#endif /* SDL_blendmode_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_clipboard.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  * Include file for SDL clipboard handling
  */
 
-#ifndef _SDL_clipboard_h
-#define _SDL_clipboard_h
+#ifndef SDL_clipboard_h_
+#define SDL_clipboard_h_
 
 #include "SDL_stdinc.h"
 
@@ -66,6 +66,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_clipboard_h */
+#endif /* SDL_clipboard_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 5 - 7
sdl.mod/SDL/include/SDL_config.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_h_
+#define SDL_config_h_
 
 #include "SDL_platform.h"
 
@@ -29,9 +29,7 @@
  */
 
 /* Add any platform that doesn't build using the configure system. */
-#ifdef USING_PREMAKE_CONFIG_H
-#include "SDL_config_premake.h"
-#elif defined(__WIN32__)
+#if defined(__WIN32__)
 #include "SDL_config_windows.h"
 #elif defined(__WINRT__)
 #include "SDL_config_winrt.h"
@@ -52,4 +50,4 @@
 #error Wrong SDL_config.h, check your include path?
 #endif
 
-#endif /* _SDL_config_h */
+#endif /* SDL_config_h_ */

+ 91 - 43
sdl.mod/SDL/include/SDL_config.h.cmake

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_h_
+#define SDL_config_h_
 
 /**
  *  \file SDL_config.h.in
@@ -47,40 +47,32 @@
 #cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@
 #cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@
 
-#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
-#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
-#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
-#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
-#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
-#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@
-#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
-#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
-
 /* Comment this if you want to build without any C library requirements */
 #cmakedefine HAVE_LIBC 1
 #if HAVE_LIBC
 
 /* Useful headers */
-#cmakedefine HAVE_ALLOCA_H 1
-#cmakedefine HAVE_SYS_TYPES_H 1
-#cmakedefine HAVE_STDIO_H 1
 #cmakedefine STDC_HEADERS 1
-#cmakedefine HAVE_STDLIB_H 1
-#cmakedefine HAVE_STDARG_H 1
-#cmakedefine HAVE_MALLOC_H 1
-#cmakedefine HAVE_MEMORY_H 1
-#cmakedefine HAVE_STRING_H 1
-#cmakedefine HAVE_STRINGS_H 1
-#cmakedefine HAVE_INTTYPES_H 1
-#cmakedefine HAVE_STDINT_H 1
+#cmakedefine HAVE_ALLOCA_H 1
 #cmakedefine HAVE_CTYPE_H 1
-#cmakedefine HAVE_MATH_H 1
+#cmakedefine HAVE_FLOAT_H 1
 #cmakedefine HAVE_ICONV_H 1
+#cmakedefine HAVE_INTTYPES_H 1
+#cmakedefine HAVE_LIMITS_H 1
+#cmakedefine HAVE_MALLOC_H 1
+#cmakedefine HAVE_MATH_H 1
+#cmakedefine HAVE_MEMORY_H 1
 #cmakedefine HAVE_SIGNAL_H 1
-#cmakedefine HAVE_ALTIVEC_H 1
+#cmakedefine HAVE_STDARG_H 1
+#cmakedefine HAVE_STDINT_H 1
+#cmakedefine HAVE_STDIO_H 1
+#cmakedefine HAVE_STDLIB_H 1
+#cmakedefine HAVE_STRINGS_H 1
+#cmakedefine HAVE_STRING_H 1
+#cmakedefine HAVE_SYS_TYPES_H 1
+#cmakedefine HAVE_WCHAR_H 1
 #cmakedefine HAVE_PTHREAD_NP_H 1
-#cmakedefine HAVE_LIBUDEV_H 1
-#cmakedefine HAVE_DBUS_DBUS_H 1
+#cmakedefine HAVE_LIBUNWIND_H 1
 
 /* C library functions */
 #cmakedefine HAVE_MALLOC 1
@@ -101,10 +93,13 @@
 #cmakedefine HAVE_MEMCPY 1
 #cmakedefine HAVE_MEMMOVE 1
 #cmakedefine HAVE_MEMCMP 1
+#cmakedefine HAVE_WCSLEN 1
+#cmakedefine HAVE_WCSLCPY 1
+#cmakedefine HAVE_WCSLCAT 1
+#cmakedefine HAVE_WCSCMP 1
 #cmakedefine HAVE_STRLEN 1
 #cmakedefine HAVE_STRLCPY 1
 #cmakedefine HAVE_STRLCAT 1
-#cmakedefine HAVE_STRDUP 1
 #cmakedefine HAVE__STRREV 1
 #cmakedefine HAVE__STRUPR 1
 #cmakedefine HAVE__STRLWR 1
@@ -135,25 +130,39 @@
 #cmakedefine HAVE_VSSCANF 1
 #cmakedefine HAVE_VSNPRINTF 1
 #cmakedefine HAVE_M_PI 1
-#cmakedefine HAVE_ATAN 1
-#cmakedefine HAVE_ATAN2 1
 #cmakedefine HAVE_ACOS 1
+#cmakedefine HAVE_ACOSF 1
 #cmakedefine HAVE_ASIN 1
+#cmakedefine HAVE_ASINF 1
+#cmakedefine HAVE_ATAN 1
+#cmakedefine HAVE_ATANF 1
+#cmakedefine HAVE_ATAN2 1
+#cmakedefine HAVE_ATAN2F 1
 #cmakedefine HAVE_CEIL 1
+#cmakedefine HAVE_CEILF 1
 #cmakedefine HAVE_COPYSIGN 1
+#cmakedefine HAVE_COPYSIGNF 1
 #cmakedefine HAVE_COS 1
 #cmakedefine HAVE_COSF 1
 #cmakedefine HAVE_FABS 1
+#cmakedefine HAVE_FABSF 1
 #cmakedefine HAVE_FLOOR 1
+#cmakedefine HAVE_FLOORF 1
+#cmakedefine HAVE_FMOD 1
+#cmakedefine HAVE_FMODF 1
 #cmakedefine HAVE_LOG 1
+#cmakedefine HAVE_LOGF 1
 #cmakedefine HAVE_POW 1
+#cmakedefine HAVE_POWF 1
 #cmakedefine HAVE_SCALBN 1
+#cmakedefine HAVE_SCALBNF 1
 #cmakedefine HAVE_SIN 1
 #cmakedefine HAVE_SINF 1
 #cmakedefine HAVE_SQRT 1
 #cmakedefine HAVE_SQRTF 1
 #cmakedefine HAVE_TAN 1
 #cmakedefine HAVE_TANF 1
+#cmakedefine HAVE_FOPEN64 1
 #cmakedefine HAVE_FSEEKO 1
 #cmakedefine HAVE_FSEEKO64 1
 #cmakedefine HAVE_SIGACTION 1
@@ -169,14 +178,36 @@
 #cmakedefine HAVE_PTHREAD_SETNAME_NP 1
 #cmakedefine HAVE_PTHREAD_SET_NAME_NP 1
 #cmakedefine HAVE_SEM_TIMEDWAIT 1
+#cmakedefine HAVE_GETAUXVAL 1
+#cmakedefine HAVE_POLL 1
+
 #elif __WIN32__
 #cmakedefine HAVE_STDARG_H 1
 #cmakedefine HAVE_STDDEF_H 1
+#cmakedefine HAVE_FLOAT_H 1
 #else
 /* We may need some replacement for stdarg.h here */
 #include <stdarg.h>
 #endif /* HAVE_LIBC */
 
+#cmakedefine HAVE_ALTIVEC_H 1
+#cmakedefine HAVE_DBUS_DBUS_H 1
+#cmakedefine HAVE_FCITX_FRONTEND_H 1
+#cmakedefine HAVE_IBUS_IBUS_H 1
+#cmakedefine HAVE_IMMINTRIN_H 1
+#cmakedefine HAVE_LIBSAMPLERATE_H 1
+#cmakedefine HAVE_LIBUDEV_H 1
+
+#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
+#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
+#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
+#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
+#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
+#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
+#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
+#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@
+#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@
+
 /* SDL internal assertion support */
 #cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@
 
@@ -199,37 +230,41 @@
 /* Enable various audio drivers */
 #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
 #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@
+#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@
 #cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@
 #cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@
-#cmakedefine SDL_AUDIO_DRIVER_BSD @SDL_AUDIO_DRIVER_BSD@
 #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@
 #cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@
-#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@
-#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@
 #cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@
+#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@
+#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@
 #cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@
 #cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
+#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@
+#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@
+#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@
+#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@
+#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
 #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@
-#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@
+#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@
 #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
 #cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
 #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
+#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
+#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@
+#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@
+#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@
+#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@
 #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@
-#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@
-#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@
 
 /* Enable various input drivers */
 #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
 #cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
 #cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@
+#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
 #cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
 #cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@
 #cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
@@ -246,9 +281,9 @@
 #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
 #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
 #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
+#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@
 
 /* Enable various shared object loading systems */
-#cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@
 #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
 #cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@
 #cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@
@@ -268,6 +303,7 @@
 #cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@
 
 /* Enable various video drivers */
+#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
 #cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
 #cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
 #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
@@ -279,6 +315,10 @@
 #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
 #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
 
+#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@
+#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@
+#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@
+
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
@@ -317,6 +357,7 @@
 #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@
 #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@
 #cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
+#cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@
 
 /* Enable OpenGL support */
 #cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@
@@ -330,7 +371,11 @@
 #cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@
 #cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@
 
+/* Enable Vulkan support */
+#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@
+
 /* Enable system power support */
+#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
 #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
 #cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
 #cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
@@ -339,6 +384,7 @@
 #cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
 
 /* Enable system filesystem support */
+#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@
 #cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@
 #cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@
 #cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@
@@ -350,6 +396,8 @@
 #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
 #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
 
+/* Enable dynamic libsamplerate support */
+#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
 
 /* Platform specific definitions */
 #if !defined(__WIN32__)
@@ -411,4 +459,4 @@ typedef unsigned int uintptr_t;
 #  endif /* !_STDINT_H_ && !HAVE_STDINT_H */
 #endif /* __WIN32__ */
 
-#endif /* _SDL_config_h */
+#endif /* SDL_config_h_ */

+ 90 - 42
sdl.mod/SDL/include/SDL_config.h.in

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_h_
+#define SDL_config_h_
 
 /**
  *  \file SDL_config.h.in
@@ -50,38 +50,32 @@
 #undef HAVE_GCC_ATOMICS
 #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
 
-#undef HAVE_DDRAW_H
-#undef HAVE_DINPUT_H
-#undef HAVE_DSOUND_H
-#undef HAVE_DXGI_H
-#undef HAVE_XINPUT_H
-
 /* Comment this if you want to build without any C library requirements */
 #undef HAVE_LIBC
 #if HAVE_LIBC
 
 /* Useful headers */
-#undef HAVE_ALLOCA_H
-#undef HAVE_SYS_TYPES_H
-#undef HAVE_STDIO_H
 #undef STDC_HEADERS
-#undef HAVE_STDLIB_H
-#undef HAVE_STDARG_H
-#undef HAVE_MALLOC_H
-#undef HAVE_MEMORY_H
-#undef HAVE_STRING_H
-#undef HAVE_STRINGS_H
-#undef HAVE_INTTYPES_H
-#undef HAVE_STDINT_H
+#undef HAVE_ALLOCA_H
 #undef HAVE_CTYPE_H
-#undef HAVE_MATH_H
+#undef HAVE_FLOAT_H
 #undef HAVE_ICONV_H
+#undef HAVE_INTTYPES_H
+#undef HAVE_LIMITS_H
+#undef HAVE_MALLOC_H
+#undef HAVE_MATH_H
+#undef HAVE_MEMORY_H
 #undef HAVE_SIGNAL_H
-#undef HAVE_ALTIVEC_H
+#undef HAVE_STDARG_H
+#undef HAVE_STDINT_H
+#undef HAVE_STDIO_H
+#undef HAVE_STDLIB_H
+#undef HAVE_STRINGS_H
+#undef HAVE_STRING_H
+#undef HAVE_SYS_TYPES_H
+#undef HAVE_WCHAR_H
 #undef HAVE_PTHREAD_NP_H
-#undef HAVE_LIBUDEV_H
-#undef HAVE_DBUS_DBUS_H
-#undef HAVE_IBUS_IBUS_H
+#undef HAVE_LIBUNWIND_H
 
 /* C library functions */
 #undef HAVE_MALLOC
@@ -102,10 +96,13 @@
 #undef HAVE_MEMCPY
 #undef HAVE_MEMMOVE
 #undef HAVE_MEMCMP
+#undef HAVE_WCSLEN
+#undef HAVE_WCSLCPY
+#undef HAVE_WCSLCAT
+#undef HAVE_WCSCMP
 #undef HAVE_STRLEN
 #undef HAVE_STRLCPY
 #undef HAVE_STRLCAT
-#undef HAVE_STRDUP
 #undef HAVE__STRREV
 #undef HAVE__STRUPR
 #undef HAVE__STRLWR
@@ -138,25 +135,39 @@
 #undef HAVE_SNPRINTF
 #undef HAVE_VSNPRINTF
 #undef HAVE_M_PI
-#undef HAVE_ATAN
-#undef HAVE_ATAN2
 #undef HAVE_ACOS
+#undef HAVE_ACOSF
 #undef HAVE_ASIN
+#undef HAVE_ASINF
+#undef HAVE_ATAN
+#undef HAVE_ATANF
+#undef HAVE_ATAN2
+#undef HAVE_ATAN2F
 #undef HAVE_CEIL
+#undef HAVE_CEILF
 #undef HAVE_COPYSIGN
+#undef HAVE_COPYSIGNF
 #undef HAVE_COS
 #undef HAVE_COSF
 #undef HAVE_FABS
+#undef HAVE_FABSF
 #undef HAVE_FLOOR
+#undef HAVE_FLOORF
+#undef HAVE_FMOD
+#undef HAVE_FMODF
 #undef HAVE_LOG
+#undef HAVE_LOGF
 #undef HAVE_POW
+#undef HAVE_POWF
 #undef HAVE_SCALBN
+#undef HAVE_SCALBNF
 #undef HAVE_SIN
 #undef HAVE_SINF
 #undef HAVE_SQRT
 #undef HAVE_SQRTF
 #undef HAVE_TAN
 #undef HAVE_TANF
+#undef HAVE_FOPEN64
 #undef HAVE_FSEEKO
 #undef HAVE_FSEEKO64
 #undef HAVE_SIGACTION
@@ -172,6 +183,8 @@
 #undef HAVE_PTHREAD_SETNAME_NP
 #undef HAVE_PTHREAD_SET_NAME_NP
 #undef HAVE_SEM_TIMEDWAIT
+#undef HAVE_GETAUXVAL
+#undef HAVE_POLL
 
 #else
 #define HAVE_STDARG_H   1
@@ -179,6 +192,22 @@
 #define HAVE_STDINT_H   1
 #endif /* HAVE_LIBC */
 
+#undef HAVE_ALTIVEC_H
+#undef HAVE_DBUS_DBUS_H
+#undef HAVE_FCITX_FRONTEND_H
+#undef HAVE_IBUS_IBUS_H
+#undef HAVE_IMMINTRIN_H
+#undef HAVE_LIBSAMPLERATE_H
+#undef HAVE_LIBUDEV_H
+
+#undef HAVE_DDRAW_H
+#undef HAVE_DINPUT_H
+#undef HAVE_DSOUND_H
+#undef HAVE_DXGI_H
+#undef HAVE_XINPUT_H
+#undef HAVE_XINPUT_GAMEPAD_EX
+#undef HAVE_XINPUT_STATE_EX
+
 /* SDL internal assertion support */
 #undef SDL_DEFAULT_ASSERT_LEVEL
 
@@ -201,34 +230,36 @@
 /* Enable various audio drivers */
 #undef SDL_AUDIO_DRIVER_ALSA
 #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+#undef SDL_AUDIO_DRIVER_ANDROID
 #undef SDL_AUDIO_DRIVER_ARTS
 #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_PULSEAUDIO
-#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
-#undef SDL_AUDIO_DRIVER_HAIKU
-#undef SDL_AUDIO_DRIVER_BSD
 #undef SDL_AUDIO_DRIVER_COREAUDIO
 #undef SDL_AUDIO_DRIVER_DISK
-#undef SDL_AUDIO_DRIVER_DUMMY
-#undef SDL_AUDIO_DRIVER_ANDROID
-#undef SDL_AUDIO_DRIVER_XAUDIO2
 #undef SDL_AUDIO_DRIVER_DSOUND
+#undef SDL_AUDIO_DRIVER_DUMMY
+#undef SDL_AUDIO_DRIVER_EMSCRIPTEN
 #undef SDL_AUDIO_DRIVER_ESD
 #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
+#undef SDL_AUDIO_DRIVER_FUSIONSOUND
+#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
+#undef SDL_AUDIO_DRIVER_HAIKU
+#undef SDL_AUDIO_DRIVER_JACK
+#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC
 #undef SDL_AUDIO_DRIVER_NACL
 #undef SDL_AUDIO_DRIVER_NAS
 #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_SNDIO
-#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
+#undef SDL_AUDIO_DRIVER_NETBSD
 #undef SDL_AUDIO_DRIVER_OSS
 #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
 #undef SDL_AUDIO_DRIVER_PAUDIO
+#undef SDL_AUDIO_DRIVER_PULSEAUDIO
+#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
 #undef SDL_AUDIO_DRIVER_QSA
+#undef SDL_AUDIO_DRIVER_SNDIO
+#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
 #undef SDL_AUDIO_DRIVER_SUNAUDIO
+#undef SDL_AUDIO_DRIVER_WASAPI
 #undef SDL_AUDIO_DRIVER_WINMM
-#undef SDL_AUDIO_DRIVER_FUSIONSOUND
-#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
-#undef SDL_AUDIO_DRIVER_EMSCRIPTEN
 
 /* Enable various input drivers */
 #undef SDL_INPUT_LINUXEV
@@ -246,13 +277,13 @@
 #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
 #undef SDL_JOYSTICK_EMSCRIPTEN
 #undef SDL_HAPTIC_DUMMY
+#undef SDL_HAPTIC_ANDROID
 #undef SDL_HAPTIC_LINUX
 #undef SDL_HAPTIC_IOKIT
 #undef SDL_HAPTIC_DINPUT
 #undef SDL_HAPTIC_XINPUT
 
 /* Enable various shared object loading systems */
-#undef SDL_LOADSO_HAIKU
 #undef SDL_LOADSO_DLOPEN
 #undef SDL_LOADSO_DUMMY
 #undef SDL_LOADSO_LDG
@@ -288,6 +319,9 @@
 #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
 #undef SDL_VIDEO_DRIVER_X11
 #undef SDL_VIDEO_DRIVER_RPI
+#undef SDL_VIDEO_DRIVER_KMSDRM
+#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
+#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
 #undef SDL_VIDEO_DRIVER_ANDROID
 #undef SDL_VIDEO_DRIVER_EMSCRIPTEN
 #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
@@ -313,6 +347,7 @@
 #undef SDL_VIDEO_DRIVER_NACL
 #undef SDL_VIDEO_DRIVER_VIVANTE
 #undef SDL_VIDEO_DRIVER_VIVANTE_VDK
+#undef SDL_VIDEO_DRIVER_QNX
 
 #undef SDL_VIDEO_RENDER_D3D
 #undef SDL_VIDEO_RENDER_D3D11
@@ -320,6 +355,7 @@
 #undef SDL_VIDEO_RENDER_OGL_ES
 #undef SDL_VIDEO_RENDER_OGL_ES2
 #undef SDL_VIDEO_RENDER_DIRECTFB
+#undef SDL_VIDEO_RENDER_METAL
 
 /* Enable OpenGL support */
 #undef SDL_VIDEO_OPENGL
@@ -333,6 +369,9 @@
 #undef SDL_VIDEO_OPENGL_OSMESA
 #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
 
+/* Enable Vulkan support */
+#undef SDL_VIDEO_VULKAN
+
 /* Enable system power support */
 #undef SDL_POWER_LINUX
 #undef SDL_POWER_WINDOWS
@@ -356,4 +395,13 @@
 #undef SDL_ASSEMBLY_ROUTINES
 #undef SDL_ALTIVEC_BLITTERS
 
-#endif /* _SDL_config_h */
+/* Enable ime support */
+#undef SDL_USE_IME
+
+/* Enable dynamic udev support */
+#undef SDL_UDEV_DYNAMIC
+
+/* Enable dynamic libsamplerate support */
+#undef SDL_LIBSAMPLERATE_DYNAMIC
+
+#endif /* SDL_config_h_ */

+ 40 - 16
sdl.mod/SDL/include/SDL_config_android.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_android_h
-#define _SDL_config_android_h
+#ifndef SDL_config_android_h_
+#define SDL_config_android_h_
+#define SDL_config_h_
 
 #include "SDL_platform.h"
 
@@ -34,15 +35,17 @@
 
 #define HAVE_GCC_ATOMICS    1
 
-#define HAVE_ALLOCA_H       1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_STDIO_H    1
 #define STDC_HEADERS    1
-#define HAVE_STRING_H   1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H   1
+#define HAVE_ALLOCA_H       1
 #define HAVE_CTYPE_H    1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H   1
 #define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H   1
+#define HAVE_STDIO_H    1
+#define HAVE_STRING_H   1
+#define HAVE_SYS_TYPES_H    1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -65,7 +68,6 @@
 #define HAVE_STRLEN 1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCAT    1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
@@ -75,36 +77,50 @@
 #define HAVE_STRTOULL   1
 #define HAVE_STRTOD 1
 #define HAVE_ATOI   1
+#define HAVE_ATOF 1
 #define HAVE_STRCMP 1
 #define HAVE_STRNCMP    1
 #define HAVE_STRCASECMP 1
 #define HAVE_STRNCASECMP 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF  1
-#define HAVE_M_PI   1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
 #define HAVE_ATAN   1
+#define HAVE_ATANF  1
 #define HAVE_ATAN2  1
-#define HAVE_ACOS  1
-#define HAVE_ASIN  1
+#define HAVE_ATAN2F 1
 #define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_FABS   1
+#define HAVE_FABSF  1
 #define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
 #define HAVE_LOG    1
+#define HAVE_LOGF   1
 #define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SQRT   1
 #define HAVE_SQRTF  1
 #define HAVE_TAN    1
 #define HAVE_TANF   1
+#define HAVE_SIGACTION 1
 #define HAVE_SETJMP 1
 #define HAVE_NANOSLEEP  1
 #define HAVE_SYSCONF    1
-#define HAVE_CLOCK_GETTIME	1
+#define HAVE_CLOCK_GETTIME  1
 
 #define SIZEOF_VOIDP 4
 
@@ -114,7 +130,7 @@
 
 /* Enable various input drivers */
 #define SDL_JOYSTICK_ANDROID    1
-#define SDL_HAPTIC_DUMMY    1
+#define SDL_HAPTIC_ANDROID    1
 
 /* Enable various shared object loading systems */
 #define SDL_LOADSO_DLOPEN   1
@@ -136,10 +152,18 @@
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_RENDER_OGL_ES2    1
 
+/* Enable Vulkan support */
+/* Android does not support Vulkan in native code using the "armeabi" ABI. */
+#if defined(__ARM_ARCH) && __ARM_ARCH < 7
+#define SDL_VIDEO_VULKAN 0
+#else
+#define SDL_VIDEO_VULKAN 1
+#endif
+
 /* Enable system power support */
 #define SDL_POWER_ANDROID 1
 
 /* Enable the filesystem driver */
 #define SDL_FILESYSTEM_ANDROID   1
 
-#endif /* _SDL_config_android_h */
+#endif /* SDL_config_android_h_ */

+ 46 - 19
sdl.mod/SDL/include/SDL_config_iphoneos.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_iphoneos_h
-#define _SDL_config_iphoneos_h
+#ifndef SDL_config_iphoneos_h_
+#define SDL_config_iphoneos_h_
+#define SDL_config_h_
 
 #include "SDL_platform.h"
 
@@ -32,16 +33,19 @@
 
 #define HAVE_GCC_ATOMICS    1
 
-#define HAVE_ALLOCA_H       1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_STDIO_H    1
 #define STDC_HEADERS    1
-#define HAVE_STRING_H   1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H   1
+#define HAVE_ALLOCA_H       1
 #define HAVE_CTYPE_H    1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H   1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H   1
+#define HAVE_STDINT_H   1
+#define HAVE_STDIO_H    1
+#define HAVE_STRING_H   1
+#define HAVE_SYS_TYPES_H    1
+/* The libunwind functions are only available on x86 */
+/* #undef HAVE_LIBUNWIND_H */
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -64,7 +68,6 @@
 #define HAVE_STRLEN 1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCAT    1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
@@ -82,19 +85,32 @@
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF  1
 #define HAVE_M_PI   1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
 #define HAVE_ATAN   1
+#define HAVE_ATANF  1
 #define HAVE_ATAN2  1
-#define HAVE_ACOS  1
-#define HAVE_ASIN  1
+#define HAVE_ATAN2F 1
 #define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_FABS   1
+#define HAVE_FABSF  1
 #define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
 #define HAVE_LOG    1
+#define HAVE_LOGF   1
 #define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SQRT   1
@@ -119,11 +135,7 @@
 #define SDL_JOYSTICK_MFI 1
 
 /* Enable Unix style SO loading */
-/* Technically this works, but violates the iOS dev agreement prior to iOS 8 */
-/* #define SDL_LOADSO_DLOPEN 1 */
-
-/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
+#define SDL_LOADSO_DLOPEN 1
 
 /* Enable various threading systems */
 #define SDL_THREAD_PTHREAD  1
@@ -136,12 +148,27 @@
 #define SDL_VIDEO_DRIVER_UIKIT  1
 #define SDL_VIDEO_DRIVER_DUMMY  1
 
-/* enable OpenGL ES */
+/* Enable OpenGL ES */
 #define SDL_VIDEO_OPENGL_ES2 1
 #define SDL_VIDEO_OPENGL_ES 1
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_RENDER_OGL_ES2    1
 
+/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer */
+#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000))
+#define SDL_PLATFORM_SUPPORTS_METAL	1
+#else
+#define SDL_PLATFORM_SUPPORTS_METAL	0
+#endif
+
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_RENDER_METAL  1
+#endif
+
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_VULKAN 1
+#endif
+
 /* Enable system power support */
 #define SDL_POWER_UIKIT 1
 
@@ -159,4 +186,4 @@
 /* enable filesystem support */
 #define SDL_FILESYSTEM_COCOA   1
 
-#endif /* _SDL_config_iphoneos_h */
+#endif /* SDL_config_iphoneos_h_ */

+ 59 - 15
sdl.mod/SDL/include/SDL_config_macosx.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_macosx_h
-#define _SDL_config_macosx_h
+#ifndef SDL_config_macosx_h_
+#define SDL_config_macosx_h_
+#define SDL_config_h_
 
 #include "SDL_platform.h"
 
@@ -36,16 +37,19 @@
 #endif
 
 /* Useful headers */
-#define HAVE_ALLOCA_H       1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_STDIO_H    1
 #define STDC_HEADERS    1
-#define HAVE_STRING_H   1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H   1
+#define HAVE_ALLOCA_H       1
 #define HAVE_CTYPE_H    1
+#define HAVE_FLOAT_H    1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H   1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H   1
+#define HAVE_STDINT_H   1
+#define HAVE_STDIO_H    1
+#define HAVE_STRING_H   1
+#define HAVE_SYS_TYPES_H    1
+#define HAVE_LIBUNWIND_H    1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -67,7 +71,6 @@
 #define HAVE_STRLEN 1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCAT    1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
@@ -84,15 +87,33 @@
 #define HAVE_STRNCASECMP 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF  1
+#define HAVE_M_PI   1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
+#define HAVE_ATAN   1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2  1
+#define HAVE_ATAN2F 1
 #define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_FABS   1
+#define HAVE_FABSF  1
 #define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
 #define HAVE_LOG    1
+#define HAVE_LOGF   1
 #define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SQRT   1
@@ -104,10 +125,6 @@
 #define HAVE_NANOSLEEP  1
 #define HAVE_SYSCONF    1
 #define HAVE_SYSCTLBYNAME 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
 
 /* Enable various audio drivers */
 #define SDL_AUDIO_DRIVER_COREAUDIO  1
@@ -162,10 +179,29 @@
 #define SDL_VIDEO_RENDER_OGL    1
 #endif
 
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_METAL
+/* Metal only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_RENDER_METAL    1
+#else
+#define SDL_VIDEO_RENDER_METAL    0
+#endif
+#endif
+
 /* Enable OpenGL support */
 #ifndef SDL_VIDEO_OPENGL
 #define SDL_VIDEO_OPENGL    1
 #endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2    1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL    1
+#endif
 #ifndef SDL_VIDEO_OPENGL_CGL
 #define SDL_VIDEO_OPENGL_CGL    1
 #endif
@@ -173,6 +209,14 @@
 #define SDL_VIDEO_OPENGL_GLX    1
 #endif
 
+/* Enable Vulkan support */
+/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_VULKAN 1
+#else
+#define SDL_VIDEO_VULKAN 0
+#endif
+
 /* Enable system power support */
 #define SDL_POWER_MACOSX 1
 
@@ -185,4 +229,4 @@
 #define SDL_ALTIVEC_BLITTERS    1
 #endif
 
-#endif /* _SDL_config_macosx_h */
+#endif /* SDL_config_macosx_h_ */

+ 5 - 4
sdl.mod/SDL/include/SDL_config_minimal.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_minimal_h
-#define _SDL_config_minimal_h
+#ifndef SDL_config_minimal_h_
+#define SDL_config_minimal_h_
+#define SDL_config_h_
 
 #include "SDL_platform.h"
 
@@ -78,4 +79,4 @@ typedef unsigned long uintptr_t;
 /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
 #define SDL_FILESYSTEM_DUMMY  1
 
-#endif /* _SDL_config_minimal_h */
+#endif /* SDL_config_minimal_h_ */

+ 19 - 17
sdl.mod/SDL/include/SDL_config_pandora.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_pandora_h_
+#define SDL_config_pandora_h_
+#define SDL_config_h_
 
 /* This is a set of defines to configure the SDL features */
 
@@ -35,22 +36,24 @@
 
 #define SDL_BYTEORDER 1234
 
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
 #define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
+#define HAVE_ALLOCA_H 1
 #define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
 #define HAVE_ICONV_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MEMORY_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
 #define HAVE_MALLOC 1
 #define HAVE_CALLOC 1
 #define HAVE_REALLOC 1
@@ -67,7 +70,6 @@
 #define HAVE_MEMCPY 1
 #define HAVE_MEMMOVE 1
 #define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
@@ -124,4 +126,4 @@
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1
 
-#endif /* _SDL_config_h */
+#endif /* SDL_config_pandora_h_ */

+ 27 - 13
sdl.mod/SDL/include/SDL_config_psp.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_psp_h
-#define _SDL_config_psp_h
+#ifndef SDL_config_psp_h_
+#define SDL_config_psp_h_
+#define SDL_config_h_
 
 #include "SDL_platform.h"
 
@@ -32,16 +33,17 @@
 
 #define HAVE_GCC_ATOMICS    1
 
-#define HAVE_ALLOCA_H       1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_STDIO_H    1
 #define STDC_HEADERS    1
-#define HAVE_STRING_H   1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H   1
+#define HAVE_ALLOCA_H       1
 #define HAVE_CTYPE_H    1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H   1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H   1
+#define HAVE_STDINT_H   1
+#define HAVE_STDIO_H    1
+#define HAVE_STRING_H   1
+#define HAVE_SYS_TYPES_H    1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -64,7 +66,6 @@
 #define HAVE_STRLEN 1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCAT    1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
@@ -82,19 +83,32 @@
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF  1
 #define HAVE_M_PI   1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
 #define HAVE_ATAN   1
+#define HAVE_ATANF  1
 #define HAVE_ATAN2  1
-#define HAVE_ACOS  1
-#define HAVE_ASIN  1
+#define HAVE_ATAN2F 1
 #define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_FABS   1
+#define HAVE_FABSF  1
 #define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
 #define HAVE_LOG    1
+#define HAVE_LOGF   1
 #define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SQRT   1
@@ -140,4 +154,4 @@
 #define SDL_LOADSO_DISABLED    1
 
 
-#endif /* _SDL_config_psp_h */
+#endif /* SDL_config_psp_h_ */

+ 55 - 30
sdl.mod/SDL/include/SDL_config_windows.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_windows_h
-#define _SDL_config_windows_h
+#ifndef SDL_config_windows_h_
+#define SDL_config_windows_h_
+#define SDL_config_h_
 
 #include "SDL_platform.h"
 
@@ -85,12 +86,14 @@ typedef unsigned int uintptr_t;
 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
 #ifdef HAVE_LIBC
 /* Useful headers */
-#define HAVE_STDIO_H 1
 #define STDC_HEADERS 1
-#define HAVE_STRING_H 1
 #define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -106,13 +109,15 @@ typedef unsigned int uintptr_t;
 #define HAVE_MEMCMP 1
 #define HAVE_STRLEN 1
 #define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
-#define HAVE__LTOA 1
-#define HAVE__ULTOA 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__ULTOA */
 #define HAVE_STRTOL 1
 #define HAVE_STRTOUL 1
 #define HAVE_STRTOD 1
@@ -122,28 +127,46 @@ typedef unsigned int uintptr_t;
 #define HAVE_STRNCMP 1
 #define HAVE__STRICMP 1
 #define HAVE__STRNICMP 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS  1
-#define HAVE_ASIN  1
-#define HAVE_CEIL 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
+#define HAVE_ATAN   1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2  1
+#define HAVE_ATAN2F 1
+#define HAVE_CEILF  1
+#define HAVE__COPYSIGN  1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_FABS   1
+#define HAVE_FABSF  1
+#define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
+#define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_POW    1
+#define HAVE_POWF   1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SQRTF  1
+#define HAVE_TAN    1
+#define HAVE_TANF   1
+#if defined(_MSC_VER)
+/* These functions were added with the VC++ 2013 C runtime library */
 #if _MSC_VER >= 1800
 #define HAVE_STRTOLL 1
 #define HAVE_VSSCANF 1
-#define HAVE_COPYSIGN 1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
+#endif
+/* This function is available with at least the VC++ 2008 C runtime library */
+#if _MSC_VER >= 1400
+#define HAVE__FSEEKI64 1
+#endif
 #endif
 #if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
 #define HAVE_M_PI 1
@@ -154,8 +177,8 @@ typedef unsigned int uintptr_t;
 #endif
 
 /* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_WASAPI 1
 #define SDL_AUDIO_DRIVER_DSOUND 1
-#define SDL_AUDIO_DRIVER_XAUDIO2    1
 #define SDL_AUDIO_DRIVER_WINMM  1
 #define SDL_AUDIO_DRIVER_DISK   1
 #define SDL_AUDIO_DRIVER_DUMMY  1
@@ -183,7 +206,7 @@ typedef unsigned int uintptr_t;
 #define SDL_VIDEO_RENDER_D3D    1
 #endif
 #ifndef SDL_VIDEO_RENDER_D3D11
-#define SDL_VIDEO_RENDER_D3D11	0
+#define SDL_VIDEO_RENDER_D3D11  0
 #endif
 
 /* Enable OpenGL support */
@@ -206,6 +229,8 @@ typedef unsigned int uintptr_t;
 #define SDL_VIDEO_OPENGL_EGL    1
 #endif
 
+/* Enable Vulkan support */
+#define SDL_VIDEO_VULKAN 1
 
 /* Enable system power support */
 #define SDL_POWER_WINDOWS 1
@@ -218,4 +243,4 @@ typedef unsigned int uintptr_t;
 #define SDL_ASSEMBLY_ROUTINES   1
 #endif
 
-#endif /* _SDL_config_windows_h */
+#endif /* SDL_config_windows_h_ */

+ 70 - 36
sdl.mod/SDL/include/SDL_config_winrt.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,16 +19,32 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_windows_h
-#define _SDL_config_windows_h
+#ifndef SDL_config_winrt_h_
+#define SDL_config_winrt_h_
+#define SDL_config_h_
 
 #include "SDL_platform.h"
 
+/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined.  This is used
+   by SDL to determine which version of the Windows SDK is being used.
+*/
+#include <sdkddkver.h>
+
+/* Define possibly-undefined NTDDI values (used when compiling SDL against
+   older versions of the Windows SDK.
+*/
+#ifndef NTDDI_WINBLUE
+#define NTDDI_WINBLUE 0x06030000
+#endif
+#ifndef NTDDI_WIN10
+#define NTDDI_WIN10 0x0A000000
+#endif
+
 /* This is a set of defines to configure the SDL features */
 
 #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
 #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H	1
+#define HAVE_STDINT_H   1
 #elif defined(_MSC_VER)
 typedef signed __int8 int8_t;
 typedef unsigned __int8 uint8_t;
@@ -82,13 +98,14 @@ typedef unsigned int uintptr_t;
 #define HAVE_XINPUT_H 1
 #endif
 #define HAVE_LIBC 1
-#define HAVE_STDIO_H 1
 #define STDC_HEADERS 1
-#define HAVE_STRING_H 1
 #define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
 #define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -105,13 +122,13 @@ typedef unsigned int uintptr_t;
 #define HAVE_STRLEN 1
 #define HAVE__STRREV 1
 #define HAVE__STRUPR 1
-//#define HAVE__STRLWR 1	// TODO, WinRT: consider using _strlwr_s instead
+//#define HAVE__STRLWR 1    // TODO, WinRT: consider using _strlwr_s instead
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
 //#define HAVE_ITOA 1   // TODO, WinRT: consider using _itoa_s instead
-//#define HAVE__LTOA 1	// TODO, WinRT: consider using _ltoa_s instead
-//#define HAVE__ULTOA 1	// TODO, WinRT: consider using _ultoa_s instead
+//#define HAVE__LTOA 1  // TODO, WinRT: consider using _ltoa_s instead
+//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
 #define HAVE_STRTOL 1
 #define HAVE_STRTOUL 1
 //#define HAVE_STRTOLL 1
@@ -123,53 +140,70 @@ typedef unsigned int uintptr_t;
 #define HAVE__STRICMP 1
 #define HAVE__STRNICMP 1
 #define HAVE_VSNPRINTF 1
-//#define HAVE_SSCANF 1	// TODO, WinRT: consider using sscanf_s instead
+//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
 #define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_CEIL 1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
+#define HAVE_ATAN   1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2  1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE__COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-//#define HAVE_SCALBN 1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_FABS   1
+#define HAVE_FABSF  1
+#define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
+#define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE__SCALB 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SQRTF  1
+#define HAVE_TAN    1
+#define HAVE_TANF   1
 #define HAVE__FSEEKI64 1
 
 /* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_XAUDIO2	1
-#define SDL_AUDIO_DRIVER_DISK	1
-#define SDL_AUDIO_DRIVER_DUMMY	1
+#define SDL_AUDIO_DRIVER_WASAPI 1
+#define SDL_AUDIO_DRIVER_DISK   1
+#define SDL_AUDIO_DRIVER_DUMMY  1
 
 /* Enable various input drivers */
 #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 #define SDL_JOYSTICK_DISABLED 1
-#define SDL_HAPTIC_DISABLED	1
+#define SDL_HAPTIC_DISABLED 1
 #else
 #define SDL_JOYSTICK_XINPUT 1
 #define SDL_HAPTIC_XINPUT   1
 #endif
 
 /* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS	1
+#define SDL_LOADSO_WINDOWS  1
 
 /* Enable various threading systems */
+#if (NTDDI_VERSION >= NTDDI_WINBLUE)
+#define SDL_THREAD_WINDOWS  1
+#else
+/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */
 #define SDL_THREAD_STDCPP   1
+#endif
 
 /* Enable various timer systems */
-#define SDL_TIMER_WINDOWS	1
+#define SDL_TIMER_WINDOWS   1
 
 /* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_WINRT	1
+#define SDL_VIDEO_DRIVER_WINRT  1
 #define SDL_VIDEO_DRIVER_DUMMY  1
 
 /* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
@@ -188,7 +222,7 @@ typedef unsigned int uintptr_t;
 
 /* Enable assembly routines (Win64 doesn't have inline asm) */
 #ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES	1
+#define SDL_ASSEMBLY_ROUTINES   1
 #endif
 
-#endif /* _SDL_config_windows_h */
+#endif /* SDL_config_winrt_h_ */

+ 50 - 31
sdl.mod/SDL/include/SDL_config_wiz.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_wiz_h_
+#define SDL_config_wiz_h_
+#define SDL_config_h_
 
 /* This is a set of defines to configure the SDL features */
 
@@ -29,22 +30,24 @@
 
 #define SDL_BYTEORDER 1234
 
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
 #define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
+#define HAVE_ALLOCA_H 1
 #define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
 #define HAVE_ICONV_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MEMORY_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
 #define HAVE_MALLOC 1
 #define HAVE_CALLOC 1
 #define HAVE_REALLOC 1
@@ -61,7 +64,6 @@
 #define HAVE_MEMCPY 1
 #define HAVE_MEMMOVE 1
 #define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
@@ -78,26 +80,43 @@
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF 1
 #define HAVE_M_PI 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
+#define HAVE_ATAN   1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2  1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL   1
+#define HAVE_CEILF  1
+#define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_FABS   1
+#define HAVE_FABSF  1
+#define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
+#define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
+#define HAVE_SCALBNF    1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SQRTF  1
+#define HAVE_TAN    1
+#define HAVE_TANF   1
 #define HAVE_SIGACTION 1
 #define HAVE_SETJMP 1
 #define HAVE_NANOSLEEP 1
 #define HAVE_POW 1
 
-#define SDL_CDROM_DISABLED 1
 #define SDL_AUDIO_DRIVER_DUMMY 1
 #define SDL_AUDIO_DRIVER_OSS 1
 
@@ -118,4 +137,4 @@
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1
 
-#endif /* _SDL_config_h */
+#endif /* SDL_config_wiz_h_ */

+ 1 - 1
sdl.mod/SDL/include/SDL_copying.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages

+ 31 - 11
sdl.mod/SDL/include/SDL_cpuinfo.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,14 +25,20 @@
  *  CPU feature detection for SDL.
  */
 
-#ifndef _SDL_cpuinfo_h
-#define _SDL_cpuinfo_h
+#ifndef SDL_cpuinfo_h_
+#define SDL_cpuinfo_h_
 
 #include "SDL_stdinc.h"
 
 /* Need to do this here because intrin.h has C++ code in it */
 /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
 #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
+#ifdef __clang__
+/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
+#undef __MMX__
+#undef __SSE__
+#undef __SSE2__
+#else
 #include <intrin.h>
 #ifndef _WIN64
 #define __MMX__
@@ -40,28 +46,37 @@
 #endif
 #define __SSE__
 #define __SSE2__
+#endif /* __clang__ */
 #elif defined(__MINGW64_VERSION_MAJOR)
 #include <intrin.h>
 #else
 #ifdef __ALTIVEC__
-#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
+#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H)
 #include <altivec.h>
 #undef pixel
+#undef bool
 #endif
 #endif
-#ifdef __MMX__
-#include <mmintrin.h>
-#endif
-#ifdef __3dNOW__
+#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
 #include <mm3dnow.h>
 #endif
-#ifdef __SSE__
+#if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H)
+#include <immintrin.h>
+#else
+#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
+#include <mmintrin.h>
+#endif
+#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
 #include <xmmintrin.h>
 #endif
-#ifdef __SSE2__
+#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
 #include <emmintrin.h>
 #endif
+#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
+#include <pmmintrin.h>
 #endif
+#endif /* HAVE_IMMINTRIN_H */
+#endif /* compiler version */
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -144,6 +159,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
 
+/**
+ *  This function returns true if the CPU has NEON (ARM SIMD) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
+
 /**
  *  This function returns the amount of RAM configured in the system, in MB.
  */
@@ -156,6 +176,6 @@ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_cpuinfo_h */
+#endif /* SDL_cpuinfo_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 3 - 3
sdl.mod/SDL/include/SDL_egl.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,7 +24,7 @@
  *
  *  This is a simple file to encapsulate the EGL API headers.
  */
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__ANDROID__)
 
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
@@ -132,7 +132,7 @@
 *-------------------------------------------------------------------------
 * This precedes the return type of the function in the function prototype.
 */
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE)
 #   define KHRONOS_APICALL __declspec(dllimport)
 #elif defined (__SYMBIAN32__)
 #   define KHRONOS_APICALL IMPORT_C

+ 25 - 4
sdl.mod/SDL/include/SDL_endian.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Functions for reading and writing endian-specific values
  */
 
-#ifndef _SDL_endian_h
-#define _SDL_endian_h
+#ifndef SDL_endian_h_
+#define SDL_endian_h_
 
 #include "SDL_stdinc.h"
 
@@ -96,6 +96,12 @@ SDL_Swap16(Uint16 x)
   __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
     return x;
 }
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint16 SDL_Swap16(Uint16);
+#pragma aux SDL_Swap16 = \
+  "xchg al, ah" \
+  parm   [ax]   \
+  modify [ax];
 #else
 SDL_FORCE_INLINE Uint16
 SDL_Swap16(Uint16 x)
@@ -136,6 +142,21 @@ SDL_Swap32(Uint32 x)
   __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
     return x;
 }
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint32 SDL_Swap32(Uint32);
+#ifndef __SW_3 /* 486+ */
+#pragma aux SDL_Swap32 = \
+  "bswap eax"  \
+  parm   [eax] \
+  modify [eax];
+#else  /* 386-only */
+#pragma aux SDL_Swap32 = \
+  "xchg al, ah"  \
+  "ror  eax, 16" \
+  "xchg al, ah"  \
+  parm   [eax]   \
+  modify [eax];
+#endif
 #else
 SDL_FORCE_INLINE Uint32
 SDL_Swap32(Uint32 x)
@@ -234,6 +255,6 @@ SDL_SwapFloat(float x)
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_endian_h */
+#endif /* SDL_endian_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_error.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Simple error message routines for SDL.
  */
 
-#ifndef _SDL_error_h
-#define _SDL_error_h
+#ifndef SDL_error_h_
+#define SDL_error_h_
 
 #include "SDL_stdinc.h"
 
@@ -71,6 +71,6 @@ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_error_h */
+#endif /* SDL_error_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 37 - 33
sdl.mod/SDL/include/SDL_events.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL event handling.
  */
 
-#ifndef _SDL_events_h
-#define _SDL_events_h
+#ifndef SDL_events_h_
+#define SDL_events_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -136,6 +136,9 @@ typedef enum
 
     /* Drag and drop events */
     SDL_DROPFILE        = 0x1000, /**< The system requests a file open */
+    SDL_DROPTEXT,                 /**< text/plain drag-and-drop event */
+    SDL_DROPBEGIN,                /**< A new set of drops is beginning (NULL filename) */
+    SDL_DROPCOMPLETE,             /**< Current set of drops is now complete (NULL filename) */
 
     /* Audio hotplug events */
     SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
@@ -162,7 +165,7 @@ typedef enum
 typedef struct SDL_CommonEvent
 {
     Uint32 type;
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
 } SDL_CommonEvent;
 
 /**
@@ -171,7 +174,7 @@ typedef struct SDL_CommonEvent
 typedef struct SDL_WindowEvent
 {
     Uint32 type;        /**< ::SDL_WINDOWEVENT */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The associated window */
     Uint8 event;        /**< ::SDL_WindowEventID */
     Uint8 padding1;
@@ -187,7 +190,7 @@ typedef struct SDL_WindowEvent
 typedef struct SDL_KeyboardEvent
 {
     Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with keyboard focus, if any */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
     Uint8 repeat;       /**< Non-zero if this is a key repeat */
@@ -203,7 +206,7 @@ typedef struct SDL_KeyboardEvent
 typedef struct SDL_TextEditingEvent
 {
     Uint32 type;                                /**< ::SDL_TEXTEDITING */
-    Uint32 timestamp;
+    Uint32 timestamp;                           /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;                            /**< The window with keyboard focus, if any */
     char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
     Sint32 start;                               /**< The start cursor of selected editing text */
@@ -218,7 +221,7 @@ typedef struct SDL_TextEditingEvent
 typedef struct SDL_TextInputEvent
 {
     Uint32 type;                              /**< ::SDL_TEXTINPUT */
-    Uint32 timestamp;
+    Uint32 timestamp;                         /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;                          /**< The window with keyboard focus, if any */
     char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
 } SDL_TextInputEvent;
@@ -229,7 +232,7 @@ typedef struct SDL_TextInputEvent
 typedef struct SDL_MouseMotionEvent
 {
     Uint32 type;        /**< ::SDL_MOUSEMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint32 state;       /**< The current button state */
@@ -245,7 +248,7 @@ typedef struct SDL_MouseMotionEvent
 typedef struct SDL_MouseButtonEvent
 {
     Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint8 button;       /**< The mouse button index */
@@ -262,7 +265,7 @@ typedef struct SDL_MouseButtonEvent
 typedef struct SDL_MouseWheelEvent
 {
     Uint32 type;        /**< ::SDL_MOUSEWHEEL */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Sint32 x;           /**< The amount scrolled horizontally, positive to the right and negative to the left */
@@ -276,7 +279,7 @@ typedef struct SDL_MouseWheelEvent
 typedef struct SDL_JoyAxisEvent
 {
     Uint32 type;        /**< ::SDL_JOYAXISMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 axis;         /**< The joystick axis index */
     Uint8 padding1;
@@ -292,7 +295,7 @@ typedef struct SDL_JoyAxisEvent
 typedef struct SDL_JoyBallEvent
 {
     Uint32 type;        /**< ::SDL_JOYBALLMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 ball;         /**< The joystick trackball index */
     Uint8 padding1;
@@ -308,7 +311,7 @@ typedef struct SDL_JoyBallEvent
 typedef struct SDL_JoyHatEvent
 {
     Uint32 type;        /**< ::SDL_JOYHATMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 hat;          /**< The joystick hat index */
     Uint8 value;        /**< The hat position value.
@@ -328,7 +331,7 @@ typedef struct SDL_JoyHatEvent
 typedef struct SDL_JoyButtonEvent
 {
     Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 button;       /**< The joystick button index */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
@@ -342,7 +345,7 @@ typedef struct SDL_JoyButtonEvent
 typedef struct SDL_JoyDeviceEvent
 {
     Uint32 type;        /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
 } SDL_JoyDeviceEvent;
 
@@ -353,7 +356,7 @@ typedef struct SDL_JoyDeviceEvent
 typedef struct SDL_ControllerAxisEvent
 {
     Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 axis;         /**< The controller axis (SDL_GameControllerAxis) */
     Uint8 padding1;
@@ -370,7 +373,7 @@ typedef struct SDL_ControllerAxisEvent
 typedef struct SDL_ControllerButtonEvent
 {
     Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 button;       /**< The controller button (SDL_GameControllerButton) */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
@@ -385,7 +388,7 @@ typedef struct SDL_ControllerButtonEvent
 typedef struct SDL_ControllerDeviceEvent
 {
     Uint32 type;        /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
 } SDL_ControllerDeviceEvent;
 
@@ -395,7 +398,7 @@ typedef struct SDL_ControllerDeviceEvent
 typedef struct SDL_AudioDeviceEvent
 {
     Uint32 type;        /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 which;       /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
     Uint8 iscapture;    /**< zero if an output device, non-zero if a capture device. */
     Uint8 padding1;
@@ -410,7 +413,7 @@ typedef struct SDL_AudioDeviceEvent
 typedef struct SDL_TouchFingerEvent
 {
     Uint32 type;        /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_TouchID touchId; /**< The touch device id */
     SDL_FingerID fingerId;
     float x;            /**< Normalized in the range 0...1 */
@@ -427,8 +430,8 @@ typedef struct SDL_TouchFingerEvent
 typedef struct SDL_MultiGestureEvent
 {
     Uint32 type;        /**< ::SDL_MULTIGESTURE */
-    Uint32 timestamp;
-    SDL_TouchID touchId; /**< The touch device index */
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    SDL_TouchID touchId; /**< The touch device id */
     float dTheta;
     float dDist;
     float x;
@@ -444,7 +447,7 @@ typedef struct SDL_MultiGestureEvent
 typedef struct SDL_DollarGestureEvent
 {
     Uint32 type;        /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_TouchID touchId; /**< The touch device id */
     SDL_GestureID gestureId;
     Uint32 numFingers;
@@ -461,9 +464,10 @@ typedef struct SDL_DollarGestureEvent
  */
 typedef struct SDL_DropEvent
 {
-    Uint32 type;        /**< ::SDL_DROPFILE */
-    Uint32 timestamp;
-    char *file;         /**< The file name, which should be freed with SDL_free() */
+    Uint32 type;        /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    char *file;         /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
+    Uint32 windowID;    /**< The window that was dropped on, if any */
 } SDL_DropEvent;
 
 
@@ -473,7 +477,7 @@ typedef struct SDL_DropEvent
 typedef struct SDL_QuitEvent
 {
     Uint32 type;        /**< ::SDL_QUIT */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
 } SDL_QuitEvent;
 
 /**
@@ -482,7 +486,7 @@ typedef struct SDL_QuitEvent
 typedef struct SDL_OSEvent
 {
     Uint32 type;        /**< ::SDL_QUIT */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
 } SDL_OSEvent;
 
 /**
@@ -491,7 +495,7 @@ typedef struct SDL_OSEvent
 typedef struct SDL_UserEvent
 {
     Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The associated window if any */
     Sint32 code;        /**< User defined event code */
     void *data1;        /**< User defined data pointer */
@@ -511,7 +515,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg;
 typedef struct SDL_SysWMEvent
 {
     Uint32 type;        /**< ::SDL_SYSWMEVENT */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
 } SDL_SysWMEvent;
 
@@ -720,7 +724,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
 /**
  *  This function allows you to set the state of processing certain events.
  *   - If \c state is set to ::SDL_IGNORE, that event will be automatically
- *     dropped from the event queue and will not event be filtered.
+ *     dropped from the event queue and will not be filtered.
  *   - If \c state is set to ::SDL_ENABLE, that event will be processed
  *     normally.
  *   - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
@@ -745,6 +749,6 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_events_h */
+#endif /* SDL_events_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_filesystem.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  \brief Include file for filesystem SDL API functions
  */
 
-#ifndef _SDL_filesystem_h
-#define _SDL_filesystem_h
+#ifndef SDL_filesystem_h_
+#define SDL_filesystem_h_
 
 #include "SDL_stdinc.h"
 
@@ -131,6 +131,6 @@ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_filesystem_h */
+#endif /* SDL_filesystem_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 60 - 16
sdl.mod/SDL/include/SDL_gamecontroller.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL game controller event handling
  */
 
-#ifndef _SDL_gamecontroller_h
-#define _SDL_gamecontroller_h
+#ifndef SDL_gamecontroller_h_
+#define SDL_gamecontroller_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -51,7 +51,9 @@ extern "C" {
  *  SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
  */
 
-/* The gamecontroller structure used to identify an SDL game controller */
+/**
+ * The gamecontroller structure used to identify an SDL game controller
+ */
 struct _SDL_GameController;
 typedef struct _SDL_GameController SDL_GameController;
 
@@ -87,13 +89,13 @@ typedef struct SDL_GameControllerButtonBind
  *  To count the number of game controllers in the system for the following:
  *  int nJoysticks = SDL_NumJoysticks();
  *  int nGameControllers = 0;
- *  for ( int i = 0; i < nJoysticks; i++ ) {
- *      if ( SDL_IsGameController(i) ) {
+ *  for (int i = 0; i < nJoysticks; i++) {
+ *      if (SDL_IsGameController(i)) {
  *          nGameControllers++;
  *      }
  *  }
  *
- *  Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
+ *  Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
  *  guid,name,mappings
  *
  *  Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
@@ -105,7 +107,7 @@ typedef struct SDL_GameControllerButtonBind
  *  Buttons can be used as a controller axis and vice versa.
  *
  *  This string shows an example of a valid mapping for a controller
- *  "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
+ *  "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
  *
  */
 
@@ -117,7 +119,7 @@ typedef struct SDL_GameControllerButtonBind
  * 
  * \return number of mappings added, -1 on error
  */
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw );
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
 
 /**
  *  Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
@@ -131,28 +133,41 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw,
  *
  * \return 1 if mapping is added, 0 if updated, -1 on error
  */
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
+
+/**
+ *  Get the number of mappings installed
+ *
+ *  \return the number of mappings
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
+
+/**
+ *  Get the mapping at a particular index.
+ *
+ *  \return the mapping string.  Must be freed with SDL_free().  Returns NULL if the index is out of range.
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
 
 /**
  *  Get a mapping string for a GUID
  *
- *  \return the mapping string.  Must be freed with SDL_free.  Returns NULL if no mapping is available
+ *  \return the mapping string.  Must be freed with SDL_free().  Returns NULL if no mapping is available
  */
-extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid );
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid);
 
 /**
  *  Get a mapping string for an open GameController
  *
- *  \return the mapping string.  Must be freed with SDL_free.  Returns NULL if no mapping is available
+ *  \return the mapping string.  Must be freed with SDL_free().  Returns NULL if no mapping is available
  */
-extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller );
+extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller);
 
 /**
  *  Is the joystick on this index supported by the game controller interface?
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
 
-
 /**
  *  Get the implementation dependent name of a game controller.
  *  This can be called before any controllers are opened.
@@ -171,11 +186,34 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_
  */
 extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
 
+/**
+ * Return the SDL_GameController associated with an instance id.
+ */
+extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
+
 /**
  *  Return the name for this currently opened controller
  */
 extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
 
+/**
+ *  Get the USB vendor ID of an opened controller, if available.
+ *  If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
+
+/**
+ *  Get the USB product ID of an opened controller, if available.
+ *  If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
+
+/**
+ *  Get the product version of an opened controller, if available.
+ *  If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
+
 /**
  *  Returns SDL_TRUE if the controller has been opened and currently connected,
  *  or SDL_FALSE if it has not.
@@ -209,6 +247,12 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
 
 /**
  *  The list of axes available from a controller
+ *
+ *  Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
+ *  and are centered within ~8000 of zero, though advanced UI will allow users to set
+ *  or autodetect the dead zone, which varies between controllers.
+ *
+ *  Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
  */
 typedef enum
 {
@@ -313,6 +357,6 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_gamecontroller_h */
+#endif /* SDL_gamecontroller_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_gesture.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL gesture event handling.
  */
 
-#ifndef _SDL_gesture_h
-#define _SDL_gesture_h
+#ifndef SDL_gesture_h_
+#define SDL_gesture_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -82,6 +82,6 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_gesture_h */
+#endif /* SDL_gesture_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 40 - 36
sdl.mod/SDL/include/SDL_haptic.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -22,12 +22,12 @@
 /**
  *  \file SDL_haptic.h
  *
- *  \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
+ *  \brief The SDL haptic subsystem allows you to control haptic (force feedback)
  *         devices.
  *
  *  The basic usage is as follows:
- *   - Initialize the Subsystem (::SDL_INIT_HAPTIC).
- *   - Open a Haptic Device.
+ *   - Initialize the subsystem (::SDL_INIT_HAPTIC).
+ *   - Open a haptic device.
  *    - SDL_HapticOpen() to open from index.
  *    - SDL_HapticOpenFromJoystick() to open from an existing joystick.
  *   - Create an effect (::SDL_HapticEffect).
@@ -104,8 +104,8 @@
  * \endcode
  */
 
-#ifndef _SDL_haptic_h
-#define _SDL_haptic_h
+#ifndef SDL_haptic_h_
+#define SDL_haptic_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -149,7 +149,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticCondition
  */
-#define SDL_HAPTIC_CONSTANT   (1<<0)
+#define SDL_HAPTIC_CONSTANT   (1u<<0)
 
 /**
  *  \brief Sine wave effect supported.
@@ -158,7 +158,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticPeriodic
  */
-#define SDL_HAPTIC_SINE       (1<<1)
+#define SDL_HAPTIC_SINE       (1u<<1)
 
 /**
  *  \brief Left/Right effect supported.
@@ -169,7 +169,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
  *          we ran out of bits, and this is important for XInput devices.
  */
-#define SDL_HAPTIC_LEFTRIGHT     (1<<2)
+#define SDL_HAPTIC_LEFTRIGHT     (1u<<2)
 
 /* !!! FIXME: put this back when we have more bits in 2.1 */
 /* #define SDL_HAPTIC_SQUARE     (1<<2) */
@@ -181,7 +181,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticPeriodic
  */
-#define SDL_HAPTIC_TRIANGLE   (1<<3)
+#define SDL_HAPTIC_TRIANGLE   (1u<<3)
 
 /**
  *  \brief Sawtoothup wave effect supported.
@@ -190,7 +190,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticPeriodic
  */
-#define SDL_HAPTIC_SAWTOOTHUP (1<<4)
+#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
 
 /**
  *  \brief Sawtoothdown wave effect supported.
@@ -199,7 +199,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticPeriodic
  */
-#define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
+#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
 
 /**
  *  \brief Ramp effect supported.
@@ -208,7 +208,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticRamp
  */
-#define SDL_HAPTIC_RAMP       (1<<6)
+#define SDL_HAPTIC_RAMP       (1u<<6)
 
 /**
  *  \brief Spring effect supported - uses axes position.
@@ -218,7 +218,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticCondition
  */
-#define SDL_HAPTIC_SPRING     (1<<7)
+#define SDL_HAPTIC_SPRING     (1u<<7)
 
 /**
  *  \brief Damper effect supported - uses axes velocity.
@@ -228,7 +228,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticCondition
  */
-#define SDL_HAPTIC_DAMPER     (1<<8)
+#define SDL_HAPTIC_DAMPER     (1u<<8)
 
 /**
  *  \brief Inertia effect supported - uses axes acceleration.
@@ -238,7 +238,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticCondition
  */
-#define SDL_HAPTIC_INERTIA    (1<<9)
+#define SDL_HAPTIC_INERTIA    (1u<<9)
 
 /**
  *  \brief Friction effect supported - uses axes movement.
@@ -248,14 +248,14 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticCondition
  */
-#define SDL_HAPTIC_FRICTION   (1<<10)
+#define SDL_HAPTIC_FRICTION   (1u<<10)
 
 /**
  *  \brief Custom effect is supported.
  *
  *  User defined custom haptic effect.
  */
-#define SDL_HAPTIC_CUSTOM     (1<<11)
+#define SDL_HAPTIC_CUSTOM     (1u<<11)
 
 /* @} *//* Haptic effects */
 
@@ -268,7 +268,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticSetGain
  */
-#define SDL_HAPTIC_GAIN       (1<<12)
+#define SDL_HAPTIC_GAIN       (1u<<12)
 
 /**
  *  \brief Device can set autocenter.
@@ -277,24 +277,26 @@ typedef struct _SDL_Haptic SDL_Haptic;
  *
  *  \sa SDL_HapticSetAutocenter
  */
-#define SDL_HAPTIC_AUTOCENTER (1<<13)
+#define SDL_HAPTIC_AUTOCENTER (1u<<13)
 
 /**
  *  \brief Device can be queried for effect status.
  *
- *  Device can be queried for effect status.
+ *  Device supports querying effect status.
  *
  *  \sa SDL_HapticGetEffectStatus
  */
-#define SDL_HAPTIC_STATUS     (1<<14)
+#define SDL_HAPTIC_STATUS     (1u<<14)
 
 /**
  *  \brief Device can be paused.
  *
+ *  Devices supports being paused.
+ *
  *  \sa SDL_HapticPause
  *  \sa SDL_HapticUnpause
  */
-#define SDL_HAPTIC_PAUSE      (1<<15)
+#define SDL_HAPTIC_PAUSE      (1u<<15)
 
 
 /**
@@ -444,7 +446,7 @@ typedef struct SDL_HapticDirection
 /**
  *  \brief A structure containing a template for a Constant effect.
  *
- *  The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
+ *  This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
  *
  *  A constant effect applies a constant force in the specified direction
  *  to the joystick.
@@ -676,6 +678,8 @@ typedef struct SDL_HapticLeftRight
 /**
  *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
  *
+ *  This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
+ *
  *  A custom force feedback effect is much like a periodic effect, where the
  *  application can define its exact shape.  You will have to allocate the
  *  data yourself.  Data should consist of channels * samples Uint16 samples.
@@ -804,7 +808,7 @@ typedef union SDL_HapticEffect
 extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
 
 /**
- *  \brief Get the implementation dependent name of a Haptic device.
+ *  \brief Get the implementation dependent name of a haptic device.
  *
  *  This can be called before any joysticks are opened.
  *  If no name can be found, this function returns NULL.
@@ -817,9 +821,9 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
 
 /**
- *  \brief Opens a Haptic device for usage.
+ *  \brief Opens a haptic device for use.
  *
- *  The index passed as an argument refers to the N'th Haptic device on this
+ *  The index passed as an argument refers to the N'th haptic device on this
  *  system.
  *
  *  When opening a haptic device, its gain will be set to maximum and
@@ -885,15 +889,15 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
  *  \brief Checks to see if a joystick has haptic features.
  *
  *  \param joystick Joystick to test for haptic capabilities.
- *  \return 1 if the joystick is haptic, 0 if it isn't
- *          or -1 if an error ocurred.
+ *  \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
+ *          or -1 if an error occurred.
  *
  *  \sa SDL_HapticOpenFromJoystick
  */
 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
 
 /**
- *  \brief Opens a Haptic device for usage from a Joystick device.
+ *  \brief Opens a haptic device for use from a joystick device.
  *
  *  You must still close the haptic device separately.  It will not be closed
  *  with the joystick.
@@ -913,7 +917,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
                                                                joystick);
 
 /**
- *  \brief Closes a Haptic device previously opened with SDL_HapticOpen().
+ *  \brief Closes a haptic device previously opened with SDL_HapticOpen().
  *
  *  \param haptic Haptic device to close.
  */
@@ -957,7 +961,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
  *  Example:
  *  \code
  *  if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
- *      printf("We have constant haptic effect!");
+ *      printf("We have constant haptic effect!\n");
  *  }
  *  \endcode
  *
@@ -996,7 +1000,7 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
  *
  *  \param haptic Haptic device to create the effect on.
  *  \param effect Properties of the effect to create.
- *  \return The id of the effect on success or -1 on error.
+ *  \return The identifier of the effect on success or -1 on error.
  *
  *  \sa SDL_HapticUpdateEffect
  *  \sa SDL_HapticRunEffect
@@ -1008,13 +1012,13 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
 /**
  *  \brief Updates the properties of an effect.
  *
- *  Can be used dynamically, although behaviour when dynamically changing
+ *  Can be used dynamically, although behavior when dynamically changing
  *  direction may be strange.  Specifically the effect may reupload itself
  *  and start playing from the start.  You cannot change the type either when
  *  running SDL_HapticUpdateEffect().
  *
  *  \param haptic Haptic device that has the effect.
- *  \param effect Effect to update.
+ *  \param effect Identifier of the effect to update.
  *  \param data New effect properties to use.
  *  \return 0 on success or -1 on error.
  *
@@ -1218,6 +1222,6 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_haptic_h */
+#endif /* SDL_haptic_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 304 - 25
sdl.mod/SDL/include/SDL_hints.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -36,8 +36,8 @@
  *  to how they would like the library to work.
  */
 
-#ifndef _SDL_hints_h
-#define _SDL_hints_h
+#ifndef SDL_hints_h_
+#define SDL_hints_h_
 
 #include "SDL_stdinc.h"
 
@@ -76,6 +76,7 @@ extern "C" {
  *    "opengl"
  *    "opengles2"
  *    "opengles"
+ *    "metal"
  *    "software"
  *
  *  The default varies by platform, but it's the first one in the list that
@@ -118,6 +119,17 @@ extern "C" {
  */
 #define SDL_HINT_RENDER_DIRECT3D11_DEBUG    "SDL_RENDER_DIRECT3D11_DEBUG"
 
+/**
+ *  \brief  A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
+ *
+ *  This variable can be set to the following values:
+ *    "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
+ *    "1" or "overscan"  - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
+ *
+ *  By default letterbox is used
+ */
+#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE       "SDL_RENDER_LOGICAL_SIZE_MODE"
+
 /**
  *  \brief  A variable controlling the scaling quality
  *
@@ -210,6 +222,12 @@ extern "C" {
  */
 #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN    "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
 
+/**
+ * \brief A variable to specify custom icon resource id from RC file on Windows platform 
+ */
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON       "SDL_WINDOWS_INTRESOURCE_ICON"
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
+
 /**
  *  \brief  A variable controlling whether the windows message loop is processed by SDL 
  *
@@ -233,16 +251,48 @@ extern "C" {
 #define SDL_HINT_GRAB_KEYBOARD              "SDL_GRAB_KEYBOARD"
 
 /**
-*  \brief  A variable controlling whether relative mouse mode is implemented using mouse warping
-*
-*  This variable can be set to the following values:
-*    "0"       - Relative mouse mode uses raw input
-*    "1"       - Relative mouse mode uses mouse warping
-*
-*  By default SDL will use raw input for relative mouse mode
-*/
+ *  \brief  A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
+ */
+#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE    "SDL_MOUSE_NORMAL_SPEED_SCALE"
+
+/**
+ *  \brief  A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE    "SDL_MOUSE_RELATIVE_SPEED_SCALE"
+
+/**
+ *  \brief  A variable controlling whether relative mouse mode is implemented using mouse warping
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Relative mouse mode uses raw input
+ *    "1"       - Relative mouse mode uses mouse warping
+ *
+ *  By default SDL will use raw input for relative mouse mode
+ */
 #define SDL_HINT_MOUSE_RELATIVE_MODE_WARP    "SDL_MOUSE_RELATIVE_MODE_WARP"
 
+/**
+ *  \brief Allow mouse click events when clicking to focus an SDL window
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Ignore mouse clicks that activate a window
+ *    "1"       - Generate events for mouse clicks that activate a window
+ *
+ *  By default SDL will ignore mouse clicks that activate a window
+ */
+#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
+
+/**
+ *  \brief  A variable controlling whether touch events should generate synthetic mouse events
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Touch events will not generate mouse events
+ *    "1"       - Touch events will generate mouse events
+ *
+ *  By default SDL will generate mouse events for touch events
+ */
+#define SDL_HINT_TOUCH_MOUSE_EVENTS    "SDL_TOUCH_MOUSE_EVENTS"
+
 /**
  *  \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
  *
@@ -257,8 +307,8 @@ extern "C" {
  *  this is problematic. This functionality can be disabled by setting this
  *  hint.
  *
- *  As of SDL 2.0.4, SDL_EnableScreenSaver and SDL_DisableScreenSaver accomplish
- *  the same thing on iOS. They should be preferred over this hint.
+ *  As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver()
+ *  accomplish the same thing on iOS. They should be preferred over this hint.
  *
  *  This variable can be set to the following values:
  *    "0"       - Enable idle timer
@@ -276,7 +326,35 @@ extern "C" {
  *    "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
  */
 #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
-    
+
+/**
+ *  \brief  A variable controlling whether controllers used with the Apple TV
+ *  generate UI events.
+ *
+ * When UI events are generated by controller input, the app will be
+ * backgrounded when the Apple TV remote's menu button is pressed, and when the
+ * pause or B buttons on gamepads are pressed.
+ *
+ * More information about properly making use of controllers for the Apple TV
+ * can be found here:
+ * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Controller input does not generate UI events (the default).
+ *    "1"       - Controller input generates UI events.
+ */
+#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"
+
+/**
+ * \brief  A variable controlling whether the Apple TV remote's joystick axes
+ *         will automatically match the rotation of the remote.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Remote orientation does not affect joystick axes (the default).
+ *    "1"       - Joystick axes are based on the orientation of the remote.
+ */
+#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
+
 /**
  *  \brief  A variable controlling whether the Android / iOS built-in
  *  accelerometer should be listed as a joystick device, rather than listing
@@ -288,7 +366,6 @@ extern "C" {
  */
 #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
 
-
 /**
  *  \brief  A variable that lets you disable the detection and use of Xinput gamepad devices
  *
@@ -298,7 +375,6 @@ extern "C" {
  */
 #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
 
-
 /**
  *  \brief  A variable that causes SDL to use the old axis and button mapping for XInput devices.
  *
@@ -308,9 +384,8 @@ extern "C" {
  */
 #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
 
-
 /**
- *  \brief  A variable that lets you manually hint extra gamecontroller db entries
+ *  \brief  A variable that lets you manually hint extra gamecontroller db entries.
  *
  *  The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
  *
@@ -319,6 +394,31 @@ extern "C" {
  */
 #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
 
+/**
+ *  \brief  A variable containing a list of devices to skip when scanning for game controllers.
+ *
+ *  The format of the string is a comma separated list of USB VID/PID pairs
+ *  in hexadecimal form, e.g.
+ *
+ *      0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ *  The variable can also take the form of @file, in which case the named
+ *  file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
+
+/**
+ *  \brief  If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
+ *
+ *  The format of the string is a comma separated list of USB VID/PID pairs
+ *  in hexadecimal form, e.g.
+ *
+ *      0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ *  The variable can also take the form of @file, in which case the named
+ *  file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
 
 /**
  *  \brief  A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
@@ -333,7 +433,6 @@ extern "C" {
  */
 #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
 
-
 /**
  *  \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
  *      This is a debugging aid for developers and not expected to be used by end users. The default is "1"
@@ -344,7 +443,6 @@ extern "C" {
  */
 #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
 
-
 /**
  *  \brief A variable that controls the timer resolution, in milliseconds.
  *
@@ -362,6 +460,33 @@ extern "C" {
 #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
 
 
+/**
+ *  \brief  A variable describing the content orientation on QtWayland-based platforms.
+ *
+ *  On QtWayland platforms, windows are rotated client-side to allow for custom
+ *  transitions. In order to correctly position overlays (e.g. volume bar) and
+ *  gestures (e.g. events view, close/minimize gestures), the system needs to
+ *  know in which orientation the application is currently drawing its contents.
+ *
+ *  This does not cause the window to be rotated or resized, the application
+ *  needs to take care of drawing the content in the right orientation (the
+ *  framebuffer is always in portrait mode).
+ *
+ *  This variable can be one of the following values:
+ *    "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
+ */
+#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
+
+/**
+ *  \brief  Flags to set on QtWayland windows to integrate with the native window manager.
+ *
+ *  On QtWayland platforms, this hint controls the flags to set on the windows.
+ *  For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.
+ *
+ *  This variable is a space-separated list of the following values (empty = no flags):
+ *    "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"
+ */
+#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
 
 /**
 *  \brief  A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
@@ -369,7 +494,7 @@ extern "C" {
 *  Use this hint in case you need to set SDL's threads stack size to other than the default.
 *  This is specially useful if you build SDL against a non glibc libc library (such as musl) which
 *  provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
-*  Support for this hint is currently available only in the pthread backend.
+*  Support for this hint is currently available only in the pthread, Windows, and PSP backend.
 */
 #define SDL_HINT_THREAD_STACK_SIZE              "SDL_THREAD_STACK_SIZE"
 
@@ -431,7 +556,7 @@ extern "C" {
  *  privacy policy.
  *
  *  To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
- *  before calling any SDL_Init functions.  The contents of the hint should
+ *  before calling any SDL_Init() functions.  The contents of the hint should
  *  be a valid URL.  For example, "http://www.example.com".
  *
  *  The default value is "", which will prevent SDL from adding a privacy policy
@@ -461,7 +586,7 @@ extern "C" {
  *  The contents of this hint should be encoded as a UTF8 string.
  *
  *  The default value is "Privacy Policy".  This hint should only be set during app
- *  initialization, preferably before any calls to SDL_Init.
+ *  initialization, preferably before any calls to SDL_Init().
  *
  *  For additional information on linking to a privacy policy, see the documentation for
  *  SDL_HINT_WINRT_PRIVACY_POLICY_URL.
@@ -595,6 +720,18 @@ extern "C" {
  */
 #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
 
+ /**
+ * \brief A variable to control whether the return key on the soft keyboard
+ *        should hide the soft keyboard on Android and iOS.
+ *
+ * The variable can be set to the following values:
+ *   "0"       - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default)
+ *   "1"       - The return key will hide the keyboard.
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME"
+
 /**
  *  \brief override the binding element for keyboard inputs for Emscripten builds
  *
@@ -630,6 +767,137 @@ extern "C" {
  */
 #define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4	"SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
 
+/**
+ *  \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
+ *
+ * The bitmap header version 4 is required for proper alpha channel support and
+ * SDL will use it when required. Should this not be desired, this hint can
+ * force the use of the 40 byte header version which is supported everywhere.
+ *
+ * The variable can be set to the following values:
+ *   "0"       - Surfaces with a colorkey or an alpha channel are saved to a
+ *               32-bit BMP file with an alpha mask. SDL will use the bitmap
+ *               header version 4 and set the alpha mask accordingly.
+ *   "1"       - Surfaces with a colorkey or an alpha channel are saved to a
+ *               32-bit BMP file without an alpha mask. The alpha channel data
+ *               will be in the file, but applications are going to ignore it.
+ *
+ * The default value is "0".
+ */
+#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
+
+/**
+ * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
+ *        The 0x406D1388 Exception is a trick used to inform Visual Studio of a
+ *        thread's name, but it tends to cause problems with other debuggers,
+ *        and the .NET runtime. Note that SDL 2.0.6 and later will still use
+ *        the (safer) SetThreadDescription API, introduced in the Windows 10
+ *        Creators Update, if available.
+ *
+ * The variable can be set to the following values:
+ *   "0"       - SDL will raise the 0x406D1388 Exception to name threads.
+ *               This is the default behavior of SDL <= 2.0.4.
+ *   "1"       - SDL will not raise this exception, and threads will be unnamed. (default)
+ *               This is necessary with .NET languages or debuggers that aren't Visual Studio.
+ */
+#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
+
+/**
+ * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI
+ *
+ * Also known as Z-order. The variable can take a negative or positive value.
+ * The default is 10000.
+ */
+#define SDL_HINT_RPI_VIDEO_LAYER           "SDL_RPI_VIDEO_LAYER"
+
+/**
+ * \brief Tell the video driver that we only want a double buffer.
+ *
+ * By default, most lowlevel 2D APIs will use a triple buffer scheme that 
+ * wastes no CPU time on waiting for vsync after issuing a flip, but
+ * introduces a frame of latency. On the other hand, using a double buffer
+ * scheme instead is recommended for cases where low latency is an important
+ * factor because we save a whole frame of latency.
+ * We do so by waiting for vsync immediately after issuing a flip, usually just
+ * after eglSwapBuffers call in the backend's *_SwapWindow function.
+ *
+ * Since it's driver-specific, it's only supported where possible and
+ * implemented. Currently supported the following drivers:
+ * - KMSDRM (kmsdrm)
+ * - Raspberry Pi (raspberrypi)
+ */
+#define SDL_HINT_VIDEO_DOUBLE_BUFFER      "SDL_VIDEO_DOUBLE_BUFFER"
+
+/**
+ *  \brief  A variable controlling what driver to use for OpenGL ES contexts.
+ *
+ *  On some platforms, currently Windows and X11, OpenGL drivers may support
+ *  creating contexts with an OpenGL ES profile. By default SDL uses these
+ *  profiles, when available, otherwise it attempts to load an OpenGL ES
+ *  library, e.g. that provided by the ANGLE project. This variable controls
+ *  whether SDL follows this default behaviour or will always load an
+ *  OpenGL ES library.
+ *
+ *  Circumstances where this is useful include
+ *  - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
+ *    or emulator, e.g. those from ARM, Imagination or Qualcomm.
+ *  - Resolving OpenGL ES function addresses at link time by linking with
+ *    the OpenGL ES library instead of querying them at run time with
+ *    SDL_GL_GetProcAddress().
+ *
+ *  Caution: for an application to work with the default behaviour across
+ *  different OpenGL drivers it must query the OpenGL ES function
+ *  addresses at run time using SDL_GL_GetProcAddress().
+ *
+ *  This variable is ignored on most platforms because OpenGL ES is native
+ *  or not supported.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Use ES profile of OpenGL, if available. (Default when not set.)
+ *    "1"       - Load OpenGL ES library using the default library names.
+ *
+ */
+#define SDL_HINT_OPENGL_ES_DRIVER   "SDL_OPENGL_ES_DRIVER"
+
+/**
+ *  \brief  A variable controlling speed/quality tradeoff of audio resampling.
+ *
+ *  If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
+ *  to handle audio resampling. There are different resampling modes available
+ *  that produce different levels of quality, using more CPU.
+ *
+ *  If this hint isn't specified to a valid setting, or libsamplerate isn't
+ *  available, SDL will use the default, internal resampling algorithm.
+ *
+ *  Note that this is currently only applicable to resampling audio that is
+ *  being written to a device for playback or audio being read from a device
+ *  for capture. SDL_AudioCVT always uses the default resampler (although this
+ *  might change for SDL 2.1).
+ *
+ *  This hint is currently only checked at audio subsystem initialization.
+ *
+ *  This variable can be set to the following values:
+ *
+ *    "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
+ *    "1" or "fast"    - Use fast, slightly higher quality resampling, if available
+ *    "2" or "medium"  - Use medium quality resampling, if available
+ *    "3" or "best"    - Use high quality resampling, if available
+ */
+#define SDL_HINT_AUDIO_RESAMPLING_MODE   "SDL_AUDIO_RESAMPLING_MODE"
+
+/**
+ *  \brief  A variable controlling the audio category on iOS and Mac OS X
+ *
+ *  This variable can be set to the following values:
+ *
+ *    "ambient"     - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
+ *    "playback"    - Use the AVAudioSessionCategoryPlayback category
+ *
+ *  For more information, see Apple's documentation:
+ *  https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
+ */
+#define SDL_HINT_AUDIO_CATEGORY   "SDL_AUDIO_CATEGORY"
+
 /**
  *  \brief  An enumeration of hint priorities
  */
@@ -669,6 +937,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
  */
 extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
 
+/**
+ *  \brief Get a hint
+ *
+ *  \return The boolean value of a hint variable.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
+
+/**
+ * \brief type definition of the hint callback function.
+ */
+typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
+
 /**
  *  \brief Add a function to watch a particular hint
  *
@@ -676,7 +956,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
  *  \param callback The function to call when the hint value changes
  *  \param userdata A pointer to pass to the callback function
  */
-typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
 extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
                                                  SDL_HintCallback callback,
                                                  void *userdata);
@@ -706,6 +985,6 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_hints_h */
+#endif /* SDL_hints_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 127 - 14
sdl.mod/SDL/include/SDL_joystick.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,7 +24,7 @@
  *
  *  Include file for SDL joystick event handling
  *
- * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick
+ * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
  *   behind a device_index changing as joysticks are plugged and unplugged.
  *
  * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
@@ -36,8 +36,8 @@
  *
  */
 
-#ifndef _SDL_joystick_h
-#define _SDL_joystick_h
+#ifndef SDL_joystick_h_
+#define SDL_joystick_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -60,7 +60,9 @@ extern "C" {
  *  SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
  */
 
-/* The joystick structure used to identify an SDL joystick */
+/**
+ * The joystick structure used to identify an SDL joystick
+ */
 struct _SDL_Joystick;
 typedef struct _SDL_Joystick SDL_Joystick;
 
@@ -69,8 +71,29 @@ typedef struct {
     Uint8 data[16];
 } SDL_JoystickGUID;
 
+/**
+ * This is a unique ID for a joystick for the time it is connected to the system,
+ * and is never reused for the lifetime of the application. If the joystick is
+ * disconnected and reconnected, it will get a new ID.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
 typedef Sint32 SDL_JoystickID;
 
+typedef enum
+{
+    SDL_JOYSTICK_TYPE_UNKNOWN,
+    SDL_JOYSTICK_TYPE_GAMECONTROLLER,
+    SDL_JOYSTICK_TYPE_WHEEL,
+    SDL_JOYSTICK_TYPE_ARCADE_STICK,
+    SDL_JOYSTICK_TYPE_FLIGHT_STICK,
+    SDL_JOYSTICK_TYPE_DANCE_PAD,
+    SDL_JOYSTICK_TYPE_GUITAR,
+    SDL_JOYSTICK_TYPE_DRUM_KIT,
+    SDL_JOYSTICK_TYPE_ARCADE_PAD,
+    SDL_JOYSTICK_TYPE_THROTTLE
+} SDL_JoystickType;
+
 typedef enum
 {
     SDL_JOYSTICK_POWER_UNKNOWN = -1,
@@ -83,6 +106,20 @@ typedef enum
 } SDL_JoystickPowerLevel;
 
 /* Function prototypes */
+
+/**
+ * Locking for multi-threaded access to the joystick API
+ *
+ * If you are using the joystick API or handling events from multiple threads
+ * you should use these locking functions to protect access to the joysticks.
+ *
+ * In particular, you are guaranteed that the joystick list won't change, so
+ * the API functions that take a joystick index will be valid, and joystick
+ * and game controller events will not be delivered.
+ */
+extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
+extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
+
 /**
  *  Count the number of joysticks attached to the system right now
  */
@@ -95,6 +132,46 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
  */
 extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
 
+/**
+ *  Return the GUID for the joystick at this index
+ *  This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+
+/**
+ *  Get the USB vendor ID of a joystick, if available.
+ *  This can be called before any joysticks are opened.
+ *  If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
+
+/**
+ *  Get the USB product ID of a joystick, if available.
+ *  This can be called before any joysticks are opened.
+ *  If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
+
+/**
+ *  Get the product version of a joystick, if available.
+ *  This can be called before any joysticks are opened.
+ *  If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
+
+/**
+ *  Get the type of a joystick, if available.
+ *  This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
+
+/**
+ *  Get the instance ID of a joystick.
+ *  This can be called before any joysticks are opened.
+ *  If the index is out of range, this function will return -1.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
+
 /**
  *  Open a joystick for use.
  *  The index passed as an argument refers to the N'th joystick on the system.
@@ -106,6 +183,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
  */
 extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
 
+/**
+ * Return the SDL_Joystick associated with an instance id.
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
+
 /**
  *  Return the name for this currently opened joystick.
  *  If no name can be found, this function returns NULL.
@@ -113,14 +195,32 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
 extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
 
 /**
- *  Return the GUID for the joystick at this index
+ *  Return the GUID for this opened joystick
  */
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
 
 /**
- *  Return the GUID for this opened joystick
+ *  Get the USB vendor ID of an opened joystick, if available.
+ *  If the vendor ID isn't available this function returns 0.
  */
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
+
+/**
+ *  Get the USB product ID of an opened joystick, if available.
+ *  If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
+
+/**
+ *  Get the product version of an opened joystick, if available.
+ *  If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
+
+/**
+ *  Get the type of an opened joystick.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick);
 
 /**
  *  Return a string representation for this guid. pszGUID must point to at least 33 bytes
@@ -129,7 +229,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joys
 extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
 
 /**
- *  convert a string into a joystick formatted guid
+ *  Convert a string into a joystick guid
  */
 extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
 
@@ -185,6 +285,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
  */
 extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
 
+#define SDL_JOYSTICK_AXIS_MAX   32767
+#define SDL_JOYSTICK_AXIS_MIN   -32768
 /**
  *  Get the current state of an axis control on a joystick.
  *
@@ -195,6 +297,18 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
 extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
                                                    int axis);
 
+/**
+ *  Get the initial state of an axis control on a joystick.
+ *
+ *  The state is a value ranging from -32768 to 32767.
+ *
+ *  The axis indices start at index 0.
+ *
+ *  \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
+                                                   int axis, Sint16 *state);
+
 /**
  *  \name Hat positions
  */
@@ -253,17 +367,16 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
 extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
 
 /**
-*  Return the battery level of this joystick
-*/
+ *  Return the battery level of this joystick
+ */
 extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
 
-
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 }
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_joystick_h */
+#endif /* SDL_joystick_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 5 - 5
sdl.mod/SDL/include/SDL_keyboard.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL keyboard event handling
  */
 
-#ifndef _SDL_keyboard_h
-#define _SDL_keyboard_h
+#ifndef SDL_keyboard_h_
+#define SDL_keyboard_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -136,7 +136,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
  *          copy it.  If the key doesn't have a name, this function returns an
  *          empty string ("").
  *
- *  \sa SDL_Key
+ *  \sa SDL_Keycode
  */
 extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
 
@@ -212,6 +212,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_keyboard_h */
+#endif /* SDL_keyboard_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 13 - 5
sdl.mod/SDL/include/SDL_keycode.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Defines constants which identify keyboard keys and modifiers.
  */
 
-#ifndef _SDL_keycode_h
-#define _SDL_keycode_h
+#ifndef SDL_keycode_h_
+#define SDL_keycode_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_scancode.h"
@@ -38,6 +38,9 @@
  *  layout of the keyboard.  These values include Unicode values representing
  *  the unmodified character that would be generated by pressing the key, or
  *  an SDLK_* constant for those keys that do not generate characters.
+ *
+ *  A special exception is the number keys at the top of the keyboard which
+ *  always map to SDLK_0...SDLK_9, regardless of layout.
  */
 typedef Sint32 SDL_Keycode;
 
@@ -308,7 +311,12 @@ enum
     SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
     SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
     SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
-    SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
+    SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
+    SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
+    SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
+
+    SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
+    SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
 };
 
 /**
@@ -336,6 +344,6 @@ typedef enum
 #define KMOD_ALT    (KMOD_LALT|KMOD_RALT)
 #define KMOD_GUI    (KMOD_LGUI|KMOD_RGUI)
 
-#endif /* _SDL_keycode_h */
+#endif /* SDL_keycode_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_loadso.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -38,8 +38,8 @@
  *      the results you expect. :)
  */
 
-#ifndef _SDL_loadso_h
-#define _SDL_loadso_h
+#ifndef SDL_loadso_h_
+#define SDL_loadso_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -76,6 +76,6 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_loadso_h */
+#endif /* SDL_loadso_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 5 - 5
sdl.mod/SDL/include/SDL_log.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -34,8 +34,8 @@
  *      Others: standard error output (stderr)
  */
 
-#ifndef _SDL_log_h
-#define _SDL_log_h
+#ifndef SDL_log_h_
+#define SDL_log_h_
 
 #include "SDL_stdinc.h"
 
@@ -186,7 +186,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
 /**
  *  \brief The prototype for the log output function
  */
-typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
 
 /**
  *  \brief Get the current log output function.
@@ -206,6 +206,6 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_log_h */
+#endif /* SDL_log_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 13 - 6
sdl.mod/SDL/include/SDL_main.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_main_h
-#define _SDL_main_h
+#ifndef SDL_main_h_
+#define SDL_main_h_
 
 #include "SDL_stdinc.h"
 
@@ -63,10 +63,13 @@
 /* On Android SDL provides a Java class in SDLActivity.java that is the
    main activity entry point.
 
-   See README-android.txt for more details on extending that class.
+   See docs/README-android.md for more details on extending that class.
  */
 #define SDL_MAIN_NEEDED
 
+/* We need to export SDL_main so it can be launched from Java */
+#define SDLMAIN_DECLSPEC    DECLSPEC
+
 #elif defined(__NACL__)
 /* On NACL we use ppapi_simple to set up the application helper code,
    then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before 
@@ -85,6 +88,10 @@
 #define C_LINKAGE
 #endif /* __cplusplus */
 
+#ifndef SDLMAIN_DECLSPEC
+#define SDLMAIN_DECLSPEC
+#endif
+
 /**
  *  \file SDL_main.h
  *
@@ -107,7 +114,7 @@
 /**
  *  The prototype for the application's main() function
  */
-extern C_LINKAGE int SDL_main(int argc, char *argv[]);
+extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
 
 
 #include "begin_code.h"
@@ -156,6 +163,6 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), v
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_main_h */
+#endif /* SDL_main_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_messagebox.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_messagebox_h
-#define _SDL_messagebox_h
+#ifndef SDL_messagebox_h_
+#define SDL_messagebox_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_video.h"      /* For SDL_Window */
@@ -139,6 +139,6 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_messagebox_h */
+#endif /* SDL_messagebox_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 9 - 7
sdl.mod/SDL/include/SDL_mouse.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL mouse event handling.
  */
 
-#ifndef _SDL_mouse_h
-#define _SDL_mouse_h
+#ifndef SDL_mouse_h_
+#define SDL_mouse_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -38,10 +38,10 @@
 extern "C" {
 #endif
 
-typedef struct SDL_Cursor SDL_Cursor;   /* Implementation dependent */
+typedef struct SDL_Cursor SDL_Cursor;   /**< Implementation dependent */
 
 /**
- * \brief Cursor types for SDL_CreateSystemCursor.
+ * \brief Cursor types for SDL_CreateSystemCursor().
  */
 typedef enum
 {
@@ -254,9 +254,11 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
 extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
 
 /**
- *  \brief Frees a cursor created with SDL_CreateCursor().
+ *  \brief Frees a cursor created with SDL_CreateCursor() or similar functions.
  *
  *  \sa SDL_CreateCursor()
+ *  \sa SDL_CreateColorCursor()
+ *  \sa SDL_CreateSystemCursor()
  */
 extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
 
@@ -295,6 +297,6 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_mouse_h */
+#endif /* SDL_mouse_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_mutex.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_mutex_h
-#define _SDL_mutex_h
+#ifndef SDL_mutex_h_
+#define SDL_mutex_h_
 
 /**
  *  \file SDL_mutex.h
@@ -246,6 +246,6 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_mutex_h */
+#endif /* SDL_mutex_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_name.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDLname_h_
-#define _SDLname_h_
+#ifndef SDLname_h_
+#define SDLname_h_
 
 #if defined(__STDC__) || defined(__cplusplus)
 #define NeedFunctionPrototypes 1
@@ -28,6 +28,6 @@
 
 #define SDL_NAME(X) SDL_##X
 
-#endif /* _SDLname_h_ */
+#endif /* SDLname_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 4
sdl.mod/SDL/include/SDL_opengl.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -32,8 +32,8 @@
  *  version included in SDL_opengl.h.
  */
 
-#ifndef _SDL_opengl_h
-#define _SDL_opengl_h
+#ifndef SDL_opengl_h_
+#define SDL_opengl_h_
 
 #include "SDL_config.h"
 
@@ -97,6 +97,13 @@
 #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
 #  define GLAPI extern
 #  define GLAPIENTRY __stdcall
+#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
+#  define GLAPI extern
+#  define GLAPIENTRY _System
+#  define APIENTRY _System
+#  if defined(__GNUC__) && !defined(_System)
+#    define _System
+#  endif
 #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #  define GLAPI __attribute__((visibility("default")))
 #  define GLAPIENTRY
@@ -2171,6 +2178,6 @@ typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum t
 
 #endif /* !__IPHONEOS__ */
 
-#endif /* _SDL_opengl_h */
+#endif /* SDL_opengl_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 2 - 1
sdl.mod/SDL/include/SDL_opengles.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,6 +24,7 @@
  *
  *  This is a simple file to encapsulate the OpenGL ES 1.X API headers.
  */
+#include "SDL_config.h"
 
 #ifdef __IPHONEOS__
 #include <OpenGLES/ES1/gl.h>

+ 3 - 1
sdl.mod/SDL/include/SDL_opengles2.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,6 +24,8 @@
  *
  *  This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
  */
+#include "SDL_config.h"
+
 #ifndef _MSC_VER
 
 #ifdef __IPHONEOS__

+ 21 - 5
sdl.mod/SDL/include/SDL_pixels.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,10 +25,11 @@
  *  Header for the enumerated pixel format definitions.
  */
 
-#ifndef _SDL_pixels_h
-#define _SDL_pixels_h
+#ifndef SDL_pixels_h_
+#define SDL_pixels_h_
 
 #include "SDL_stdinc.h"
+#include "SDL_endian.h"
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -260,6 +261,19 @@ enum
         SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
                                SDL_PACKEDLAYOUT_2101010, 32, 4),
 
+    /* Aliases for RGBA byte arrays of color data, for the current platform */
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+    SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888,
+    SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888,
+    SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888,
+    SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888,
+#else
+    SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
+    SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
+    SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
+    SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
+#endif
+
     SDL_PIXELFORMAT_YV12 =      /**< Planar mode: Y + V + U  (3 planes) */
         SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
     SDL_PIXELFORMAT_IYUV =      /**< Planar mode: Y + U + V  (3 planes) */
@@ -273,7 +287,9 @@ enum
     SDL_PIXELFORMAT_NV12 =      /**< Planar mode: Y + U/V interleaved  (2 planes) */
         SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
     SDL_PIXELFORMAT_NV21 =      /**< Planar mode: Y + V/U interleaved  (2 planes) */
-        SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
+        SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
+    SDL_PIXELFORMAT_EXTERNAL_OES =      /**< Android video texture format */
+        SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
 };
 
 typedef struct SDL_Color
@@ -449,6 +465,6 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_pixels_h */
+#endif /* SDL_pixels_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 37 - 20
sdl.mod/SDL/include/SDL_platform.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Try to get a standard set of platform defines.
  */
 
-#ifndef _SDL_platform_h
-#define _SDL_platform_h
+#ifndef SDL_platform_h_
+#define SDL_platform_h_
 
 #if defined(_AIX)
 #undef __AIX__
@@ -70,18 +70,22 @@
 /* lets us know what version of Mac OS X we're compiling on */
 #include "AvailabilityMacros.h"
 #include "TargetConditionals.h"
+#if TARGET_OS_TV
+#undef __TVOS__
+#define __TVOS__ 1
+#endif
 #if TARGET_OS_IPHONE
-/* if compiling for iPhone */
+/* if compiling for iOS */
 #undef __IPHONEOS__
 #define __IPHONEOS__ 1
 #undef __MACOSX__
 #else
-/* if not compiling for iPhone */
+/* if not compiling for iOS */
 #undef __MACOSX__
 #define __MACOSX__  1
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
-# error SDL for Mac OS X only supports deploying on 10.5 and above.
-#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# error SDL for Mac OS X only supports deploying on 10.6 and above.
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
 #endif /* TARGET_OS_IPHONE */
 #endif /* defined(__APPLE__) */
 
@@ -93,7 +97,7 @@
 #undef __OPENBSD__
 #define __OPENBSD__ 1
 #endif
-#if defined(__OS2__)
+#if defined(__OS2__) || defined(__EMX__)
 #undef __OS2__
 #define __OS2__     1
 #endif
@@ -116,21 +120,34 @@
 
 #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
 /* Try to find out if we're compiling for WinRT or non-WinRT */
-/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_)	/* _MSC_VER==1700 for MSVC 2012 */
+#if defined(_MSC_VER) && defined(__has_include)
+#if __has_include(<winapifamily.h>)
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_)    /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+#if HAVE_WINAPIFAMILY_H
 #include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#undef __WINDOWS__
-#define __WINDOWS__   1
-/* See if we're compiling for WinRT: */
-#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
 #undef __WINRT__
 #define __WINRT__ 1
-#endif
 #else
 #undef __WINDOWS__
-#define __WINDOWS__   1
-#endif /* _MSC_VER < 1700 */
+#define __WINDOWS__ 1
+#endif
 #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
 
 #if defined(__WINDOWS__)
@@ -176,6 +193,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_platform_h */
+#endif /* SDL_platform_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_power.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_power_h
-#define _SDL_power_h
+#ifndef SDL_power_h_
+#define SDL_power_h_
 
 /**
  *  \file SDL_power.h
@@ -70,6 +70,6 @@ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_power_h */
+#endif /* SDL_power_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_quit.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL quit event handling.
  */
 
-#ifndef _SDL_quit_h
-#define _SDL_quit_h
+#ifndef SDL_quit_h_
+#define SDL_quit_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -55,4 +55,4 @@
 #define SDL_QuitRequested() \
         (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
 
-#endif /* _SDL_quit_h */
+#endif /* SDL_quit_h_ */

+ 4 - 4
sdl.mod/SDL/include/SDL_rect.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header file for SDL_rect definition and management functions.
  */
 
-#ifndef _SDL_rect_h
-#define _SDL_rect_h
+#ifndef SDL_rect_h_
+#define SDL_rect_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -143,6 +143,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_rect_h */
+#endif /* SDL_rect_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 59 - 8
sdl.mod/SDL/include/SDL_render.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -45,8 +45,8 @@
  *  See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
  */
 
-#ifndef _SDL_render_h
-#define _SDL_render_h
+#ifndef SDL_render_h_
+#define SDL_render_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_rect.h"
@@ -215,7 +215,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
                                                 SDL_RendererInfo * info);
 
 /**
- *  \brief Get the output size of a rendering context.
+ *  \brief Get the output size in pixels of a rendering context.
  */
 extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
                                                       int *w, int *h);
@@ -233,6 +233,8 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
  *          active,  the format was unsupported, or the width or height were out
  *          of range.
  *
+ *  \note The contents of the texture are not defined at creation.
+ *
  *  \sa SDL_QueryTexture()
  *  \sa SDL_UpdateTexture()
  *  \sa SDL_DestroyTexture()
@@ -370,9 +372,12 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
  *  \param texture   The texture to update
  *  \param rect      A pointer to the rectangle of pixels to update, or NULL to
  *                   update the entire texture.
- *  \param pixels    The raw pixel data.
+ *  \param pixels    The raw pixel data in the format of the texture.
  *  \param pitch     The number of bytes in a row of pixel data, including padding between lines.
  *
+ *  The pixel data must be in the format of the texture. The pixel format can be
+ *  queried with SDL_QueryTexture.
+ *
  *  \return 0 on success, or -1 if the texture is not valid.
  *
  *  \note This is a fairly slow function.
@@ -499,6 +504,30 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in
  */
 extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
 
+/**
+ *  \brief Set whether to force integer scales for resolution-independent rendering
+ *
+ *  \param renderer The renderer for which integer scaling should be set.
+ *  \param enable   Enable or disable integer scaling
+ *
+ *  This function restricts the logical viewport to integer values - that is, when
+ *  a resolution is between two multiples of a logical size, the viewport size is
+ *  rounded down to the lower multiple.
+ *
+ *  \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer,
+                                                      SDL_bool enable);
+
+/**
+ *  \brief Get whether integer scales are forced for resolution-independent rendering
+ *
+ *  \param renderer The renderer from which integer scaling should be queried.
+ *
+ *  \sa SDL_RenderSetIntegerScale()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer);
+
 /**
  *  \brief Set the drawing area for rendering on the current target.
  *
@@ -658,7 +687,8 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
 /**
  *  \brief Clear the current rendering target with the drawing color
  *
- *  This function clears the entire rendering target, ignoring the viewport.
+ *  This function clears the entire rendering target, ignoring the viewport and
+ *  the clip rectangle.
  *
  *  \return 0 on success, or -1 on error
  */
@@ -791,7 +821,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
  *                   texture.
  *  \param dstrect   A pointer to the destination rectangle, or NULL for the
  *                   entire rendering target.
- *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect
+ *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
  *  \param center   A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
  *  \param flip     An SDL_RendererFlip value stating which flipping actions should be performed on the texture
  *
@@ -868,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw
  */
 extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
 
+/**
+ *  \brief Get the CAMetalLayer associated with the given Metal renderer
+ *
+ *  \param renderer The renderer to query
+ *
+ *  \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
+ *
+ *  \sa SDL_RenderGetMetalCommandEncoder()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
+
+/**
+ *  \brief Get the Metal command encoder for the current frame
+ *
+ *  \param renderer The renderer to query
+ *
+ *  \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
+ *
+ *  \sa SDL_RenderGetMetalLayer()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
@@ -875,6 +926,6 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_render_h */
+#endif /* SDL_render_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 33 - 10
sdl.mod/SDL/include/SDL_rwops.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -26,8 +26,8 @@
  *  data streams.  It can easily be extended to files, memory, etc.
  */
 
-#ifndef _SDL_rwops_h
-#define _SDL_rwops_h
+#ifndef SDL_rwops_h_
+#define SDL_rwops_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -39,12 +39,12 @@ extern "C" {
 #endif
 
 /* RWops Types */
-#define SDL_RWOPS_UNKNOWN   0   /* Unknown stream type */
-#define SDL_RWOPS_WINFILE   1   /* Win32 file */
-#define SDL_RWOPS_STDFILE   2   /* Stdio file */
-#define SDL_RWOPS_JNIFILE   3   /* Android asset */
-#define SDL_RWOPS_MEMORY    4   /* Memory stream */
-#define SDL_RWOPS_MEMORY_RO 5   /* Read-Only memory stream */
+#define SDL_RWOPS_UNKNOWN   0U  /**< Unknown stream type */
+#define SDL_RWOPS_WINFILE   1U  /**< Win32 file */
+#define SDL_RWOPS_STDFILE   2U  /**< Stdio file */
+#define SDL_RWOPS_JNIFILE   3U  /**< Android asset */
+#define SDL_RWOPS_MEMORY    4U  /**< Memory stream */
+#define SDL_RWOPS_MEMORY_RO 5U  /**< Read-Only memory stream */
 
 /**
  * This is the read/write operation structure -- very basic.
@@ -190,6 +190,29 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
 /* @} *//* Read/write macros */
 
 
+/**
+ *  Load all the data from an SDL data stream.
+ *
+ *  The data is allocated with a zero byte at the end (null terminated)
+ *
+ *  If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ *  If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ *  The data should be freed with SDL_free().
+ *
+ *  \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
+                                                    int freesrc);
+
+/**
+ *  Load an entire file.
+ *
+ *  Convenience macro.
+ */
+#define SDL_LoadFile(file, datasize)   SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1)
+
 /**
  *  \name Read endian functions
  *
@@ -226,6 +249,6 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_rwops_h */
+#endif /* SDL_rwops_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 17 - 5
sdl.mod/SDL/include/SDL_scancode.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Defines keyboard scancodes.
  */
 
-#ifndef _SDL_scancode_h
-#define _SDL_scancode_h
+#ifndef SDL_scancode_h_
+#define SDL_scancode_h_
 
 #include "SDL_stdinc.h"
 
@@ -38,7 +38,7 @@
  *  SDL_Event structure.
  *
  *  The values in this enumeration are based on the USB usage page standard:
- *  http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
+ *  http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
  */
 typedef enum
 {
@@ -390,12 +390,24 @@ typedef enum
 
     /* @} *//* Walther keys */
 
+    /**
+     *  \name Usage page 0x0C (additional media keys)
+     *
+     *  These values are mapped from usage page 0x0C (USB consumer page).
+     */
+    /* @{ */
+
+    SDL_SCANCODE_AUDIOREWIND = 285,
+    SDL_SCANCODE_AUDIOFASTFORWARD = 286,
+
+    /* @} *//* Usage page 0x0C (additional media keys) */
+
     /* Add any other keys here. */
 
     SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
                                  for array bounds */
 } SDL_Scancode;
 
-#endif /* _SDL_scancode_h */
+#endif /* SDL_scancode_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 9 - 8
sdl.mod/SDL/include/SDL_shape.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_shape_h
-#define _SDL_shape_h
+#ifndef SDL_shape_h_
+#define SDL_shape_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_pixels.h"
@@ -71,6 +71,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un
  * \param window The window to query for being shaped.
  *
  * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
+ *
  * \sa SDL_CreateShapedWindow
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
@@ -91,7 +92,7 @@ typedef enum {
 
 /** \brief A union containing parameters for shaped windows. */
 typedef union {
-    /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
+    /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
     Uint8 binarizationCutoff;
     SDL_Color colorKey;
 } SDL_WindowShapeParams;
@@ -111,8 +112,8 @@ typedef struct SDL_WindowShapeMode {
  * \param shape A surface encoding the desired shape for the window.
  * \param shape_mode The parameters to set for the shaped window.
  *
- * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
- *           if the SDL_Window* given does not reference a valid shaped window.
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ *           if the SDL_Window given does not reference a valid shaped window.
  *
  * \sa SDL_WindowShapeMode
  * \sa SDL_GetShapedWindowMode.
@@ -127,7 +128,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s
  *
  * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
  *           data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
- *           the SDL_Window* given is a shapeable window currently lacking a shape.
+ *           the SDL_Window given is a shapeable window currently lacking a shape.
  *
  * \sa SDL_WindowShapeMode
  * \sa SDL_SetWindowShape
@@ -140,4 +141,4 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_shape_h */
+#endif /* SDL_shape_h_ */

+ 89 - 13
sdl.mod/SDL/include/SDL_stdinc.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  This is a general header that includes C language support.
  */
 
-#ifndef _SDL_stdinc_h
-#define _SDL_stdinc_h
+#ifndef SDL_stdinc_h_
+#define SDL_stdinc_h_
 
 #include "SDL_config.h"
 
@@ -62,6 +62,9 @@
 #ifdef HAVE_STRINGS_H
 # include <strings.h>
 #endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
 #if defined(HAVE_INTTYPES_H)
 # include <inttypes.h>
 #elif defined(HAVE_STDINT_H)
@@ -83,9 +86,6 @@
 #ifdef HAVE_FLOAT_H
 # include <float.h>
 #endif
-#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
-# include <iconv.h>
-#endif
 
 /**
  *  The number of elements in an array.
@@ -93,6 +93,13 @@
 #define SDL_arraysize(array)    (sizeof(array)/sizeof(array[0]))
 #define SDL_TABLESIZE(table)    SDL_arraysize(table)
 
+/**
+ *  Macro useful for building other macros with strings in them
+ *
+ *  e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
+ */
+#define SDL_STRINGIFY_ARG(arg)  #arg
+
 /**
  *  \name Cast operators
  *
@@ -123,44 +130,67 @@
  */
 /* @{ */
 
+#ifdef __CC_ARM
+/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
+#define SDL_FALSE 0
+#define SDL_TRUE 1
+typedef int SDL_bool;
+#else
 typedef enum
 {
     SDL_FALSE = 0,
     SDL_TRUE = 1
 } SDL_bool;
+#endif
 
 /**
  * \brief A signed 8-bit integer type.
  */
+#define SDL_MAX_SINT8   ((Sint8)0x7F)           /* 127 */
+#define SDL_MIN_SINT8   ((Sint8)(~0x7F))        /* -128 */
 typedef int8_t Sint8;
 /**
  * \brief An unsigned 8-bit integer type.
  */
+#define SDL_MAX_UINT8   ((Uint8)0xFF)           /* 255 */
+#define SDL_MIN_UINT8   ((Uint8)0x00)           /* 0 */
 typedef uint8_t Uint8;
 /**
  * \brief A signed 16-bit integer type.
  */
+#define SDL_MAX_SINT16  ((Sint16)0x7FFF)        /* 32767 */
+#define SDL_MIN_SINT16  ((Sint16)(~0x7FFF))     /* -32768 */
 typedef int16_t Sint16;
 /**
  * \brief An unsigned 16-bit integer type.
  */
+#define SDL_MAX_UINT16  ((Uint16)0xFFFF)        /* 65535 */
+#define SDL_MIN_UINT16  ((Uint16)0x0000)        /* 0 */
 typedef uint16_t Uint16;
 /**
  * \brief A signed 32-bit integer type.
  */
+#define SDL_MAX_SINT32  ((Sint32)0x7FFFFFFF)    /* 2147483647 */
+#define SDL_MIN_SINT32  ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
 typedef int32_t Sint32;
 /**
  * \brief An unsigned 32-bit integer type.
  */
+#define SDL_MAX_UINT32  ((Uint32)0xFFFFFFFFu)   /* 4294967295 */
+#define SDL_MIN_UINT32  ((Uint32)0x00000000)    /* 0 */
 typedef uint32_t Uint32;
 
 /**
  * \brief A signed 64-bit integer type.
  */
+#define SDL_MAX_SINT64  ((Sint64)0x7FFFFFFFFFFFFFFFll)      /* 9223372036854775807 */
+#define SDL_MIN_SINT64  ((Sint64)(~0x7FFFFFFFFFFFFFFFll))   /* -9223372036854775808 */
 typedef int64_t Sint64;
 /**
  * \brief An unsigned 64-bit integer type.
  */
+#define SDL_MAX_UINT64  ((Uint64)0xFFFFFFFFFFFFFFFFull)     /* 18446744073709551615 */
+#define SDL_MIN_UINT64  ((Uint64)(0x0000000000000000ull))   /* 0 */
 typedef uint64_t Uint64;
 
 /* @} *//* Basic data types */
@@ -258,7 +288,7 @@ typedef uint64_t Uint64;
 #endif /* SDL_DISABLE_ANALYZE_MACROS */
 
 #define SDL_COMPILE_TIME_ASSERT(name, x)               \
-       typedef int SDL_dummy_ ## name[(x) * 2 - 1]
+       typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
 /** \cond */
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
@@ -333,6 +363,37 @@ extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
 extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
 extern DECLSPEC void SDLCALL SDL_free(void *mem);
 
+typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
+typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
+typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
+typedef void (SDLCALL *SDL_free_func)(void *mem);
+
+/**
+ *  \brief Get the current set of SDL memory functions
+ */
+extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
+                                                    SDL_calloc_func *calloc_func,
+                                                    SDL_realloc_func *realloc_func,
+                                                    SDL_free_func *free_func);
+
+/**
+ *  \brief Replace SDL's memory allocation functions with a custom set
+ *
+ *  \note If you are replacing SDL's memory functions, you should call
+ *        SDL_GetNumAllocations() and be very careful if it returns non-zero.
+ *        That means that your free function will be called with memory
+ *        allocated by the previous memory allocation functions.
+ */
+extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
+                                                   SDL_calloc_func calloc_func,
+                                                   SDL_realloc_func realloc_func,
+                                                   SDL_free_func free_func);
+
+/**
+ *  \brief Get the number of outstanding (unfreed) allocations
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
+
 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
 extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
 
@@ -375,10 +436,10 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
         return;
     switch (dwords % 4)
     {
-        case 0: do {    *_p++ = _val;
-        case 3:         *_p++ = _val;
-        case 2:         *_p++ = _val;
-        case 1:         *_p++ = _val;
+        case 0: do {    *_p++ = _val;   /* fallthrough */
+        case 3:         *_p++ = _val;   /* fallthrough */
+        case 2:         *_p++ = _val;   /* fallthrough */
+        case 1:         *_p++ = _val;   /* fallthrough */
         } while ( --_n );
     }
 #endif
@@ -393,6 +454,7 @@ extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t le
 extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
 extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
 extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
 
 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
 extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
@@ -405,6 +467,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
 extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
 extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
 
 extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
 extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
@@ -433,23 +496,36 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size
 
 #ifndef HAVE_M_PI
 #ifndef M_PI
-#define M_PI    3.14159265358979323846264338327950288   /* pi */
+#define M_PI    3.14159265358979323846264338327950288   /**< pi */
 #endif
 #endif
 
 extern DECLSPEC double SDLCALL SDL_acos(double x);
+extern DECLSPEC float SDLCALL SDL_acosf(float x);
 extern DECLSPEC double SDLCALL SDL_asin(double x);
+extern DECLSPEC float SDLCALL SDL_asinf(float x);
 extern DECLSPEC double SDLCALL SDL_atan(double x);
+extern DECLSPEC float SDLCALL SDL_atanf(float x);
 extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
+extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
 extern DECLSPEC double SDLCALL SDL_ceil(double x);
+extern DECLSPEC float SDLCALL SDL_ceilf(float x);
 extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
 extern DECLSPEC double SDLCALL SDL_cos(double x);
 extern DECLSPEC float SDLCALL SDL_cosf(float x);
 extern DECLSPEC double SDLCALL SDL_fabs(double x);
+extern DECLSPEC float SDLCALL SDL_fabsf(float x);
 extern DECLSPEC double SDLCALL SDL_floor(double x);
+extern DECLSPEC float SDLCALL SDL_floorf(float x);
+extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
+extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
 extern DECLSPEC double SDLCALL SDL_log(double x);
+extern DECLSPEC float SDLCALL SDL_logf(float x);
 extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
 extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
 extern DECLSPEC double SDLCALL SDL_sin(double x);
 extern DECLSPEC float SDLCALL SDL_sinf(float x);
 extern DECLSPEC double SDLCALL SDL_sqrt(double x);
@@ -522,6 +598,6 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_stdinc_h */
+#endif /* SDL_stdinc_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 49 - 6
sdl.mod/SDL/include/SDL_surface.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header file for ::SDL_Surface definition and management functions.
  */
 
-#ifndef _SDL_surface_h
-#define _SDL_surface_h
+#ifndef SDL_surface_h_
+#define SDL_surface_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_pixels.h"
@@ -94,8 +94,19 @@ typedef struct SDL_Surface
 /**
  * \brief The type of function used for surface blitting functions.
  */
-typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
-                         struct SDL_Surface * dst, SDL_Rect * dstrect);
+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+                                 struct SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief The formula used for converting between YUV and RGB
+ */
+typedef enum
+{
+    SDL_YUV_CONVERSION_JPEG,        /**< Full range JPEG */
+    SDL_YUV_CONVERSION_BT601,       /**< BT.601 (the default) */
+    SDL_YUV_CONVERSION_BT709,       /**< BT.709 */
+    SDL_YUV_CONVERSION_AUTOMATIC    /**< BT.601 for SD content, BT.709 for HD content */
+} SDL_YUV_CONVERSION_MODE;
 
 /**
  *  Allocate and free an RGB surface.
@@ -118,6 +129,11 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
     (Uint32 flags, int width, int height, int depth,
      Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
+
+/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
+    (Uint32 flags, int width, int height, int depth, Uint32 format);
+
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
                                                               int width,
                                                               int height,
@@ -127,6 +143,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
                                                               Uint32 Gmask,
                                                               Uint32 Bmask,
                                                               Uint32 Amask);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
+    (void *pixels, int width, int height, int depth, int pitch, Uint32 format);
 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
 
 /**
@@ -184,6 +202,12 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
 /**
  *  Save a surface to a seekable SDL data stream (memory or file).
  *
+ *  Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
+ *  BMP directly. Other RGB formats with 8-bit or higher get converted to a
+ *  24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
+ *  surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
+ *  not supported.
+ *
  *  If \c freedst is non-zero, the stream will be closed after being written.
  *
  *  \return 0 if successful or -1 if there was an error.
@@ -346,6 +370,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
                                              SDL_Rect * rect);
 
+/*
+ * Creates a new surface identical to the existing surface
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
+
 /**
  *  Creates a new surface of the specified format, and then copies and maps
  *  the given surface to it so the blit of the converted surface will be as
@@ -491,6 +520,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
     (SDL_Surface * src, SDL_Rect * srcrect,
     SDL_Surface * dst, SDL_Rect * dstrect);
 
+/**
+ *  \brief Set the YUV conversion mode
+ */
+extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
+
+/**
+ *  \brief Get the YUV conversion mode
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
+
+/**
+ *  \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
@@ -498,6 +541,6 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_surface_h */
+#endif /* SDL_surface_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 35 - 9
sdl.mod/SDL/include/SDL_system.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for platform specific SDL API functions
  */
 
-#ifndef _SDL_system_h
-#define _SDL_system_h
+#ifndef SDL_system_h_
+#define SDL_system_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_keyboard.h"
@@ -96,7 +96,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
 
    This returns JNIEnv*, but the prototype is void* so we don't need jni.h
  */
-extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
 
 /**
    \brief Get the SDL Activity object for the application
@@ -106,7 +106,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
    It is the caller's responsibility to properly release it
    (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
  */
-extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
 
 /**
    See the official Android developer guide for more information:
@@ -121,7 +121,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
    This path is unique to your application and cannot be written to
    by other applications.
  */
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
 
 /**
    \brief Get the current state of external storage, a bitmask of these values:
@@ -130,7 +130,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
 
    If external storage is currently unavailable, this will return 0.
 */
-extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
 
 /**
    \brief Get the path used for external storage for this application.
@@ -138,7 +138,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
    This path is unique to your application, but is public and can be
    written to by other applications.
  */
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
 
 #endif /* __ANDROID__ */
 
@@ -169,6 +169,25 @@ typedef enum
 } SDL_WinRT_Path;
 
 
+/**
+ *  \brief WinRT Device Family
+ */
+typedef enum
+{
+    /** \brief Unknown family  */
+    SDL_WINRT_DEVICEFAMILY_UNKNOWN,
+
+    /** \brief Desktop family*/
+    SDL_WINRT_DEVICEFAMILY_DESKTOP,
+
+    /** \brief Mobile family (for example smartphone) */
+    SDL_WINRT_DEVICEFAMILY_MOBILE,
+
+    /** \brief XBox family */
+    SDL_WINRT_DEVICEFAMILY_XBOX,
+} SDL_WinRT_DeviceFamily;
+
+
 /**
  *  \brief Retrieves a WinRT defined path on the local file system
  *
@@ -203,6 +222,13 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path
  */
 extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
 
+/**
+ *  \brief Detects the device family of WinRT plattform on runtime
+ *
+ *  \return Device family
+ */
+extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
+
 #endif /* __WINRT__ */
 
 /* Ends C function definitions when using C++ */
@@ -211,6 +237,6 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_system_h */
+#endif /* SDL_system_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 37 - 14
sdl.mod/SDL/include/SDL_syswm.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL custom system window manager hooks.
  */
 
-#ifndef _SDL_syswm_h
-#define _SDL_syswm_h
+#ifndef SDL_syswm_h_
+#define SDL_syswm_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -106,6 +106,10 @@ typedef struct ANativeWindow ANativeWindow;
 typedef void *EGLSurface;
 #endif
 
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+#include "SDL_egl.h"
+#endif
+
 /**
  *  These are the various supported windowing subsystems
  */
@@ -120,7 +124,9 @@ typedef enum
     SDL_SYSWM_WAYLAND,
     SDL_SYSWM_MIR,
     SDL_SYSWM_WINRT,
-    SDL_SYSWM_ANDROID
+    SDL_SYSWM_ANDROID,
+    SDL_SYSWM_VIVANTE,
+    SDL_SYSWM_OS2
 } SDL_SYSWM_TYPE;
 
 /**
@@ -166,6 +172,13 @@ struct SDL_SysWMmsg
             int dummy;
             /* No UIKit window events yet */
         } uikit;
+#endif
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+        struct
+        {
+            int dummy;
+            /* No Vivante window events yet */
+        } vivante;
 #endif
         /* Can't have an empty union */
         int dummy;
@@ -189,6 +202,7 @@ struct SDL_SysWMinfo
         {
             HWND window;                /**< The window handle */
             HDC hdc;                    /**< The window device context */
+            HINSTANCE hinstance;        /**< The instance handle */
         } win;
 #endif
 #if defined(SDL_VIDEO_DRIVER_WINRT)
@@ -216,9 +230,9 @@ struct SDL_SysWMinfo
         struct
         {
 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
-            NSWindow __unsafe_unretained *window; /* The Cocoa window */
+            NSWindow __unsafe_unretained *window; /**< The Cocoa window */
 #else
-            NSWindow *window;                     /* The Cocoa window */
+            NSWindow *window;                     /**< The Cocoa window */
 #endif
         } cocoa;
 #endif
@@ -226,13 +240,13 @@ struct SDL_SysWMinfo
         struct
         {
 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
-            UIWindow __unsafe_unretained *window; /* The UIKit window */
+            UIWindow __unsafe_unretained *window; /**< The UIKit window */
 #else
-            UIWindow *window;                     /* The UIKit window */
+            UIWindow *window;                     /**< The UIKit window */
 #endif
-            GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
-            GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
-            GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
+            GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
+            GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
+            GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
         } uikit;
 #endif
 #if defined(SDL_VIDEO_DRIVER_WAYLAND)
@@ -259,8 +273,17 @@ struct SDL_SysWMinfo
         } android;
 #endif
 
-        /* Can't have an empty union */
-        int dummy;
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+        struct
+        {
+            EGLNativeDisplayType display;
+            EGLNativeWindowType window;
+        } vivante;
+#endif
+
+        /* Make sure this union is always 64 bytes (8 64-bit pointers). */
+        /* Be careful not to overflow this if you add a new target! */
+        Uint8 dummy[64];
     } info;
 };
 
@@ -296,6 +319,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_syswm_h */
+#endif /* SDL_syswm_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 10
sdl.mod/SDL/include/SDL_test.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -27,21 +27,22 @@
  *  This code is a part of the SDL2_test library, not the main SDL library.
  */
 
-#ifndef _SDL_test_h
-#define _SDL_test_h
+#ifndef SDL_test_h_
+#define SDL_test_h_
 
 #include "SDL.h"
+#include "SDL_test_assert.h"
 #include "SDL_test_common.h"
+#include "SDL_test_compare.h"
+#include "SDL_test_crc32.h"
 #include "SDL_test_font.h"
-#include "SDL_test_random.h"
 #include "SDL_test_fuzzer.h"
-#include "SDL_test_crc32.h"
-#include "SDL_test_md5.h"
-#include "SDL_test_log.h"
-#include "SDL_test_assert.h"
 #include "SDL_test_harness.h"
 #include "SDL_test_images.h"
-#include "SDL_test_compare.h"
+#include "SDL_test_log.h"
+#include "SDL_test_md5.h"
+#include "SDL_test_memory.h"
+#include "SDL_test_random.h"
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -63,6 +64,6 @@ extern "C" {
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_h */
+#endif /* SDL_test_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 7 - 7
sdl.mod/SDL/include/SDL_test_assert.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
  *
  */
 
-#ifndef _SDL_test_assert_h
-#define _SDL_test_assert_h
+#ifndef SDL_test_assert_h_
+#define SDL_test_assert_h_
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -80,12 +80,12 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,
 /**
  * \brief Resets the assert summary counters to zero.
  */
-void SDLTest_ResetAssertSummary();
+void SDLTest_ResetAssertSummary(void);
 
 /**
  * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
  */
-void SDLTest_LogAssertSummary();
+void SDLTest_LogAssertSummary(void);
 
 
 /**
@@ -93,13 +93,13 @@ void SDLTest_LogAssertSummary();
  *
  * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
  */
-int SDLTest_AssertSummaryToTestResult();
+int SDLTest_AssertSummaryToTestResult(void);
 
 #ifdef __cplusplus
 }
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_assert_h */
+#endif /* SDL_test_assert_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_test_common.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -29,8 +29,8 @@
 
 /* Ported from original test\common.h file. */
 
-#ifndef _SDL_test_common_h
-#define _SDL_test_common_h
+#ifndef SDL_test_common_h_
+#define SDL_test_common_h_
 
 #include "SDL.h"
 
@@ -183,6 +183,6 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_common_h */
+#endif /* SDL_test_common_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_test_compare.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
 
 */
 
-#ifndef _SDL_test_compare_h
-#define _SDL_test_compare_h
+#ifndef SDL_test_compare_h_
+#define SDL_test_compare_h_
 
 #include "SDL.h"
 
@@ -64,6 +64,6 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_compare_h */
+#endif /* SDL_test_compare_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 5 - 5
sdl.mod/SDL/include/SDL_test_crc32.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
 
 */
 
-#ifndef _SDL_test_crc32_h
-#define _SDL_test_crc32_h
+#ifndef SDL_test_crc32_h_
+#define SDL_test_crc32_h_
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -93,7 +93,7 @@ extern "C" {
  * \returns 0 for OK, -1 on error
  *
  */
-int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
 
 /* Same routine broken down into three steps */
 int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
@@ -119,6 +119,6 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_crc32_h */
+#endif /* SDL_test_crc32_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 6
sdl.mod/SDL/include/SDL_test_font.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -27,8 +27,8 @@
  *  This code is a part of the SDL2_test library, not the main SDL library.
  */
 
-#ifndef _SDL_test_font_h
-#define _SDL_test_font_h
+#ifndef SDL_test_font_h_
+#define SDL_test_font_h_
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -50,7 +50,7 @@ extern "C" {
  *
  *  \returns Returns 0 on success, -1 on failure.
  */
-int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c );
+int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
 
 /**
  *  \brief Draw a string in the currently set font.
@@ -62,15 +62,20 @@ int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c );
  *
  *  \returns Returns 0 on success, -1 on failure.
  */
-int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s );
+int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
 
 
+/**
+ *  \brief Cleanup textures used by font drawing functions.
+ */
+void SDLTest_CleanupTextDrawing(void);
+
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 }
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_font_h */
+#endif /* SDL_test_font_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 18 - 18
sdl.mod/SDL/include/SDL_test_fuzzer.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
 
 */
 
-#ifndef _SDL_test_fuzzer_h
-#define _SDL_test_fuzzer_h
+#ifndef SDL_test_fuzzer_h_
+#define SDL_test_fuzzer_h_
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -68,14 +68,14 @@ void SDLTest_FuzzerInit(Uint64 execKey);
  *
  * \returns Generated integer
  */
-Uint8 SDLTest_RandomUint8();
+Uint8 SDLTest_RandomUint8(void);
 
 /**
  * Returns a random Sint8
  *
  * \returns Generated signed integer
  */
-Sint8 SDLTest_RandomSint8();
+Sint8 SDLTest_RandomSint8(void);
 
 
 /**
@@ -83,14 +83,14 @@ Sint8 SDLTest_RandomSint8();
  *
  * \returns Generated integer
  */
-Uint16 SDLTest_RandomUint16();
+Uint16 SDLTest_RandomUint16(void);
 
 /**
  * Returns a random Sint16
  *
  * \returns Generated signed integer
  */
-Sint16 SDLTest_RandomSint16();
+Sint16 SDLTest_RandomSint16(void);
 
 
 /**
@@ -98,7 +98,7 @@ Sint16 SDLTest_RandomSint16();
  *
  * \returns Generated integer
  */
-Sint32 SDLTest_RandomSint32();
+Sint32 SDLTest_RandomSint32(void);
 
 
 /**
@@ -106,14 +106,14 @@ Sint32 SDLTest_RandomSint32();
  *
  * \returns Generated integer
  */
-Uint32 SDLTest_RandomUint32();
+Uint32 SDLTest_RandomUint32(void);
 
 /**
  * Returns random Uint64.
  *
  * \returns Generated integer
  */
-Uint64 SDLTest_RandomUint64();
+Uint64 SDLTest_RandomUint64(void);
 
 
 /**
@@ -121,29 +121,29 @@ Uint64 SDLTest_RandomUint64();
  *
  * \returns Generated signed integer
  */
-Sint64 SDLTest_RandomSint64();
+Sint64 SDLTest_RandomSint64(void);
 
 /**
  * \returns random float in range [0.0 - 1.0[
  */
-float SDLTest_RandomUnitFloat();
+float SDLTest_RandomUnitFloat(void);
 
 /**
  * \returns random double in range [0.0 - 1.0[
  */
-double SDLTest_RandomUnitDouble();
+double SDLTest_RandomUnitDouble(void);
 
 /**
  * \returns random float.
  *
  */
-float SDLTest_RandomFloat();
+float SDLTest_RandomFloat(void);
 
 /**
  * \returns random double.
  *
  */
-double SDLTest_RandomDouble();
+double SDLTest_RandomDouble(void);
 
 /**
  * Returns a random boundary value for Uint8 within the given boundaries.
@@ -338,7 +338,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
  *
  * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
  */
-char * SDLTest_RandomAsciiString();
+char * SDLTest_RandomAsciiString(void);
 
 
 /**
@@ -371,7 +371,7 @@ char * SDLTest_RandomAsciiStringOfSize(int size);
 /**
  * Returns the invocation count for the fuzzer since last ...FuzzerInit.
  */
-int SDLTest_GetFuzzerInvocationCount();
+int SDLTest_GetFuzzerInvocationCount(void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
@@ -379,6 +379,6 @@ int SDLTest_GetFuzzerInvocationCount();
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_fuzzer_h */
+#endif /* SDL_test_fuzzer_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 15 - 4
sdl.mod/SDL/include/SDL_test_harness.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
   Based on original GSOC code by Markus Kauppila <[email protected]>
 */
 
-#ifndef _SDL_test_harness_h
-#define _SDL_test_harness_h
+#ifndef SDL_test_h_arness_h
+#define SDL_test_h_arness_h
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -98,6 +98,17 @@ typedef struct SDLTest_TestSuiteReference {
 } SDLTest_TestSuiteReference;
 
 
+/**
+ * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
+ *
+ * Note: The returned string needs to be deallocated by the caller.
+ *
+ * \param length The length of the seed string to generate
+ *
+ * \returns The generated seed string
+ */
+char *SDLTest_GenerateRunSeed(const int length);
+
 /**
  * \brief Execute a test suite using the given run seed and execution key.
  *
@@ -118,6 +129,6 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_harness_h */
+#endif /* SDL_test_h_arness_h */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 15 - 15
sdl.mod/SDL/include/SDL_test_images.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
 
 */
 
-#ifndef _SDL_test_images_h
-#define _SDL_test_images_h
+#ifndef SDL_test_images_h_
+#define SDL_test_images_h_
 
 #include "SDL.h"
 
@@ -55,17 +55,17 @@ typedef struct SDLTest_SurfaceImage_s {
 } SDLTest_SurfaceImage_t;
 
 /* Test images */
-SDL_Surface *SDLTest_ImageBlit();
-SDL_Surface *SDLTest_ImageBlitColor();
-SDL_Surface *SDLTest_ImageBlitAlpha();
-SDL_Surface *SDLTest_ImageBlitBlendAdd();
-SDL_Surface *SDLTest_ImageBlitBlend();
-SDL_Surface *SDLTest_ImageBlitBlendMod();
-SDL_Surface *SDLTest_ImageBlitBlendNone();
-SDL_Surface *SDLTest_ImageBlitBlendAll();
-SDL_Surface *SDLTest_ImageFace();
-SDL_Surface *SDLTest_ImagePrimitives();
-SDL_Surface *SDLTest_ImagePrimitivesBlend();
+SDL_Surface *SDLTest_ImageBlit(void);
+SDL_Surface *SDLTest_ImageBlitColor(void);
+SDL_Surface *SDLTest_ImageBlitAlpha(void);
+SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
+SDL_Surface *SDLTest_ImageBlitBlend(void);
+SDL_Surface *SDLTest_ImageBlitBlendMod(void);
+SDL_Surface *SDLTest_ImageBlitBlendNone(void);
+SDL_Surface *SDLTest_ImageBlitBlendAll(void);
+SDL_Surface *SDLTest_ImageFace(void);
+SDL_Surface *SDLTest_ImagePrimitives(void);
+SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
@@ -73,6 +73,6 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend();
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_images_h */
+#endif /* SDL_test_images_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_test_log.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
  *
  */
 
-#ifndef _SDL_test_log_h
-#define _SDL_test_log_h
+#ifndef SDL_test_log_h_
+#define SDL_test_log_h_
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -62,6 +62,6 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_log_h */
+#endif /* SDL_test_log_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_test_md5.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -53,8 +53,8 @@
  ***********************************************************************
 */
 
-#ifndef _SDL_test_md5_h
-#define _SDL_test_md5_h
+#ifndef SDL_test_md5_h_
+#define SDL_test_md5_h_
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -124,6 +124,6 @@ extern "C" {
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_md5_h */
+#endif /* SDL_test_md5_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 63 - 0
sdl.mod/SDL/include/SDL_test_memory.h

@@ -0,0 +1,63 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
+
+  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.
+*/
+
+/**
+ *  \file SDL_test_memory.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_memory_h_
+#define SDL_test_memory_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \brief Start tracking SDL memory allocations
+ * 
+ * \note This should be called before any other SDL functions for complete tracking coverage
+ */
+int SDLTest_TrackAllocations();
+
+/**
+ * \brief Print a log of any outstanding allocations
+ *
+ * \note This can be called after SDL_Quit()
+ */
+void SDLTest_LogAllocations();
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_memory_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_test_random.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -37,8 +37,8 @@
 
 */
 
-#ifndef _SDL_test_random_h
-#define _SDL_test_random_h
+#ifndef SDL_test_random_h_
+#define SDL_test_random_h_
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -110,6 +110,6 @@ extern "C" {
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_test_random_h */
+#endif /* SDL_test_random_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 37 - 16
sdl.mod/SDL/include/SDL_thread.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_thread_h
-#define _SDL_thread_h
+#ifndef SDL_thread_h_
+#define SDL_thread_h_
 
 /**
  *  \file SDL_thread.h
@@ -74,15 +74,15 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
  *
  *  We compile SDL into a DLL. This means, that it's the DLL which
  *  creates a new thread for the calling process with the SDL_CreateThread()
- *  API. There is a problem with this, that only the RTL of the SDL.DLL will
+ *  API. There is a problem with this, that only the RTL of the SDL2.DLL will
  *  be initialized for those threads, and not the RTL of the calling
  *  application!
  *
  *  To solve this, we make a little hack here.
  *
  *  We'll always use the caller's _beginthread() and _endthread() APIs to
- *  start a new thread. This way, if it's the SDL.DLL which uses this API,
- *  then the RTL of SDL.DLL will be used to create the new thread, and if it's
+ *  start a new thread. This way, if it's the SDL2.DLL which uses this API,
+ *  then the RTL of SDL2.DLL will be used to create the new thread, and if it's
  *  the application, then the RTL of the application will be used.
  *
  *  So, in short:
@@ -90,14 +90,11 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
  *  library!
  */
 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h>            /* This has _beginthread() and _endthread() defined! */
-
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
-                                                        unsigned (__stdcall *
-                                                                  func) (void
-                                                                         *),
-                                                        void *arg, unsigned,
-                                                        unsigned *threadID);
+#include <process.h> /* _beginthreadex() and _endthreadex() */
+
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
+                   (void *, unsigned, unsigned (__stdcall *func)(void *),
+                    void * /*arg*/, unsigned, unsigned * /* threadID */);
 typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
 
 /**
@@ -118,6 +115,30 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
 #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
 #endif
 
+#elif defined(__OS2__)
+/*
+ * just like the windows case above:  We compile SDL2
+ * into a dll with Watcom's runtime statically linked.
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#ifndef __EMX__
+#include <process.h>
+#else
+#include <stdlib.h>
+#endif
+typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
+typedef void (*pfnSDL_CurrentEndThread)(void);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+                 pfnSDL_CurrentBeginThread pfnBeginThread,
+                 pfnSDL_CurrentEndThread pfnEndThread);
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#endif
+
 #else
 
 /**
@@ -273,7 +294,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
  *  \sa SDL_TLSCreate()
  *  \sa SDL_TLSGet()
  */
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
 
 
 /* Ends C function definitions when using C++ */
@@ -282,6 +303,6 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*d
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_thread_h */
+#endif /* SDL_thread_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_timer.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_timer_h
-#define _SDL_timer_h
+#ifndef SDL_timer_h_
+#define SDL_timer_h_
 
 /**
  *  \file SDL_timer.h
@@ -110,6 +110,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_timer_h */
+#endif /* SDL_timer_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/include/SDL_touch.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL touch event handling.
  */
 
-#ifndef _SDL_touch_h
-#define _SDL_touch_h
+#ifndef SDL_touch_h_
+#define SDL_touch_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
@@ -81,6 +81,6 @@ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_touch_h */
+#endif /* SDL_touch_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
sdl.mod/SDL/include/SDL_types.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages

+ 5 - 5
sdl.mod/SDL/include/SDL_version.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  This header defines the current SDL version.
  */
 
-#ifndef _SDL_version_h
-#define _SDL_version_h
+#ifndef SDL_version_h_
+#define SDL_version_h_
 
 #include "SDL_stdinc.h"
 
@@ -59,7 +59,7 @@ typedef struct SDL_version
 */
 #define SDL_MAJOR_VERSION   2
 #define SDL_MINOR_VERSION   0
-#define SDL_PATCHLEVEL      4
+#define SDL_PATCHLEVEL      8
 
 /**
  *  \brief Macro to determine SDL version program was compiled against.
@@ -157,6 +157,6 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_version_h */
+#endif /* SDL_version_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 203 - 36
sdl.mod/SDL/include/SDL_video.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header file for SDL video functions.
  */
 
-#ifndef _SDL_video_h
-#define _SDL_video_h
+#ifndef SDL_video_h_
+#define SDL_video_h_
 
 #include "SDL_stdinc.h"
 #include "SDL_pixels.h"
@@ -53,8 +53,8 @@ extern "C" {
 typedef struct
 {
     Uint32 format;              /**< pixel format */
-    int w;                      /**< width */
-    int h;                      /**< height */
+    int w;                      /**< width, in screen coordinates */
+    int h;                      /**< height, in screen coordinates */
     int refresh_rate;           /**< refresh rate (or zero for unspecified) */
     void *driverdata;           /**< driver-specific data, initialize to 0 */
 } SDL_DisplayMode;
@@ -83,6 +83,7 @@ typedef struct
  *  \sa SDL_SetWindowPosition()
  *  \sa SDL_SetWindowSize()
  *  \sa SDL_SetWindowBordered()
+ *  \sa SDL_SetWindowResizable()
  *  \sa SDL_SetWindowTitle()
  *  \sa SDL_ShowWindow()
  */
@@ -95,6 +96,7 @@ typedef struct SDL_Window SDL_Window;
  */
 typedef enum
 {
+    /* !!! FIXME: change this to name = (1<<x). */
     SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window */
     SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */
     SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
@@ -109,13 +111,19 @@ typedef enum
     SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
     SDL_WINDOW_FOREIGN = 0x00000800,            /**< window not created by SDL */
     SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,      /**< window should be created in high-DPI mode if supported */
-    SDL_WINDOW_MOUSE_CAPTURE = 0x00004000       /**< window has mouse captured (unrelated to INPUT_GRABBED) */
+    SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,      /**< window has mouse captured (unrelated to INPUT_GRABBED) */
+    SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,      /**< window should always be above others */
+    SDL_WINDOW_SKIP_TASKBAR  = 0x00010000,      /**< window should not be added to the taskbar */
+    SDL_WINDOW_UTILITY       = 0x00020000,      /**< window should be treated as a utility window */
+    SDL_WINDOW_TOOLTIP       = 0x00040000,      /**< window should be treated as a tooltip */
+    SDL_WINDOW_POPUP_MENU    = 0x00080000,      /**< window should be treated as a popup menu */
+    SDL_WINDOW_VULKAN        = 0x10000000       /**< window usable for Vulkan surface */
 } SDL_WindowFlags;
 
 /**
  *  \brief Used to indicate that you don't care what the window position is.
  */
-#define SDL_WINDOWPOS_UNDEFINED_MASK    0x1FFF0000
+#define SDL_WINDOWPOS_UNDEFINED_MASK    0x1FFF0000u
 #define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)  (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
 #define SDL_WINDOWPOS_UNDEFINED         SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
 #define SDL_WINDOWPOS_ISUNDEFINED(X)    \
@@ -124,7 +132,7 @@ typedef enum
 /**
  *  \brief Used to indicate that the window position should be centered.
  */
-#define SDL_WINDOWPOS_CENTERED_MASK    0x2FFF0000
+#define SDL_WINDOWPOS_CENTERED_MASK    0x2FFF0000u
 #define SDL_WINDOWPOS_CENTERED_DISPLAY(X)  (SDL_WINDOWPOS_CENTERED_MASK|(X))
 #define SDL_WINDOWPOS_CENTERED         SDL_WINDOWPOS_CENTERED_DISPLAY(0)
 #define SDL_WINDOWPOS_ISCENTERED(X)    \
@@ -143,7 +151,9 @@ typedef enum
     SDL_WINDOWEVENT_MOVED,          /**< Window has been moved to data1, data2
                                      */
     SDL_WINDOWEVENT_RESIZED,        /**< Window has been resized to data1xdata2 */
-    SDL_WINDOWEVENT_SIZE_CHANGED,   /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */
+    SDL_WINDOWEVENT_SIZE_CHANGED,   /**< The window size has changed, either as
+                                         a result of an API call or through the
+                                         system or user changing the window size. */
     SDL_WINDOWEVENT_MINIMIZED,      /**< Window has been minimized */
     SDL_WINDOWEVENT_MAXIMIZED,      /**< Window has been maximized */
     SDL_WINDOWEVENT_RESTORED,       /**< Window has been restored to normal size
@@ -152,8 +162,9 @@ typedef enum
     SDL_WINDOWEVENT_LEAVE,          /**< Window has lost mouse focus */
     SDL_WINDOWEVENT_FOCUS_GAINED,   /**< Window has gained keyboard focus */
     SDL_WINDOWEVENT_FOCUS_LOST,     /**< Window has lost keyboard focus */
-    SDL_WINDOWEVENT_CLOSE           /**< The window manager requests that the
-                                         window be closed */
+    SDL_WINDOWEVENT_CLOSE,          /**< The window manager requests that the window be closed */
+    SDL_WINDOWEVENT_TAKE_FOCUS,     /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
+    SDL_WINDOWEVENT_HIT_TEST        /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
 } SDL_WindowEventID;
 
 /**
@@ -190,14 +201,16 @@ typedef enum
     SDL_GL_CONTEXT_PROFILE_MASK,
     SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
     SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
-    SDL_GL_CONTEXT_RELEASE_BEHAVIOR
+    SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
+    SDL_GL_CONTEXT_RESET_NOTIFICATION,
+    SDL_GL_CONTEXT_NO_ERROR
 } SDL_GLattr;
 
 typedef enum
 {
     SDL_GL_CONTEXT_PROFILE_CORE           = 0x0001,
     SDL_GL_CONTEXT_PROFILE_COMPATIBILITY  = 0x0002,
-    SDL_GL_CONTEXT_PROFILE_ES             = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
+    SDL_GL_CONTEXT_PROFILE_ES             = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
 } SDL_GLprofile;
 
 typedef enum
@@ -214,6 +227,11 @@ typedef enum
     SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH  = 0x0001
 } SDL_GLcontextReleaseFlag;
 
+typedef enum
+{
+    SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
+    SDL_GL_CONTEXT_RESET_LOSE_CONTEXT    = 0x0001
+} SDL_GLContextResetNotification;
 
 /* Function prototypes */
 
@@ -308,6 +326,25 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * re
  */
 extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
 
+/**
+ *  \brief Get the usable desktop area represented by a display, with the
+ *         primary display located at 0,0
+ *
+ *  This is the same area as SDL_GetDisplayBounds() reports, but with portions
+ *  reserved by the system removed. For example, on Mac OS X, this subtracts
+ *  the area occupied by the menu bar and dock.
+ *
+ *  Setting a window to be fullscreen generally bypasses these unusable areas,
+ *  so these are good guidelines for the maximum space available to a
+ *  non-fullscreen window.
+ *
+ *  \return 0 on success, or -1 if the index is out of range.
+ *
+ *  \sa SDL_GetDisplayBounds()
+ *  \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
+
 /**
  *  \brief Returns the number of available display modes.
  *
@@ -412,18 +449,39 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
  *               ::SDL_WINDOWPOS_UNDEFINED.
  *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
  *               ::SDL_WINDOWPOS_UNDEFINED.
- *  \param w     The width of the window.
- *  \param h     The height of the window.
+ *  \param w     The width of the window, in screen coordinates.
+ *  \param h     The height of the window, in screen coordinates.
  *  \param flags The flags for the window, a mask of any of the following:
  *               ::SDL_WINDOW_FULLSCREEN,    ::SDL_WINDOW_OPENGL,
  *               ::SDL_WINDOW_HIDDEN,        ::SDL_WINDOW_BORDERLESS,
  *               ::SDL_WINDOW_RESIZABLE,     ::SDL_WINDOW_MAXIMIZED,
  *               ::SDL_WINDOW_MINIMIZED,     ::SDL_WINDOW_INPUT_GRABBED,
- *               ::SDL_WINDOW_ALLOW_HIGHDPI.
+ *               ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
+ *
+ *  \return The created window, or NULL if window creation failed.
+ *
+ *  If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
+ *  in pixels may differ from its size in screen coordinates on platforms with
+ *  high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
+ *  the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
+ *  SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
+ *  drawable size in pixels.
+ *
+ *  If the window is created with any of the SDL_WINDOW_OPENGL or
+ *  SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
+ *  (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
+ *  corresponding UnloadLibrary function is called by SDL_DestroyWindow().
+ *
+ *  If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
+ *  SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
  *
- *  \return The id of the window created, or zero if window creation failed.
+ *  \note On non-Apple devices, SDL requires you to either not link to the
+ *        Vulkan loader or link to a dynamic library version. This limitation
+ *        may be removed in a future version of SDL.
  *
  *  \sa SDL_DestroyWindow()
+ *  \sa SDL_GL_LoadLibrary()
+ *  \sa SDL_Vulkan_LoadLibrary()
  */
 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
                                                       int x, int y, int w,
@@ -434,7 +492,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
  *
  *  \param data A pointer to driver-dependent window creation data
  *
- *  \return The id of the window created, or zero if window creation failed.
+ *  \return The created window, or NULL if window creation failed.
  *
  *  \sa SDL_DestroyWindow()
  */
@@ -513,10 +571,10 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
  *  \brief Set the position of a window.
  *
  *  \param window   The window to reposition.
- *  \param x        The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
-                    ::SDL_WINDOWPOS_UNDEFINED.
- *  \param y        The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
-                    ::SDL_WINDOWPOS_UNDEFINED.
+ *  \param x        The x coordinate of the window in screen coordinates, or
+ *                  ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
+ *  \param y        The y coordinate of the window in screen coordinates, or
+ *                  ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
  *
  *  \note The window coordinate origin is the upper left of the display.
  *
@@ -529,8 +587,10 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
  *  \brief Get the position of a window.
  *
  *  \param window   The window to query.
- *  \param x        Pointer to variable for storing the x position, may be NULL
- *  \param y        Pointer to variable for storing the y position, may be NULL
+ *  \param x        Pointer to variable for storing the x position, in screen
+ *                  coordinates. May be NULL.
+ *  \param y        Pointer to variable for storing the y position, in screen
+ *                  coordinates. May be NULL.
  *
  *  \sa SDL_SetWindowPosition()
  */
@@ -541,13 +601,19 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
  *  \brief Set the size of a window's client area.
  *
  *  \param window   The window to resize.
- *  \param w        The width of the window, must be >0
- *  \param h        The height of the window, must be >0
+ *  \param w        The width of the window, in screen coordinates. Must be >0.
+ *  \param h        The height of the window, in screen coordinates. Must be >0.
+ *
+ *  \note Fullscreen windows automatically match the size of the display mode,
+ *        and you should use SDL_SetWindowDisplayMode() to change their size.
  *
- *  \note You can't change the size of a fullscreen window, it automatically
- *        matches the size of the display mode.
+ *  The window size in screen coordinates may differ from the size in pixels, if
+ *  the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
+ *  high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
+ *  SDL_GetRendererOutputSize() to get the real client area size in pixels.
  *
  *  \sa SDL_GetWindowSize()
+ *  \sa SDL_SetWindowDisplayMode()
  */
 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
                                                int h);
@@ -556,14 +622,40 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
  *  \brief Get the size of a window's client area.
  *
  *  \param window   The window to query.
- *  \param w        Pointer to variable for storing the width, may be NULL
- *  \param h        Pointer to variable for storing the height, may be NULL
+ *  \param w        Pointer to variable for storing the width, in screen
+ *                  coordinates. May be NULL.
+ *  \param h        Pointer to variable for storing the height, in screen
+ *                  coordinates. May be NULL.
+ *
+ *  The window size in screen coordinates may differ from the size in pixels, if
+ *  the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
+ *  high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
+ *  SDL_GetRendererOutputSize() to get the real client area size in pixels.
  *
  *  \sa SDL_SetWindowSize()
  */
 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
                                                int *h);
 
+/**
+ *  \brief Get the size of a window's borders (decorations) around the client area.
+ *
+ *  \param window The window to query.
+ *  \param top Pointer to variable for storing the size of the top border. NULL is permitted.
+ *  \param left Pointer to variable for storing the size of the left border. NULL is permitted.
+ *  \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted.
+ *  \param right Pointer to variable for storing the size of the right border. NULL is permitted.
+ *
+ *  \return 0 on success, or -1 if getting this information is not supported.
+ *
+ *  \note if this function fails (returns -1), the size values will be
+ *        initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as
+ *        if the window in question was borderless.
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
+                                                     int *top, int *left,
+                                                     int *bottom, int *right);
+
 /**
  *  \brief Set the minimum size of a window's client area.
  *
@@ -639,6 +731,23 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
 extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
                                                    SDL_bool bordered);
 
+/**
+ *  \brief Set the user-resizable state of a window.
+ *
+ *  This will add or remove the window's SDL_WINDOW_RESIZABLE flag and
+ *  allow/disallow user resizing of the window. This is a no-op if the
+ *  window's resizable state already matches the requested state.
+ *
+ *  \param window The window of which to change the resizable state.
+ *  \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow.
+ *
+ *  \note You can't change the resizable state of a fullscreen window.
+ *
+ *  \sa SDL_GetWindowFlags()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
+                                                    SDL_bool resizable);
+
 /**
  *  \brief Show a window.
  *
@@ -722,7 +831,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
  *  \return 0 on success, or -1 on error.
  *
  *  \sa SDL_GetWindowSurface()
- *  \sa SDL_UpdateWindowSurfaceRect()
+ *  \sa SDL_UpdateWindowSurface()
  */
 extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
                                                          const SDL_Rect * rects,
@@ -779,6 +888,58 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b
  */
 extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
 
+/**
+ *  \brief Set the opacity for a window
+ *
+ *  \param window The window which will be made transparent or opaque
+ *  \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
+ *                 clamped internally between 0.0f and 1.0f.
+ *
+ *  \return 0 on success, or -1 if setting the opacity isn't supported.
+ *
+ *  \sa SDL_GetWindowOpacity()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity);
+
+/**
+ *  \brief Get the opacity of a window.
+ *
+ *  If transparency isn't supported on this platform, opacity will be reported
+ *  as 1.0f without error.
+ *
+ *  \param window The window in question.
+ *  \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque)
+ *
+ *  \return 0 on success, or -1 on error (invalid window, etc).
+ *
+ *  \sa SDL_SetWindowOpacity()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
+
+/**
+ *  \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name)
+ *
+ *  \param modal_window The window that should be modal
+ *  \param parent_window The parent window
+ *
+ *  \return 0 on success, or -1 otherwise.
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
+
+/**
+ *  \brief Explicitly sets input focus to the window.
+ *
+ *  You almost certainly want SDL_RaiseWindow() instead of this function. Use
+ *  this with caution, as you might give focus to a window that's completely
+ *  obscured by other windows.
+ *
+ *  \param window The window that should get the input focus
+ *
+ *  \return 0 on success, or -1 otherwise.
+ *  \sa SDL_RaiseWindow()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
+
 /**
  *  \brief Set the gamma ramp for a window.
  *
@@ -898,7 +1059,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
 
 
 /**
- *  \brief Returns whether the screensaver is currently enabled (default on).
+ *  \brief Returns whether the screensaver is currently enabled (default off).
  *
  *  \sa SDL_EnableScreenSaver()
  *  \sa SDL_DisableScreenSaver()
@@ -973,11 +1134,16 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
 
 /**
  *  \brief Set an OpenGL window attribute before window creation.
+ *
+ *  \return 0 on success, or -1 if the attribute could not be set.
  */
 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
 
 /**
  *  \brief Get the actual value for an attribute from the current context.
+ *
+ *  \return 0 on success, or -1 if the attribute could not be retrieved.
+ *          The integer at \c value will be modified in either case.
  */
 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
 
@@ -1009,11 +1175,12 @@ extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
 
 /**
- *  \brief Get the size of a window's underlying drawable (for use with glViewport).
+ *  \brief Get the size of a window's underlying drawable in pixels (for use
+ *         with glViewport).
  *
  *  \param window   Window from which the drawable size should be queried
- *  \param w        Pointer to variable for storing the width, may be NULL
- *  \param h        Pointer to variable for storing the height, may be NULL
+ *  \param w        Pointer to variable for storing the width in pixels, may be NULL
+ *  \param h        Pointer to variable for storing the height in pixels, may be NULL
  *
  * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
  * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
@@ -1075,6 +1242,6 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
 #endif
 #include "close_code.h"
 
-#endif /* _SDL_video_h */
+#endif /* SDL_video_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 257 - 0
sdl.mod/SDL/include/SDL_vulkan.h

@@ -0,0 +1,257 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 2017, Mark Callow
+
+  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.
+*/
+
+/**
+ *  \file SDL_vulkan.h
+ *
+ *  Header file for functions to creating Vulkan surfaces on SDL windows.
+ */
+
+#ifndef SDL_vulkan_h_
+#define SDL_vulkan_h_
+
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Avoid including vulkan.h, don't define VkInstance if it's already included */
+#ifdef VULKAN_H_
+#define NO_SDL_VULKAN_TYPEDEFS
+#endif
+#ifndef NO_SDL_VULKAN_TYPEDEFS
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#endif /* !NO_SDL_VULKAN_TYPEDEFS */
+
+typedef VkInstance SDL_vulkanInstance;
+typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
+
+/**
+ *  \name Vulkan support functions
+ *
+ *  \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
+ *        is compatable with Tizen's implementation of Vulkan in SDL.
+ */
+/* @{ */
+
+/**
+ *  \brief Dynamically load a Vulkan loader library.
+ *
+ *  \param [in] path The platform dependent Vulkan loader library name, or
+ *              \c NULL to open the default Vulkan loader library.
+ *
+ *  \return \c 0 on success, or \c -1 if the library couldn't be loaded.
+ *
+ *  This should be done after initializing the video driver, but before
+ *  creating any Vulkan windows. If no Vulkan loader library is loaded, the
+ *  default library will be loaded upon creation of the first Vulkan window.
+ *
+ *  \note If you specify a non-NULL \a path, you should retrieve all of the
+ *        Vulkan functions used in your program from the dynamic library using
+ *        \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
+ *        \a path points to the same vulkan loader library that you linked to.
+ *
+ *  \note On Apple devices, if \a path is NULL, SDL will attempt to find
+ *        the vkGetInstanceProcAddr address within all the mach-o images of
+ *        the current process. This is because the currently (v0.17.0)
+ *        recommended MoltenVK (Vulkan on Metal) usage is as a static library.
+ *        If it is not found then SDL will attempt to load \c libMoltenVK.dylib.
+ *        Applications using the dylib alternative therefore do not need to do
+ *        anything special when calling SDL.
+ *
+ *  \note On non-Apple devices, SDL requires you to either not link to the
+ *        Vulkan loader or link to a dynamic library version. This limitation
+ *        may be removed in a future version of SDL.
+ *
+ *  \note This function will fail if there are no working Vulkan drivers
+ *        installed.
+ *
+ *  \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
+ *  \sa SDL_Vulkan_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
+
+/**
+ *  \brief Get the address of the \c vkGetInstanceProcAddr function.
+ *
+ *  \note This should be called after either calling SDL_Vulkan_LoadLibrary
+ *        or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
+ */
+extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
+
+/**
+ *  \brief Unload the Vulkan loader library previously loaded by
+ *         \c SDL_Vulkan_LoadLibrary().
+ *
+ *  \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
+
+/**
+ *  \brief Get the names of the Vulkan instance extensions needed to create
+ *         a surface with \c SDL_Vulkan_CreateSurface().
+ *
+ *  \param [in]     window Window for which the required Vulkan instance
+ *                  extensions should be retrieved
+ *  \param [in,out] count pointer to an \c unsigned related to the number of
+ *                  required Vulkan instance extensions
+ *  \param [out]    names \c NULL or a pointer to an array to be filled with the
+ *                  required Vulkan instance extensions
+ *
+ *  \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ *  If \a pNames is \c NULL, then the number of required Vulkan instance
+ *  extensions is returned in pCount. Otherwise, \a pCount must point to a
+ *  variable set to the number of elements in the \a pNames array, and on
+ *  return the variable is overwritten with the number of names actually
+ *  written to \a pNames. If \a pCount is less than the number of required
+ *  extensions, at most \a pCount structures will be written. If \a pCount
+ *  is smaller than the number of required extensions, \c SDL_FALSE will be
+ *  returned instead of \c SDL_TRUE, to indicate that not all the required
+ *  extensions were returned.
+ *
+ *  \note The returned list of extensions will contain \c VK_KHR_surface
+ *        and zero or more platform specific extensions
+ *
+ *  \note The extension names queried here must be enabled when calling
+ *        VkCreateInstance, otherwise surface creation will fail.
+ *
+ *  \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ *  \code
+ *  unsigned int count;
+ *  // get count of required extensions
+ *  if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL))
+ *      handle_error();
+ *
+ *  static const char *const additionalExtensions[] =
+ *  {
+ *      VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
+ *  };
+ *  size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
+ *  size_t extensionCount = count + additionalExtensionsCount;
+ *  const char **names = malloc(sizeof(const char *) * extensionCount);
+ *  if(!names)
+ *      handle_error();
+ *
+ *  // get names of required extensions
+ *  if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names))
+ *      handle_error();
+ *
+ *  // copy additional extensions after required extensions
+ *  for(size_t i = 0; i < additionalExtensionsCount; i++)
+ *      names[i + count] = additionalExtensions[i];
+ *
+ *  VkInstanceCreateInfo instanceCreateInfo = {};
+ *  instanceCreateInfo.enabledExtensionCount = extensionCount;
+ *  instanceCreateInfo.ppEnabledExtensionNames = names;
+ *  // fill in rest of instanceCreateInfo
+ *
+ *  VkInstance instance;
+ *  // create the Vulkan instance
+ *  VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
+ *  free(names);
+ *  \endcode
+ *
+ *  \sa SDL_Vulkan_CreateSurface()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
+														SDL_Window *window,
+														unsigned int *pCount,
+														const char **pNames);
+
+/**
+ *  \brief Create a Vulkan rendering surface for a window.
+ *
+ *  \param [in]  window   SDL_Window to which to attach the rendering surface.
+ *  \param [in]  instance handle to the Vulkan instance to use.
+ *  \param [out] surface  pointer to a VkSurfaceKHR handle to receive the
+ *                        handle of the newly created surface.
+ *
+ *  \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ *  \code
+ *  VkInstance instance;
+ *  SDL_Window *window;
+ *
+ *  // create instance and window
+ *
+ *  // create the Vulkan surface
+ *  VkSurfaceKHR surface;
+ *  if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
+ *      handle_error();
+ *  \endcode
+ *
+ *  \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ *  \note \a instance should have been created with the extensions returned
+ *        by \c SDL_Vulkan_CreateSurface() enabled.
+ *
+ *  \sa SDL_Vulkan_GetInstanceExtensions()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
+												SDL_Window *window,
+												VkInstance instance,
+												VkSurfaceKHR* surface);
+
+/**
+ *  \brief Get the size of a window's underlying drawable in pixels (for use
+ *         with setting viewport, scissor & etc).
+ *
+ *  \param window   SDL_Window from which the drawable size should be queried
+ *  \param w        Pointer to variable for storing the width in pixels,
+ *                  may be NULL
+ *  \param h        Pointer to variable for storing the height in pixels,
+ *                  may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ *  \sa SDL_GetWindowSize()
+ *  \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
+                                                        int *w, int *h);
+
+/* @} *//* Vulkan support functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_vulkan_h_ */

+ 23 - 2
sdl.mod/SDL/include/begin_code.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -61,6 +61,12 @@
 #  else
 #   define DECLSPEC __declspec(dllexport)
 #  endif
+# elif defined(__OS2__)
+#   ifdef BUILD_SDL
+#    define DECLSPEC    __declspec(dllexport)
+#   else
+#    define DECLSPEC
+#   endif
 # else
 #  if defined(__GNUC__) && __GNUC__ >= 4
 #   define DECLSPEC __attribute__ ((visibility("default")))
@@ -74,6 +80,11 @@
 #ifndef SDLCALL
 #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
 #define SDLCALL __cdecl
+#elif defined(__OS2__) || defined(__EMX__)
+#define SDLCALL _System
+# if defined (__GNUC__) && !defined(_System)
+#  define _System /* for old EMX/GCC compat.  */
+# endif
 #else
 #define SDLCALL
 #endif
@@ -111,7 +122,7 @@
 #elif defined(_MSC_VER) || defined(__BORLANDC__) || \
       defined(__DMC__) || defined(__SC__) || \
       defined(__WATCOMC__) || defined(__LCC__) || \
-      defined(__DECC)
+      defined(__DECC) || defined(__CC_ARM)
 #define SDL_INLINE __inline
 #ifndef __inline__
 #define __inline__ __inline
@@ -134,6 +145,16 @@
 #endif
 #endif /* SDL_FORCE_INLINE not defined */
 
+#ifndef SDL_NORETURN
+#if defined(__GNUC__)
+#define SDL_NORETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define SDL_NORETURN __declspec(noreturn)
+#else
+#define SDL_NORETURN
+#endif
+#endif /* SDL_NORETURN not defined */
+
 /* Apparently this is needed by several Windows compilers */
 #if !defined(__MACH__)
 #ifndef NULL

+ 2 - 2
sdl.mod/SDL/include/close_code.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -29,7 +29,7 @@
 #undef _begin_code_h
 
 /* Reset structure packing at previous byte alignment */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__)  || defined(__BORLANDC__)
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
 #ifdef __BORLANDC__
 #pragma nopackwarning
 #endif

+ 16 - 17
sdl.mod/SDL/src/SDL.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -36,10 +36,7 @@
 
 /* Initialization/Cleanup routines */
 #if !SDL_TIMERS_DISABLED
-extern int SDL_TimerInit(void);
-extern void SDL_TimerQuit(void);
-extern void SDL_TicksInit(void);
-extern void SDL_TicksQuit(void);
+# include "timer/SDL_timer_c.h"
 #endif
 #if SDL_VIDEO_DRIVER_WINDOWS
 extern int SDL_HelperWindowCreate(void);
@@ -81,7 +78,7 @@ SDL_PrivateShouldInitSubsystem(Uint32 subsystem)
 {
     int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
     SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
-    return (SDL_SubsystemRefCount[subsystem_index] == 0);
+    return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE;
 }
 
 /* Private helper to check if a system needs to be quit. */
@@ -95,7 +92,7 @@ SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) {
     /* If we're in SDL_Quit, we shut down every subsystem, even if refcount
      * isn't zero.
      */
-    return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit;
+    return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE;
 }
 
 void
@@ -115,6 +112,16 @@ SDL_InitSubSystem(Uint32 flags)
     /* Clear the error message */
     SDL_ClearError();
 
+    if ((flags & SDL_INIT_GAMECONTROLLER)) {
+        /* game controller implies joystick */
+        flags |= SDL_INIT_JOYSTICK;
+    }
+
+    if ((flags & (SDL_INIT_VIDEO|SDL_INIT_JOYSTICK))) {
+        /* video or joystick implies events */
+        flags |= SDL_INIT_EVENTS;
+    }
+
 #if SDL_VIDEO_DRIVER_WINDOWS
 	if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
 		if (SDL_HelperWindowCreate() < 0) {
@@ -127,16 +134,6 @@ SDL_InitSubSystem(Uint32 flags)
     SDL_TicksInit();
 #endif
 
-    if ((flags & SDL_INIT_GAMECONTROLLER)) {
-        /* game controller implies joystick */
-        flags |= SDL_INIT_JOYSTICK;
-    }
-
-    if ((flags & (SDL_INIT_VIDEO|SDL_INIT_JOYSTICK))) {
-        /* video or joystick implies events */
-        flags |= SDL_INIT_EVENTS;
-    }
-
     /* Initialize the event subsystem */
     if ((flags & SDL_INIT_EVENTS)) {
 #if !SDL_EVENTS_DISABLED
@@ -443,6 +440,8 @@ SDL_GetPlatform()
     return "Windows";
 #elif __WINRT__
     return "WinRT";
+#elif __TVOS__
+    return "tvOS";
 #elif __IPHONEOS__
     return "iOS";
 #elif __PSP__

+ 71 - 14
sdl.mod/SDL/src/SDL_assert.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -44,7 +44,12 @@
 #endif
 #endif
 
-static SDL_assert_state
+#if defined(__EMSCRIPTEN__)
+#include <emscripten.h>
+#endif
+
+
+static SDL_assert_state SDLCALL
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
 
 /*
@@ -53,7 +58,10 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
  */
 static SDL_assert_data *triggered_assertions = NULL;
 
+#ifndef SDL_THREADS_DISABLED
 static SDL_mutex *assertion_mutex = NULL;
+#endif
+
 static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion;
 static void *assertion_userdata = NULL;
 
@@ -111,23 +119,29 @@ static void SDL_GenerateAssertionReport(void)
     }
 }
 
-static void SDL_ExitProcess(int exitcode)
+
+static SDL_NORETURN void SDL_ExitProcess(int exitcode)
 {
 #ifdef __WIN32__
     ExitProcess(exitcode);
+#elif defined(__EMSCRIPTEN__)
+    emscripten_cancel_main_loop();  /* this should "kill" the app. */
+    emscripten_force_exit(exitcode);  /* this should "kill" the app. */
+    exit(exitcode);
 #else
     _exit(exitcode);
 #endif
 }
 
-static void SDL_AbortAssertion(void)
+
+static SDL_NORETURN void SDL_AbortAssertion(void)
 {
     SDL_Quit();
     SDL_ExitProcess(42);
 }
 
 
-static SDL_assert_state
+static SDL_assert_state SDLCALL
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
 {
 #ifdef __WIN32__
@@ -216,9 +230,45 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
             state = (SDL_assert_state)selected;
         }
     }
-#ifdef HAVE_STDIO_H
+
     else
     {
+#if defined(__EMSCRIPTEN__)
+        /* This is nasty, but we can't block on a custom UI. */
+        for ( ; ; ) {
+            SDL_bool okay = SDL_TRUE;
+            char *buf = (char *) EM_ASM_INT({
+                var str =
+                    Pointer_stringify($0) + '\n\n' +
+                    'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :';
+                var reply = window.prompt(str, "i");
+                if (reply === null) {
+                    reply = "i";
+                }
+                return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL);
+            }, message);
+
+            if (SDL_strcmp(buf, "a") == 0) {
+                state = SDL_ASSERTION_ABORT;
+            /* (currently) no break functionality on Emscripten
+            } else if (SDL_strcmp(buf, "b") == 0) {
+                state = SDL_ASSERTION_BREAK; */
+            } else if (SDL_strcmp(buf, "r") == 0) {
+                state = SDL_ASSERTION_RETRY;
+            } else if (SDL_strcmp(buf, "i") == 0) {
+                state = SDL_ASSERTION_IGNORE;
+            } else if (SDL_strcmp(buf, "A") == 0) {
+                state = SDL_ASSERTION_ALWAYS_IGNORE;
+            } else {
+                okay = SDL_FALSE;
+            }
+            free(buf);
+
+            if (okay) {
+                break;
+            }
+        }
+#elif defined(HAVE_STDIO_H)
         /* this is a little hacky. */
         for ( ; ; ) {
             char buf[32];
@@ -228,25 +278,25 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
                 break;
             }
 
-            if (SDL_strcmp(buf, "a") == 0) {
+            if (SDL_strncmp(buf, "a", 1) == 0) {
                 state = SDL_ASSERTION_ABORT;
                 break;
-            } else if (SDL_strcmp(buf, "b") == 0) {
+            } else if (SDL_strncmp(buf, "b", 1) == 0) {
                 state = SDL_ASSERTION_BREAK;
                 break;
-            } else if (SDL_strcmp(buf, "r") == 0) {
+            } else if (SDL_strncmp(buf, "r", 1) == 0) {
                 state = SDL_ASSERTION_RETRY;
                 break;
-            } else if (SDL_strcmp(buf, "i") == 0) {
+            } else if (SDL_strncmp(buf, "i", 1) == 0) {
                 state = SDL_ASSERTION_IGNORE;
                 break;
-            } else if (SDL_strcmp(buf, "A") == 0) {
+            } else if (SDL_strncmp(buf, "A", 1) == 0) {
                 state = SDL_ASSERTION_ALWAYS_IGNORE;
                 break;
             }
         }
-    }
 #endif /* HAVE_STDIO_H */
+    }
 
     /* Re-enter fullscreen mode */
     if (window) {
@@ -263,10 +313,11 @@ SDL_assert_state
 SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
                     int line)
 {
-    static int assertion_running = 0;
-    static SDL_SpinLock spinlock = 0;
     SDL_assert_state state = SDL_ASSERTION_IGNORE;
+    static int assertion_running = 0;
 
+#ifndef SDL_THREADS_DISABLED
+    static SDL_SpinLock spinlock = 0;
     SDL_AtomicLock(&spinlock);
     if (assertion_mutex == NULL) { /* never called SDL_Init()? */
         assertion_mutex = SDL_CreateMutex();
@@ -280,6 +331,7 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
     if (SDL_LockMutex(assertion_mutex) < 0) {
         return SDL_ASSERTION_IGNORE;   /* oh well, I guess. */
     }
+#endif
 
     /* doing this because Visual C is upset over assigning in the macro. */
     if (data->trigger_count == 0) {
@@ -323,7 +375,10 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
     }
 
     assertion_running--;
+
+#ifndef SDL_THREADS_DISABLED
     SDL_UnlockMutex(assertion_mutex);
+#endif
 
     return state;
 }
@@ -332,10 +387,12 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
 void SDL_AssertionsQuit(void)
 {
     SDL_GenerateAssertionReport();
+#ifndef SDL_THREADS_DISABLED
     if (assertion_mutex != NULL) {
         SDL_DestroyMutex(assertion_mutex);
         assertion_mutex = NULL;
     }
+#endif
 }
 
 void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)

+ 1 - 1
sdl.mod/SDL/src/SDL_assert_c.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages

+ 339 - 0
sdl.mod/SDL/src/SDL_dataqueue.c

@@ -0,0 +1,339 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
+
+  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.h"
+#include "./SDL_dataqueue.h"
+#include "SDL_assert.h"
+
+typedef struct SDL_DataQueuePacket
+{
+    size_t datalen;  /* bytes currently in use in this packet. */
+    size_t startpos;  /* bytes currently consumed in this packet. */
+    struct SDL_DataQueuePacket *next;  /* next item in linked list. */
+    Uint8 data[SDL_VARIABLE_LENGTH_ARRAY];  /* packet data */
+} SDL_DataQueuePacket;
+
+struct SDL_DataQueue
+{
+    SDL_DataQueuePacket *head; /* device fed from here. */
+    SDL_DataQueuePacket *tail; /* queue fills to here. */
+    SDL_DataQueuePacket *pool; /* these are unused packets. */
+    size_t packet_size;   /* size of new packets */
+    size_t queued_bytes;  /* number of bytes of data in the queue. */
+};
+
+static void
+SDL_FreeDataQueueList(SDL_DataQueuePacket *packet)
+{
+    while (packet) {
+        SDL_DataQueuePacket *next = packet->next;
+        SDL_free(packet);
+        packet = next;
+    }
+}
+
+
+/* this all expects that you managed thread safety elsewhere. */
+
+SDL_DataQueue *
+SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack)
+{
+    SDL_DataQueue *queue = (SDL_DataQueue *) SDL_malloc(sizeof (SDL_DataQueue));
+
+    if (!queue) {
+        SDL_OutOfMemory();
+        return NULL;
+    } else {
+        const size_t packetlen = _packetlen ? _packetlen : 1024;
+        const size_t wantpackets = (initialslack + (packetlen - 1)) / packetlen;
+        size_t i;
+
+        SDL_zerop(queue);
+        queue->packet_size = packetlen;
+
+        for (i = 0; i < wantpackets; i++) {
+            SDL_DataQueuePacket *packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + packetlen);
+            if (packet) { /* don't care if this fails, we'll deal later. */
+                packet->datalen = 0;
+                packet->startpos = 0;
+                packet->next = queue->pool;
+                queue->pool = packet;
+            }
+        }
+    }
+
+    return queue;
+}
+
+void
+SDL_FreeDataQueue(SDL_DataQueue *queue)
+{
+    if (queue) {
+        SDL_FreeDataQueueList(queue->head);
+        SDL_FreeDataQueueList(queue->pool);
+        SDL_free(queue);
+    }
+}
+
+void
+SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack)
+{
+    const size_t packet_size = queue ? queue->packet_size : 1;
+    const size_t slackpackets = (slack + (packet_size-1)) / packet_size;
+    SDL_DataQueuePacket *packet;
+    SDL_DataQueuePacket *prev = NULL;
+    size_t i;
+
+    if (!queue) {
+        return;
+    }
+
+    packet = queue->head;
+
+    /* merge the available pool and the current queue into one list. */
+    if (packet) {
+        queue->tail->next = queue->pool;
+    } else {
+        packet = queue->pool;
+    }
+
+    /* Remove the queued packets from the device. */
+    queue->tail = NULL;
+    queue->head = NULL;
+    queue->queued_bytes = 0;
+    queue->pool = packet;
+
+    /* Optionally keep some slack in the pool to reduce malloc pressure. */
+    for (i = 0; packet && (i < slackpackets); i++) {
+        prev = packet;
+        packet = packet->next;
+    }
+
+    if (prev) {
+        prev->next = NULL;
+    } else {
+        queue->pool = NULL;
+    }
+
+    SDL_FreeDataQueueList(packet);  /* free extra packets */
+}
+
+static SDL_DataQueuePacket *
+AllocateDataQueuePacket(SDL_DataQueue *queue)
+{
+    SDL_DataQueuePacket *packet;
+
+    SDL_assert(queue != NULL);
+
+    packet = queue->pool;
+    if (packet != NULL) {
+        /* we have one available in the pool. */
+        queue->pool = packet->next;
+    } else {
+        /* Have to allocate a new one! */
+        packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + queue->packet_size);
+        if (packet == NULL) {
+            return NULL;
+        }
+    }
+
+    packet->datalen = 0;
+    packet->startpos = 0;
+    packet->next = NULL;
+                
+    SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0));
+    if (queue->tail == NULL) {
+        queue->head = packet;
+    } else {
+        queue->tail->next = packet;
+    }
+    queue->tail = packet;
+    return packet;
+}
+
+
+int
+SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _len)
+{
+    size_t len = _len;
+    const Uint8 *data = (const Uint8 *) _data;
+    const size_t packet_size = queue ? queue->packet_size : 0;
+    SDL_DataQueuePacket *orighead;
+    SDL_DataQueuePacket *origtail;
+    size_t origlen;
+    size_t datalen;
+
+    if (!queue) {
+        return SDL_InvalidParamError("queue");
+    }
+
+    orighead = queue->head;
+    origtail = queue->tail;
+    origlen = origtail ? origtail->datalen : 0;
+
+    while (len > 0) {
+        SDL_DataQueuePacket *packet = queue->tail;
+        SDL_assert(!packet || (packet->datalen <= packet_size));
+        if (!packet || (packet->datalen >= packet_size)) {
+            /* tail packet missing or completely full; we need a new packet. */
+            packet = AllocateDataQueuePacket(queue);
+            if (!packet) {
+                /* uhoh, reset so we've queued nothing new, free what we can. */
+                if (!origtail) {
+                    packet = queue->head;  /* whole queue. */
+                } else {
+                    packet = origtail->next;  /* what we added to existing queue. */
+                    origtail->next = NULL;
+                    origtail->datalen = origlen;
+                }
+                queue->head = orighead;
+                queue->tail = origtail;
+                queue->pool = NULL;
+
+                SDL_FreeDataQueueList(packet);  /* give back what we can. */
+                return SDL_OutOfMemory();
+            }
+        }
+
+        datalen = SDL_min(len, packet_size - packet->datalen);
+        SDL_memcpy(packet->data + packet->datalen, data, datalen);
+        data += datalen;
+        len -= datalen;
+        packet->datalen += datalen;
+        queue->queued_bytes += datalen;
+    }
+
+    return 0;
+}
+
+size_t
+SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
+{
+    size_t len = _len;
+    Uint8 *buf = (Uint8 *) _buf;
+    Uint8 *ptr = buf;
+    SDL_DataQueuePacket *packet;
+
+    if (!queue) {
+        return 0;
+    }
+
+    for (packet = queue->head; len && packet; packet = packet->next) {
+        const size_t avail = packet->datalen - packet->startpos;
+        const size_t cpy = SDL_min(len, avail);
+        SDL_assert(queue->queued_bytes >= avail);
+
+        SDL_memcpy(ptr, packet->data + packet->startpos, cpy);
+        ptr += cpy;
+        len -= cpy;
+    }
+
+    return (size_t) (ptr - buf);
+}
+
+size_t
+SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
+{
+    size_t len = _len;
+    Uint8 *buf = (Uint8 *) _buf;
+    Uint8 *ptr = buf;
+    SDL_DataQueuePacket *packet;
+
+    if (!queue) {
+        return 0;
+    }
+
+    while ((len > 0) && ((packet = queue->head) != NULL)) {
+        const size_t avail = packet->datalen - packet->startpos;
+        const size_t cpy = SDL_min(len, avail);
+        SDL_assert(queue->queued_bytes >= avail);
+
+        SDL_memcpy(ptr, packet->data + packet->startpos, cpy);
+        packet->startpos += cpy;
+        ptr += cpy;
+        queue->queued_bytes -= cpy;
+        len -= cpy;
+
+        if (packet->startpos == packet->datalen) {  /* packet is done, put it in the pool. */
+            queue->head = packet->next;
+            SDL_assert((packet->next != NULL) || (packet == queue->tail));
+            packet->next = queue->pool;
+            queue->pool = packet;
+        }
+    }
+
+    SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0));
+
+    if (queue->head == NULL) {
+        queue->tail = NULL;  /* in case we drained the queue entirely. */
+    }
+
+    return (size_t) (ptr - buf);
+}
+
+size_t
+SDL_CountDataQueue(SDL_DataQueue *queue)
+{
+    return queue ? queue->queued_bytes : 0;
+}
+
+void *
+SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len)
+{
+    SDL_DataQueuePacket *packet;
+
+    if (!queue) {
+        SDL_InvalidParamError("queue");
+        return NULL;
+    } else if (len == 0) {
+        SDL_InvalidParamError("len");
+        return NULL;
+    } else if (len > queue->packet_size) {
+        SDL_SetError("len is larger than packet size");
+        return NULL;
+    }
+
+    packet = queue->head;
+    if (packet) {
+        const size_t avail = queue->packet_size - packet->datalen;
+        if (len <= avail) {  /* we can use the space at end of this packet. */
+            void *retval = packet->data + packet->datalen;
+            packet->datalen += len;
+            queue->queued_bytes += len;
+            return retval;
+        }
+    }
+
+    /* Need a fresh packet. */
+    packet = AllocateDataQueuePacket(queue);
+    if (!packet) {
+        SDL_OutOfMemory();
+        return NULL;
+    }
+
+    packet->datalen = len;
+    queue->queued_bytes += len;
+    return packet->data;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
+

+ 55 - 0
sdl.mod/SDL/src/SDL_dataqueue.h

@@ -0,0 +1,55 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
+
+  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.
+*/
+#ifndef SDL_dataqueue_h_
+#define SDL_dataqueue_h_
+
+/* this is not (currently) a public API. But maybe it should be! */
+
+struct SDL_DataQueue;
+typedef struct SDL_DataQueue SDL_DataQueue;
+
+SDL_DataQueue *SDL_NewDataQueue(const size_t packetlen, const size_t initialslack);
+void SDL_FreeDataQueue(SDL_DataQueue *queue);
+void SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack);
+int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *data, const size_t len);
+size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *buf, const size_t len);
+size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *buf, const size_t len);
+size_t SDL_CountDataQueue(SDL_DataQueue *queue);
+
+/* this sets a section of the data queue aside (possibly allocating memory for it)
+   as if it's been written to, but returns a pointer to that space. You may write
+   to this space until a read would consume it. Writes (and other calls to this
+   function) will safely append their data after this reserved space and can
+   be in flight at the same time. There is no thread safety.
+   If there isn't an existing block of memory that can contain the reserved
+   space, one will be allocated for it. You can not (currently) allocate
+   a space larger than the packetlen requested in SDL_NewDataQueue.
+   Returned buffer is uninitialized.
+   This lets you avoid an extra copy in some cases, but it's safer to use
+   SDL_WriteToDataQueue() unless you know what you're doing.
+   Returns pointer to buffer of at least (len) bytes, NULL on error.
+*/
+void *SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len);
+
+#endif /* SDL_dataqueue_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+

+ 77 - 59
sdl.mod/SDL/src/SDL_error.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -49,6 +49,8 @@ SDL_LookupString(const char *key)
 
 /* Public functions */
 
+static char *SDL_GetErrorMsg(char *errstr, int maxlen);
+
 int
 SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
 {
@@ -110,12 +112,83 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
     }
     va_end(ap);
 
-    /* If we are in debug mode, print out an error message */
-    SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
-
+    if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) {
+        /* If we are in debug mode, print out an error message
+         * Avoid stomping on the static buffer in GetError, just
+         * in case this is called while processing a ShowMessageBox to
+         * show an error already in that static buffer.
+         */
+        char errmsg[SDL_ERRBUFIZE];
+        SDL_GetErrorMsg(errmsg, sizeof(errmsg));
+        SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", errmsg);
+    }
     return -1;
 }
 
+/* Available for backwards compatibility */
+const char *
+SDL_GetError(void)
+{
+    static char errmsg[SDL_ERRBUFIZE];
+
+    return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE);
+}
+
+void
+SDL_ClearError(void)
+{
+    SDL_error *error;
+
+    error = SDL_GetErrBuf();
+    error->error = 0;
+}
+
+/* Very common errors go here */
+int
+SDL_Error(SDL_errorcode code)
+{
+    switch (code) {
+    case SDL_ENOMEM:
+        return SDL_SetError("Out of memory");
+    case SDL_EFREAD:
+        return SDL_SetError("Error reading from datastream");
+    case SDL_EFWRITE:
+        return SDL_SetError("Error writing to datastream");
+    case SDL_EFSEEK:
+        return SDL_SetError("Error seeking in datastream");
+    case SDL_UNSUPPORTED:
+        return SDL_SetError("That operation is not supported");
+    default:
+        return SDL_SetError("Unknown SDL error");
+    }
+}
+
+#ifdef TEST_ERROR
+int
+main(int argc, char *argv[])
+{
+    char buffer[BUFSIZ + 1];
+
+    SDL_SetError("Hi there!");
+    printf("Error 1: %s\n", SDL_GetError());
+    SDL_ClearError();
+    SDL_memset(buffer, '1', BUFSIZ);
+    buffer[BUFSIZ] = 0;
+    SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
+    printf("Error 2: %s\n", SDL_GetError());
+    exit(0);
+}
+#endif
+
+
+/* keep this at the end of the file so it works with GCC builds that don't
+   support "#pragma GCC diagnostic push" ... we'll just leave the warning
+   disabled after this. */
+/* this pragma arrived in GCC 4.2 and causes a warning on older GCCs! Sigh. */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 2))))
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
+
 /* This function has a bit more overhead than most error functions
    so that it supports internationalization and thread-safe errors.
 */
@@ -217,59 +290,4 @@ SDL_GetErrorMsg(char *errstr, int maxlen)
     return (errstr);
 }
 
-/* Available for backwards compatibility */
-const char *
-SDL_GetError(void)
-{
-    static char errmsg[SDL_ERRBUFIZE];
-
-    return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE);
-}
-
-void
-SDL_ClearError(void)
-{
-    SDL_error *error;
-
-    error = SDL_GetErrBuf();
-    error->error = 0;
-}
-
-/* Very common errors go here */
-int
-SDL_Error(SDL_errorcode code)
-{
-    switch (code) {
-    case SDL_ENOMEM:
-        return SDL_SetError("Out of memory");
-    case SDL_EFREAD:
-        return SDL_SetError("Error reading from datastream");
-    case SDL_EFWRITE:
-        return SDL_SetError("Error writing to datastream");
-    case SDL_EFSEEK:
-        return SDL_SetError("Error seeking in datastream");
-    case SDL_UNSUPPORTED:
-        return SDL_SetError("That operation is not supported");
-    default:
-        return SDL_SetError("Unknown SDL error");
-    }
-}
-
-#ifdef TEST_ERROR
-int
-main(int argc, char *argv[])
-{
-    char buffer[BUFSIZ + 1];
-
-    SDL_SetError("Hi there!");
-    printf("Error 1: %s\n", SDL_GetError());
-    SDL_ClearError();
-    SDL_memset(buffer, '1', BUFSIZ);
-    buffer[BUFSIZ] = 0;
-    SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
-    printf("Error 2: %s\n", SDL_GetError());
-    exit(0);
-}
-#endif
-
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
sdl.mod/SDL/src/SDL_error_c.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,8 +24,8 @@
    error messages
 */
 
-#ifndef _SDL_error_c_h
-#define _SDL_error_c_h
+#ifndef SDL_error_c_h_
+#define SDL_error_c_h_
 
 #define ERR_MAX_STRLEN  128
 #define ERR_MAX_ARGS    5
@@ -59,6 +59,6 @@ typedef struct SDL_error
 /* Defined in SDL_thread.c */
 extern SDL_error *SDL_GetErrBuf(void);
 
-#endif /* _SDL_error_c_h */
+#endif /* SDL_error_c_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 14 - 1
sdl.mod/SDL/src/SDL_hints.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -118,6 +118,19 @@ SDL_GetHint(const char *name)
     return env;
 }
 
+SDL_bool
+SDL_GetHintBoolean(const char *name, SDL_bool default_value)
+{
+    const char *hint = SDL_GetHint(name);
+    if (!hint || !*hint) {
+        return default_value;
+    }
+    if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
+        return SDL_FALSE;
+    }
+    return SDL_TRUE;
+}
+
 void
 SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
 {

+ 18 - 4
sdl.mod/SDL/src/SDL_internal.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -18,8 +18,22 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#ifndef _SDL_internal_h
-#define _SDL_internal_h
+#ifndef SDL_internal_h_
+#define SDL_internal_h_
+
+/* Many of SDL's features require _GNU_SOURCE on various platforms */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+/* This is for a variable-length array at the end of a struct:
+    struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; };
+   Use this because GCC 2 needs different magic than other compilers. */
+#if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM) || defined(__cplusplus)
+#define SDL_VARIABLE_LENGTH_ARRAY 1
+#else
+#define SDL_VARIABLE_LENGTH_ARRAY
+#endif
 
 #include "dynapi/SDL_dynapi.h"
 
@@ -33,6 +47,6 @@
 
 #include "SDL_config.h"
 
-#endif
+#endif /* SDL_internal_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 23 - 13
sdl.mod/SDL/src/SDL_log.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -50,9 +50,7 @@ typedef struct SDL_LogLevel
 } SDL_LogLevel;
 
 /* The default log output function */
-static void SDL_LogOutput(void *userdata,
-                          int category, SDL_LogPriority priority,
-                          const char *message);
+static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message);
 
 static SDL_LogLevel *SDL_loglevels;
 static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
@@ -304,15 +302,15 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
     SDL_stack_free(message);
 }
 
-#if defined(__WIN32__)
-/* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */
+#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__)
+/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */
 static int consoleAttached = 0;
 
 /* Handle to stderr output of console. */
 static HANDLE stderrHandle = NULL;
 #endif
 
-static void
+static void SDLCALL
 SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
               const char *message)
 {
@@ -324,10 +322,11 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
         size_t length;
         LPTSTR tstr;
 
-#ifndef __WINRT__
+#if !defined(HAVE_STDIO_H) && !defined(__WINRT__)
         BOOL attachResult;
         DWORD attachError;
         unsigned long charsWritten; 
+        DWORD consoleMode;
 
         /* Maybe attach console and get stderr handle */
         if (consoleAttached == 0) {
@@ -335,7 +334,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
             if (!attachResult) {
                     attachError = GetLastError();
                     if (attachError == ERROR_INVALID_HANDLE) {
-                        OutputDebugString(TEXT("Parent process has no console\r\n"));
+                        /* This is expected when running from Visual Studio */
+                        /*OutputDebugString(TEXT("Parent process has no console\r\n"));*/
                         consoleAttached = -1;
                     } else if (attachError == ERROR_GEN_FAILURE) {
                          OutputDebugString(TEXT("Could not attach to console of parent process\r\n"));
@@ -351,12 +351,17 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
                     /* Newly attached */
                     consoleAttached = 1;
                 }
-			
+
                 if (consoleAttached == 1) {
                         stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
+
+                        if (GetConsoleMode(stderrHandle, &consoleMode) == 0) {
+                            /* WriteConsole fails if the output is redirected to a file. Must use WriteFile instead. */
+                            consoleAttached = 2;
+                        }
                 }
         }
-#endif /* ifndef __WINRT__ */
+#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */
 
         length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1;
         output = SDL_stack_alloc(char, length);
@@ -366,7 +371,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
         /* Output to debugger */
         OutputDebugString(tstr);
        
-#ifndef __WINRT__
+#if !defined(HAVE_STDIO_H) && !defined(__WINRT__)
         /* Screen output to stderr, if console was attached. */
         if (consoleAttached == 1) {
                 if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) {
@@ -375,8 +380,13 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
                         OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
                     }
                 }
+
+        } else if (consoleAttached == 2) {
+            if (!WriteFile(stderrHandle, output, lstrlenA(output), &charsWritten, NULL)) {
+                OutputDebugString(TEXT("Error calling WriteFile\r\n"));
+            }
         }
-#endif /* ifndef __WINRT__ */
+#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */
 
         SDL_free(tstr);
         SDL_stack_free(output);

+ 79 - 22
sdl.mod/SDL/src/atomic/SDL_atomic.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -35,6 +35,48 @@
 #include <atomic.h>
 #endif
 
+/* The __atomic_load_n() intrinsic showed up in different times for different compilers. */
+#if defined(HAVE_GCC_ATOMICS)
+# if defined(__clang__)
+#   if __has_builtin(__atomic_load_n)
+      /* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have.
+         It might be in a later NDK or we might need an extra library? --ryan. */
+#     if !defined(__ANDROID__)
+#       define HAVE_ATOMIC_LOAD_N 1
+#     endif
+#   endif
+# elif defined(__GNUC__)
+#   if (__GNUC__ >= 5)
+#     define HAVE_ATOMIC_LOAD_N 1
+#   endif
+# endif
+#endif
+
+#if defined(__WATCOMC__) && defined(__386__)
+#define HAVE_WATCOM_ATOMICS
+extern _inline int _SDL_xchg_watcom(volatile int *a, int v);
+#pragma aux _SDL_xchg_watcom = \
+  "xchg [ecx], eax" \
+  parm [ecx] [eax] \
+  value [eax] \
+  modify exact [eax];
+
+extern _inline unsigned char _SDL_cmpxchg_watcom(volatile int *a, int newval, int oldval);
+#pragma aux _SDL_cmpxchg_watcom = \
+  "lock cmpxchg [edx], ecx" \
+  "setz al" \
+  parm [edx] [ecx] [eax] \
+  value [al] \
+  modify exact [eax];
+
+extern _inline int _SDL_xadd_watcom(volatile int *a, int v);
+#pragma aux _SDL_xadd_watcom = \
+  "lock xadd [ecx], eax" \
+  parm [ecx] [eax] \
+  value [eax] \
+  modify exact [eax];
+#endif /* __WATCOMC__ && __386__ */
+
 /*
   If any of the operations are not provided then we must emulate some
   of them. That means we need a nice implementation of spin locks
@@ -58,7 +100,7 @@
   Contributed by Bob Pendleton, [email protected]
 */
 
-#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__)
+#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS)
 #define EMULATE_CAS 1
 #endif
 
@@ -88,10 +130,12 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
 {
 #ifdef HAVE_MSC_ATOMICS
     return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval);
-#elif defined(__MACOSX__)  /* !!! FIXME: should we favor gcc atomics? */
-    return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval);
 #elif defined(HAVE_GCC_ATOMICS)
     return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval);
+#elif defined(__MACOSX__)  /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+    return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
 #elif defined(__SOLARIS__) && defined(_LP64)
     return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval);
 #elif defined(__SOLARIS__) && !defined(_LP64)
@@ -119,12 +163,14 @@ SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
     return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval);
 #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86)
     return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval);
-#elif defined(__MACOSX__) && defined(__LP64__)   /* !!! FIXME: should we favor gcc atomics? */
-    return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a);
-#elif defined(__MACOSX__) && !defined(__LP64__)  /* !!! FIXME: should we favor gcc atomics? */
-    return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval);
 #elif defined(HAVE_GCC_ATOMICS)
     return __sync_bool_compare_and_swap(a, oldval, newval);
+#elif defined(__MACOSX__) && defined(__LP64__)  /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+    return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a);
+#elif defined(__MACOSX__) && !defined(__LP64__)  /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+    return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
 #elif defined(__SOLARIS__)
     return (SDL_bool) (atomic_cas_ptr(a, oldval, newval) == oldval);
 #elif EMULATE_CAS
@@ -148,6 +194,8 @@ SDL_AtomicSet(SDL_atomic_t *a, int v)
 {
 #ifdef HAVE_MSC_ATOMICS
     return _InterlockedExchange((long*)&a->value, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return _SDL_xchg_watcom(&a->value, v);
 #elif defined(HAVE_GCC_ATOMICS)
     return __sync_lock_test_and_set(&a->value, v);
 #elif defined(__SOLARIS__) && defined(_LP64)
@@ -170,6 +218,8 @@ SDL_AtomicSetPtr(void **a, void *v)
     return (void *) _InterlockedExchange((long *)a, (long) v);
 #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86)
     return _InterlockedExchangePointer(a, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return (void *) _SDL_xchg_watcom((int *)a, (long)v);
 #elif defined(HAVE_GCC_ATOMICS)
     return __sync_lock_test_and_set(a, v);
 #elif defined(__SOLARIS__)
@@ -188,6 +238,8 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v)
 {
 #ifdef HAVE_MSC_ATOMICS
     return _InterlockedExchangeAdd((long*)&a->value, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return _SDL_xadd_watcom(&a->value, v);
 #elif defined(HAVE_GCC_ATOMICS)
     return __sync_fetch_and_add(&a->value, v);
 #elif defined(__SOLARIS__)
@@ -211,36 +263,41 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v)
 int
 SDL_AtomicGet(SDL_atomic_t *a)
 {
+#ifdef HAVE_ATOMIC_LOAD_N
+    return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST);
+#else
     int value;
     do {
         value = a->value;
     } while (!SDL_AtomicCAS(a, value, value));
     return value;
+#endif
 }
 
 void *
 SDL_AtomicGetPtr(void **a)
 {
+#ifdef HAVE_ATOMIC_LOAD_N
+    return __atomic_load_n(a, __ATOMIC_SEQ_CST);
+#else
     void *value;
     do {
         value = *a;
     } while (!SDL_AtomicCASPtr(a, value, value));
     return value;
+#endif
 }
 
-#ifdef __thumb__
-#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
-__asm__(
-"   .align 2\n"
-"   .globl _SDL_MemoryBarrierRelease\n"
-"   .globl _SDL_MemoryBarrierAcquire\n"
-"_SDL_MemoryBarrierRelease:\n"
-"_SDL_MemoryBarrierAcquire:\n"
-"   mov r0, #0\n"
-"   mcr p15, 0, r0, c7, c10, 5\n"
-"   bx lr\n"
-);
-#endif
-#endif
+void
+SDL_MemoryBarrierReleaseFunction(void)
+{
+    SDL_MemoryBarrierRelease();
+}
+
+void
+SDL_MemoryBarrierAcquireFunction(void)
+{
+    SDL_MemoryBarrierAcquire();
+}
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 18 - 1
sdl.mod/SDL/src/atomic/SDL_spinlock.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -32,6 +32,16 @@
 #include <atomic.h>
 #endif
 
+#if defined(__WATCOMC__) && defined(__386__)
+SDL_COMPILE_TIME_ASSERT(locksize, 4==sizeof(SDL_SpinLock));
+extern _inline int _SDL_xchg_watcom(volatile int *a, int v);
+#pragma aux _SDL_xchg_watcom = \
+  "xchg [ecx], eax" \
+  parm [ecx] [eax] \
+  value [eax] \
+  modify exact [eax];
+#endif /* __WATCOMC__ && __386__ */
+
 /* This function is where all the magic happens... */
 SDL_bool
 SDL_AtomicTryLock(SDL_SpinLock *lock)
@@ -58,6 +68,9 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
     SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
     return (InterlockedExchange((long*)lock, 1) == 0);
 
+#elif defined(__WATCOMC__) && defined(__386__)
+    return _SDL_xchg_watcom(lock, 1) == 0;
+
 #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
     return (__sync_lock_test_and_set(lock, 1) == 0);
 
@@ -119,6 +132,10 @@ SDL_AtomicUnlock(SDL_SpinLock *lock)
     _ReadWriteBarrier();
     *lock = 0;
 
+#elif defined(__WATCOMC__) && defined(__386__)
+    SDL_CompilerBarrier ();
+    *lock = 0;
+
 #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
     __sync_lock_release(lock);
 

File diff suppressed because it is too large
+ 480 - 301
sdl.mod/SDL/src/audio/SDL_audio.c


+ 47 - 23
sdl.mod/SDL/src/audio/SDL_audio_c.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -18,10 +18,35 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+
+#ifndef SDL_audio_c_h_
+#define SDL_audio_c_h_
+
 #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 */
 
+#ifdef HAVE_LIBSAMPLERATE_H
+#include "samplerate.h"
+extern SDL_bool SRC_available;
+extern int SRC_converter;
+extern SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error);
+extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data);
+extern int (*SRC_src_reset)(SRC_STATE *state);
+extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state);
+extern const char* (*SRC_src_strerror)(int error);
+#endif
+
 /* Functions to get a list of "close" audio formats */
 extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format);
 extern SDL_AudioFormat SDL_NextAudioFormat(void);
@@ -29,27 +54,26 @@ extern SDL_AudioFormat SDL_NextAudioFormat(void);
 /* Function to calculate the size and silence for a SDL_AudioSpec */
 extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec);
 
-/* The actual mixing thread function */
-extern int SDLCALL SDL_RunAudio(void *audiop);
-
-/* 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[];
+/* Choose the audio filter functions below */
+extern void SDL_ChooseAudioConverters(void);
+
+/* These pointers get set during SDL_ChooseAudioConverters() to various SIMD implementations. */
+extern SDL_AudioFilter SDL_Convert_S8_to_F32;
+extern SDL_AudioFilter SDL_Convert_U8_to_F32;
+extern SDL_AudioFilter SDL_Convert_S16_to_F32;
+extern SDL_AudioFilter SDL_Convert_U16_to_F32;
+extern SDL_AudioFilter SDL_Convert_S32_to_F32;
+extern SDL_AudioFilter SDL_Convert_F32_to_S8;
+extern SDL_AudioFilter SDL_Convert_F32_to_U8;
+extern SDL_AudioFilter SDL_Convert_F32_to_S16;
+extern SDL_AudioFilter SDL_Convert_F32_to_U16;
+extern SDL_AudioFilter SDL_Convert_F32_to_S32;
+
+/* You need to call SDL_PrepareResampleFilter() before using the internal resampler.
+   SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */
+extern int SDL_PrepareResampleFilter(void);
+extern void SDL_FreeResampleFilter(void);
+
+#endif /* SDL_audio_c_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large
+ 422 - 696
sdl.mod/SDL/src/audio/SDL_audiocvt.c


+ 4 - 3
sdl.mod/SDL/src/audio/SDL_audiodev.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -22,7 +22,7 @@
 
 /* Get the name of the audio device we use for output */
 
-#if SDL_AUDIO_DRIVER_BSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO
+#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO
 
 #include <fcntl.h>
 #include <sys/types.h>
@@ -103,9 +103,10 @@ SDL_EnumUnixAudioDevices_Internal(const int iscapture, const int classic, int (*
 
     if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) {
         int instance = 0;
-        while (instance++ <= 64) {
+        while (instance <= 64) {
             SDL_snprintf(audiopath, SDL_arraysize(audiopath),
                          "%s%d", audiodev, instance);
+            instance++;
             test_device(iscapture, audiopath, flags, test);
         }
     }

+ 1 - 1
sdl.mod/SDL/src/audio/SDL_audiodev_c.h

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages

+ 495 - 15691
sdl.mod/SDL/src/audio/SDL_audiotypecvt.c

@@ -1,7 +1,6 @@
-/* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2015 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -23,15993 +22,798 @@
 #include "../SDL_internal.h"
 #include "SDL_audio.h"
 #include "SDL_audio_c.h"
+#include "SDL_cpuinfo.h"
+#include "SDL_assert.h"
 
-#ifndef DEBUG_CONVERT
-#define DEBUG_CONVERT 0
-#endif
-
+/* !!! FIXME: write NEON code. */
+#define HAVE_NEON_INTRINSICS 0
 
-/* 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
+#ifdef __SSE2__
+#define HAVE_SSE2_INTRINSICS 1
 #endif
 
-/* Don't build any resamplers if you're REALLY saving code space. */
-#ifndef NO_RESAMPLERS
-#define NO_RESAMPLERS 0
+#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 0  /* x86_64 guarantees SSE2. */
+#elif __MACOSX__ && HAVE_SSE2_INTRINSICS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 0  /* Mac OS X/Intel guarantees SSE2. */
+#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 0  /* ARMv8+ promise NEON. */
+#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 0  /* All Apple ARMv7 chips promise NEON support. */
 #endif
 
-/* Don't build any type converters if you're saving code space. */
-#ifndef NO_CONVERTERS
-#define NO_CONVERTERS 0
+/* Set to zero if platform is guaranteed to use a SIMD codepath here. */
+#ifndef NEED_SCALAR_CONVERTER_FALLBACKS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 1
 #endif
 
+/* Function pointers set to a CPU-specific implementation. */
+SDL_AudioFilter SDL_Convert_S8_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_U8_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_S16_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_U16_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_S32_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_S8 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_U8 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_S16 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_U16 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_S32 = NULL;
 
-/* *INDENT-OFF* */
 
-#define DIVBY127 0.0078740157480315f
-#define DIVBY32767 3.05185094759972e-05f
-#define DIVBY2147483647 4.6566128752458e-10f
+#define DIVBY128 0.0078125f
+#define DIVBY32768 0.000030517578125f
+#define DIVBY2147483648 0.00000000046566128730773926
 
-#if !NO_CONVERTERS
 
+#if NEED_SCALAR_CONVERTER_FALLBACKS
 static void SDLCALL
-SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     int i;
-    const Uint8 *src;
-    Sint8 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32");
 
-    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);
+    for (i = cvt->len_cvt; i; --i, --src, --dst) {
+        *dst = ((float) *src) * DIVBY128;
     }
 
+    cvt->len_cvt *= 4;
     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_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_U8_to_F32_Scalar(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;
-    Uint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_U8", "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) *src) << 8);
-        *dst = SDL_SwapLE16(val);
+    for (i = cvt->len_cvt; i; --i, --src, --dst) {
+        *dst = (((float) *src) * DIVBY128) - 1.0f;
     }
 
-    cvt->len_cvt *= 2;
+    cvt->len_cvt *= 4;
     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_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_S16_to_F32_Scalar(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;
-    Sint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_S16", "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) ((*src) ^ 0x80)) << 8);
-        *dst = ((Sint16) SDL_SwapLE16(val));
+    for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) {
+        *dst = ((float) *src) * DIVBY32768;
     }
 
     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_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_U16_to_F32_Scalar(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;
-    Uint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_U16", "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) *src) << 8);
-        *dst = SDL_SwapBE16(val);
+    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+        *dst = (((float) *src) * DIVBY32768) - 1.0f;
     }
 
     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_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_S32_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Sint32 *src = (const Sint32 *) cvt->buf;
+    float *dst = (float *) cvt->buf;
     int i;
-    const Uint8 *src;
-    Sint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_S32", "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) ((*src) ^ 0x80)) << 8);
-        *dst = ((Sint16) SDL_SwapBE16(val));
+    for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) {
+        *dst = (float) (((double) *src) * DIVBY2147483648);
     }
 
-    cvt->len_cvt *= 2;
     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_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint8 *dst = (Sint8 *) cvt->buf;
     int i;
-    const Uint8 *src;
-    Sint32 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8");
 
-    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));
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        const float sample = *src;
+        if (sample > 1.0f) {
+            *dst = 127;
+        } else if (sample < -1.0f) {
+            *dst = -127;
+        } else {
+            *dst = (Sint8)(sample * 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_S8);
     }
 }
 
 static void SDLCALL
-SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_U8_Scalar(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_U8 to AUDIO_S32MSB.\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) ((*src) ^ 0x80)) << 24);
-        *dst = ((Sint32) SDL_SwapBE32(val));
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        const float sample = *src;
+        if (sample > 1.0f) {
+            *dst = 255;
+        } else if (sample < -1.0f) {
+            *dst = 0;
+        } else {
+            *dst = (Uint8)((sample + 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_S32MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_U8);
     }
 }
 
 static void SDLCALL
-SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint16 *dst = (Sint16 *) cvt->buf;
     int i;
-    const Uint8 *src;
-    float *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16");
 
-    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);
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        const float sample = *src;
+        if (sample > 1.0f) {
+            *dst = 32767;
+        } else if (sample < -1.0f) {
+            *dst = -32767;
+        } else {
+            *dst = (Sint16)(sample * 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_S16SYS);
     }
 }
 
 static void SDLCALL
-SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_U16_Scalar(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_U8 to AUDIO_F32MSB.\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) *src) * DIVBY127) - 1.0f);
-        *dst = SDL_SwapFloatBE(val);
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        const float sample = *src;
+        if (sample > 1.0f) {
+            *dst = 65534;
+        } else if (sample < -1.0f) {
+            *dst = 0;
+        } else {
+            *dst = (Uint16)((sample + 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_F32MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS);
     }
 }
 
 static void SDLCALL
-SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint32 *dst = (Sint32 *) cvt->buf;
     int i;
-    const Uint8 *src;
-    Uint8 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32");
 
-    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;
+    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+        const float sample = *src;
+        if (sample > 1.0f) {
+            *dst = 2147483647;
+        } else if (sample < -1.0f) {
+            *dst = -2147483647;
+        } else {
+            *dst = (Sint32)((double)sample * 2147483647.0);
+        }
     }
 
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
     }
 }
-
-static void SDLCALL
-SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 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) ((((Sint8) *src)) ^ 0x80)) << 8);
-        *dst = SDL_SwapLE16(val);
-    }
-
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
-    }
-}
 
+#if HAVE_SSE2_INTRINSICS
 static void SDLCALL
-SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     int i;
-    const Uint8 *src;
-    Sint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 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) ((Sint8) *src)) << 8);
-        *dst = ((Sint16) SDL_SwapLE16(val));
-    }
+    LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)");
 
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+    /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
+    for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) {
+        *dst = ((float) *src) * DIVBY128;
     }
-}
-
-static void SDLCALL
-SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Uint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n");
-#endif
+    src -= 15; dst -= 15;  /* adjust to read SSE blocks from the start. */
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
 
-    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);
-    }
+    /* Make sure src is aligned too. */
+    if ((((size_t) src) & 15) == 0) {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128i *mmsrc = (const __m128i *) src;
+        const __m128i zero = _mm_setzero_si128();
+        const __m128 divby128 = _mm_set1_ps(DIVBY128);
+        while (i >= 16) {   /* 16 * 8-bit */
+            const __m128i bytes = _mm_load_si128(mmsrc);  /* get 16 sint8 into an XMM register. */
+            /* treat as int16, shift left to clear every other sint16, then back right with sign-extend. Now sint16. */
+            const __m128i shorts1 = _mm_srai_epi16(_mm_slli_epi16(bytes, 8), 8);
+            /* right-shift-sign-extend gets us sint16 with the other set of values. */
+            const __m128i shorts2 = _mm_srai_epi16(bytes, 8);
+            /* unpack against zero to make these int32, shift to make them sign-extend, convert to float, multiply. Whew! */
+            const __m128 floats1 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts1, zero), 16), 16)), divby128);
+            const __m128 floats2 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts2, zero), 16), 16)), divby128);
+            const __m128 floats3 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts1, zero), 16), 16)), divby128);
+            const __m128 floats4 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts2, zero), 16), 16)), divby128);
+            /* Interleave back into correct order, store. */
+            _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2));
+            _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2));
+            _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4));
+            _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4));
+            i -= 16; mmsrc--; dst -= 16;
+        }
 
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+        src = (const Sint8 *) mmsrc;
     }
-}
-
-static void SDLCALL
-SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Sint16 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n");
-#endif
+    src += 15; dst += 15;  /* adjust for any scalar finishing. */
 
-    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));
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = ((float) *src) * DIVBY128;
+        i--; src--; dst--;
     }
 
-    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_F32SYS);
     }
 }
 
 static void SDLCALL
-SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_U8_to_F32_SSE2(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;
-    Sint32 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 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) ((Sint8) *src)) << 24);
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
+    LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)");
 
-    cvt->len_cvt *= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+    /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
+    for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) {
+        *dst = (((float) *src) * DIVBY128) - 1.0f;
     }
-}
-
-static void SDLCALL
-SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    Sint32 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n");
-#endif
+    src -= 15; dst -= 15;  /* adjust to read SSE blocks from the start. */
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
 
-    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));
-    }
+    /* Make sure src is aligned too. */
+    if ((((size_t) src) & 15) == 0) {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128i *mmsrc = (const __m128i *) src;
+        const __m128i zero = _mm_setzero_si128();
+        const __m128 divby128 = _mm_set1_ps(DIVBY128);
+        const __m128 minus1 = _mm_set1_ps(-1.0f);
+        while (i >= 16) {   /* 16 * 8-bit */
+            const __m128i bytes = _mm_load_si128(mmsrc);  /* get 16 uint8 into an XMM register. */
+            /* treat as int16, shift left to clear every other sint16, then back right with zero-extend. Now uint16. */
+            const __m128i shorts1 = _mm_srli_epi16(_mm_slli_epi16(bytes, 8), 8);
+            /* right-shift-zero-extend gets us uint16 with the other set of values. */
+            const __m128i shorts2 = _mm_srli_epi16(bytes, 8);
+            /* unpack against zero to make these int32, convert to float, multiply, add. Whew! */
+            /* Note that AVX2 can do floating point multiply+add in one instruction, fwiw. SSE2 cannot. */
+            const __m128 floats1 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts1, zero)), divby128), minus1);
+            const __m128 floats2 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts2, zero)), divby128), minus1);
+            const __m128 floats3 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts1, zero)), divby128), minus1);
+            const __m128 floats4 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts2, zero)), divby128), minus1);
+            /* Interleave back into correct order, store. */
+            _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2));
+            _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2));
+            _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4));
+            _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4));
+            i -= 16; mmsrc--; dst -= 16;
+        }
 
-    cvt->len_cvt *= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+        src = (const Uint8 *) mmsrc;
     }
-}
-
-static void SDLCALL
-SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint8 *src;
-    float *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n");
-#endif
+    src += 15; dst += 15;  /* adjust for any scalar finishing. */
 
-    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);
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = (((float) *src) * DIVBY128) - 1.0f;
+        i--; src--; dst--;
     }
 
     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_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_S16_to_F32_SSE2(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;
-    float *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)");
 
-    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);
+    /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
+    for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) {
+        *dst = ((float) *src) * DIVBY32768;
     }
 
-    cvt->len_cvt *= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
+    src -= 7; dst -= 7;  /* adjust to read SSE blocks from the start. */
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint8 *dst;
+    /* Make sure src is aligned too. */
+    if ((((size_t) src) & 15) == 0) {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
+        while (i >= 8) {   /* 8 * 16-bit */
+            const __m128i ints = _mm_load_si128((__m128i const *) src);  /* get 8 sint16 into an XMM register. */
+            /* treat as int32, shift left to clear every other sint16, then back right with sign-extend. Now sint32. */
+            const __m128i a = _mm_srai_epi32(_mm_slli_epi32(ints, 16), 16);
+            /* right-shift-sign-extend gets us sint32 with the other set of values. */
+            const __m128i b = _mm_srai_epi32(ints, 16);
+            /* Interleave these back into the right order, convert to float, multiply, store. */
+            _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768));
+            _mm_store_ps(dst+4, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768));
+            i -= 8; src -= 8; dst -= 8;
+        }
+    }
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n");
-#endif
+    src += 7; dst += 7;  /* adjust for any scalar finishing. */
 
-    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;
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = ((float) *src) * DIVBY32768;
+        i--; src--; dst--;
     }
 
-    cvt->len_cvt /= 2;
+    cvt->len_cvt *= 2;
     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_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_U16_to_F32_SSE2(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 Uint16 *src;
-    Sint8 *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n");
-#endif
+    LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32 (using SSE2)");
 
-    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);
+    /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
+    for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) {
+        *dst = (((float) *src) * DIVBY32768) - 1.0f;
     }
 
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
-    }
-}
+    src -= 7; dst -= 7;  /* adjust to read SSE blocks from the start. */
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint16 *dst;
+    /* Make sure src is aligned too. */
+    if ((((size_t) src) & 15) == 0) {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
+        const __m128 minus1 = _mm_set1_ps(1.0f);
+        while (i >= 8) {   /* 8 * 16-bit */
+            const __m128i ints = _mm_load_si128((__m128i const *) src);  /* get 8 sint16 into an XMM register. */
+            /* treat as int32, shift left to clear every other sint16, then back right with zero-extend. Now sint32. */
+            const __m128i a = _mm_srli_epi32(_mm_slli_epi32(ints, 16), 16);
+            /* right-shift-sign-extend gets us sint32 with the other set of values. */
+            const __m128i b = _mm_srli_epi32(ints, 16);
+            /* Interleave these back into the right order, convert to float, multiply, store. */
+            _mm_store_ps(dst, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768), minus1));
+            _mm_store_ps(dst+4, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768), minus1));
+            i -= 8; src -= 8; dst -= 8;
+        }
+    }
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n");
-#endif
+    src += 7; dst += 7;  /* adjust for any scalar finishing. */
 
-    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));
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = (((float) *src) * DIVBY32768) - 1.0f;
+        i--; src--; dst--;
     }
 
+    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_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const Sint32 *src = (const Sint32 *) cvt->buf;
+    float *dst = (float *) cvt->buf;
     int i;
-    const Uint16 *src;
-    Uint16 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB 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 = SDL_SwapLE16(*src);
-        *dst = SDL_SwapBE16(val);
-    }
+    LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)");
 
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+    /* Get dst aligned to 16 bytes */
+    for (i = cvt->len_cvt / sizeof (Sint32); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+        *dst = (float) (((double) *src) * DIVBY2147483648);
     }
-}
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint16 *dst;
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+    SDL_assert(!i || ((((size_t) src) & 15) == 0));
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n");
-#endif
+    {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128d divby2147483648 = _mm_set1_pd(DIVBY2147483648);
+        const __m128i *mmsrc = (const __m128i *) src;
+        while (i >= 4) {   /* 4 * sint32 */
+            const __m128i ints = _mm_load_si128(mmsrc);
+            /* bitshift the whole register over, so _mm_cvtepi32_pd can read the top ints in the bottom of the vector. */
+            const __m128d doubles1 = _mm_mul_pd(_mm_cvtepi32_pd(_mm_srli_si128(ints, 8)), divby2147483648);
+            const __m128d doubles2 = _mm_mul_pd(_mm_cvtepi32_pd(ints), divby2147483648);
+            /* convert to float32, bitshift/or to get these into a vector to store. */
+            _mm_store_ps(dst, _mm_castsi128_ps(_mm_or_si128(_mm_slli_si128(_mm_castps_si128(_mm_cvtpd_ps(doubles1)), 8), _mm_castps_si128(_mm_cvtpd_ps(doubles2)))));
+            i -= 4; mmsrc++; dst += 4;
+        }
+        src = (const Sint32 *) mmsrc;
+    }
 
-    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));
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = (float) (((double) *src) * DIVBY2147483648);
+        i--; src++; dst++;
     }
 
     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)
+SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint8 *dst = (Sint8 *) cvt->buf;
     int i;
-    const Uint16 *src;
-    Sint32 *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB 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_SwapLE16(*src)) ^ 0x8000)) << 16);
-        *dst = ((Sint32) SDL_SwapLE32(val));
-    }
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)");
 
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+    /* Get dst aligned to 16 bytes */
+    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+        *dst = (Sint8) (*src * 127.0f);
     }
-}
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint32 *dst;
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n");
-#endif
+    /* Make sure src is aligned too. */
+    if ((((size_t) src) & 15) == 0) {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128 mulby127 = _mm_set1_ps(127.0f);
+        __m128i *mmdst = (__m128i *) dst;
+        while (i >= 16) {   /* 16 * float32 */
+            const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby127));  /* load 4 floats, convert to sint32 */
+            const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby127));  /* load 4 floats, convert to sint32 */
+            const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+8), mulby127));  /* load 4 floats, convert to sint32 */
+            const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+12), mulby127));  /* load 4 floats, convert to sint32 */
+            _mm_store_si128(mmdst, _mm_packs_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4)));  /* pack down, store out. */
+            i -= 16; src += 16; mmdst++;
+        }
+        dst = (Sint8 *) mmdst;
+    }
 
-    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));
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = (Sint8) (*src * 127.0f);
+        i--; src++; dst++;
     }
 
-    cvt->len_cvt *= 2;
+    cvt->len_cvt /= 4;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_S8);
     }
 }
 
 static void SDLCALL
-SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Uint8 *dst = (Uint8 *) cvt->buf;
     int i;
-    const Uint16 *src;
-    float *dst;
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB 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_SwapLE16(*src)) * DIVBY32767) - 1.0f);
-        *dst = SDL_SwapFloatLE(val);
-    }
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
 
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+    /* Get dst aligned to 16 bytes */
+    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+        *dst = (Uint8) ((*src + 1.0f) * 127.0f);
     }
-}
 
-static void SDLCALL
-SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    float *dst;
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n");
-#endif
+    /* Make sure src is aligned too. */
+    if ((((size_t) src) & 15) == 0) {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128 add1 = _mm_set1_ps(1.0f);
+        const __m128 mulby127 = _mm_set1_ps(127.0f);
+        __m128i *mmdst = (__m128i *) dst;
+        while (i >= 16) {   /* 16 * float32 */
+            const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src), add1), mulby127));  /* load 4 floats, convert to sint32 */
+            const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+4), add1), mulby127));  /* load 4 floats, convert to sint32 */
+            const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+8), add1), mulby127));  /* load 4 floats, convert to sint32 */
+            const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+12), add1), mulby127));  /* load 4 floats, convert to sint32 */
+            _mm_store_si128(mmdst, _mm_packus_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4)));  /* pack down, store out. */
+            i -= 16; src += 16; mmdst++;
+        }
+        dst = (Uint8 *) mmdst;
+    }
 
-    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);
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = (Uint8) ((*src + 1.0f) * 127.0f);
+        i--; src++; dst++;
     }
 
-    cvt->len_cvt *= 2;
+    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_U8);
     }
 }
 
 static void SDLCALL
-SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint16 *dst = (Sint16 *) cvt->buf;
     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;
-    }
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)");
 
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+    /* Get dst aligned to 16 bytes */
+    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+        *dst = (Sint16) (*src * 32767.0f);
     }
-}
 
-static void SDLCALL
-SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint8 *dst;
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n");
-#endif
+    /* Make sure src is aligned too. */
+    if ((((size_t) src) & 15) == 0) {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128 mulby32767 = _mm_set1_ps(32767.0f);
+        __m128i *mmdst = (__m128i *) dst;
+        while (i >= 8) {   /* 8 * float32 */
+            const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767));  /* load 4 floats, convert to sint32 */
+            const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767));  /* load 4 floats, convert to sint32 */
+            _mm_store_si128(mmdst, _mm_packs_epi32(ints1, ints2));  /* pack to sint16, store out. */
+            i -= 8; src += 8; mmdst++;
+        }
+        dst = (Sint16 *) mmdst;
+    }
 
-    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);
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = (Sint16) (*src * 32767.0f);
+        i--; src++; dst++;
     }
 
     cvt->len_cvt /= 2;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS);
     }
 }
 
 static void SDLCALL
-SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_U16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Uint16 *dst = (Uint16 *) cvt->buf;
     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);
-    }
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16 (using SSE2)");
 
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+    /* Get dst aligned to 16 bytes */
+    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+        *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
     }
-}
-
-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);
-    }
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
 
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+    /* Make sure src is aligned too. */
+    if ((((size_t) src) & 15) == 0) {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        /* This calculates differently than the scalar path because SSE2 can't
+           pack int32 data down to unsigned int16. _mm_packs_epi32 does signed
+           saturation, so that would corrupt our data. _mm_packus_epi32 exists,
+           but not before SSE 4.1. So we convert from float to sint16, packing
+           that down with legit signed saturation, and then xor the top bit
+           against 1. This results in the correct unsigned 16-bit value, even
+           though it looks like dark magic. */
+        const __m128 mulby32767 = _mm_set1_ps(32767.0f);
+        const __m128i topbit = _mm_set1_epi16(-32768);
+        __m128i *mmdst = (__m128i *) dst;
+        while (i >= 8) {   /* 8 * float32 */
+            const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767));  /* load 4 floats, convert to sint32 */
+            const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767));  /* load 4 floats, convert to sint32 */
+            _mm_store_si128(mmdst, _mm_xor_si128(_mm_packs_epi32(ints1, ints2), topbit));  /* pack to sint16, xor top bit, store out. */
+            i -= 8; src += 8; mmdst++;
+        }
+        dst = (Uint16 *) mmdst;
     }
-}
-
-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));
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
+        i--; src++; dst++;
     }
 
+    cvt->len_cvt /= 2;
     if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+        cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS);
     }
 }
 
 static void SDLCALL
-SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
+    const float *src = (const float *) cvt->buf;
+    Sint32 *dst = (Sint32 *) cvt->buf;
     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));
-    }
+    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)");
 
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+    /* Get dst aligned to 16 bytes */
+    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+        *dst = (Sint32) (((double) *src) * 2147483647.0);
     }
-}
 
-static void SDLCALL
-SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Sint32 *dst;
+    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+    SDL_assert(!i || ((((size_t) src) & 15) == 0));
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n");
-#endif
+    {
+        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+        const __m128d mulby2147483647 = _mm_set1_pd(2147483647.0);
+        __m128i *mmdst = (__m128i *) dst;
+        while (i >= 4) {   /* 4 * float32 */
+            const __m128 floats = _mm_load_ps(src);
+            /* bitshift the whole register over, so _mm_cvtps_pd can read the top floats in the bottom of the vector. */
+            const __m128d doubles1 = _mm_mul_pd(_mm_cvtps_pd(_mm_castsi128_ps(_mm_srli_si128(_mm_castps_si128(floats), 8))), mulby2147483647);
+            const __m128d doubles2 = _mm_mul_pd(_mm_cvtps_pd(floats), mulby2147483647);
+            _mm_store_si128(mmdst, _mm_or_si128(_mm_slli_si128(_mm_cvtpd_epi32(doubles1), 8), _mm_cvtpd_epi32(doubles2)));
+            i -= 4; src += 4; mmdst++;
+        }
+        dst = (Sint32 *) mmdst;
+    }
 
-    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));
+    /* Finish off any leftovers with scalar operations. */
+    while (i) {
+        *dst = (Sint32) (((double) *src) * 2147483647.0);
+        i--; src++; dst++;
     }
 
-    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_S32SYS);
     }
 }
-
-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)
+void SDL_ChooseAudioConverters(void)
 {
-    int i;
-    const Uint16 *src;
-    float *dst;
-
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n");
-#endif
+    static SDL_bool converters_chosen = SDL_FALSE;
 
-    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);
+    if (converters_chosen) {
+        return;
     }
 
-    cvt->len_cvt *= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
-    }
-}
+#define SET_CONVERTER_FUNCS(fntype) \
+        SDL_Convert_S8_to_F32 = SDL_Convert_S8_to_F32_##fntype; \
+        SDL_Convert_U8_to_F32 = SDL_Convert_U8_to_F32_##fntype; \
+        SDL_Convert_S16_to_F32 = SDL_Convert_S16_to_F32_##fntype; \
+        SDL_Convert_U16_to_F32 = SDL_Convert_U16_to_F32_##fntype; \
+        SDL_Convert_S32_to_F32 = SDL_Convert_S32_to_F32_##fntype; \
+        SDL_Convert_F32_to_S8 = SDL_Convert_F32_to_S8_##fntype; \
+        SDL_Convert_F32_to_U8 = SDL_Convert_F32_to_U8_##fntype; \
+        SDL_Convert_F32_to_S16 = SDL_Convert_F32_to_S16_##fntype; \
+        SDL_Convert_F32_to_U16 = SDL_Convert_F32_to_U16_##fntype; \
+        SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
+        converters_chosen = SDL_TRUE
 
-static void SDLCALL
-SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
-{
-    int i;
-    const Uint16 *src;
-    Uint8 *dst;
+#if HAVE_SSE2_INTRINSICS
+    if (SDL_HasSSE2()) {
+        SET_CONVERTER_FUNCS(SSE2);
+        return;
+    }
+#endif
 
-#if DEBUG_CONVERT
-    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n");
+#if NEED_SCALAR_CONVERTER_FALLBACKS
+    SET_CONVERTER_FUNCS(Scalar);
 #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;
-    }
+#undef SET_CONVERTER_FUNCS
 
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
-    }
+    SDL_assert(converters_chosen == SDL_TRUE);
 }
 
-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: */

Some files were not shown because too many files changed in this diff