SDL_mixer: update after SDL_Swap rename in SDL3

From 32da70c3f2fbdd8c7e9ca06de798421e309fb0ed Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 12 Jun 2024 02:17:06 +0200
Subject: [PATCH] update after SDL_Swap rename in SDL3

---
 src/codecs/load_voc.c          |  10 +-
 src/codecs/music_wav.c         |  42 ++--
 src/codecs/timidity/instrum.c  |   6 +-
 src/codecs/timidity/readmidi.c |   4 +-
 src/effect_position.c          | 440 ++++++++++++++++-----------------
 5 files changed, 251 insertions(+), 251 deletions(-)

diff --git a/src/codecs/load_voc.c b/src/codecs/load_voc.c
index 204f6433..c8de8d5f 100644
--- a/src/codecs/load_voc.c
+++ b/src/codecs/load_voc.c
@@ -102,7 +102,7 @@ static int voc_check_header(SDL_IOStream *src)
         return 0;
     }
 
-    datablockofs = SDL_SwapLE16(datablockofs);
+    datablockofs = SDL_Swap16LE(datablockofs);
 
     if (SDL_SeekIO(src, datablockofs, SDL_IO_SEEK_SET) != datablockofs) {
         return 0;
@@ -183,7 +183,7 @@ static int voc_get_block(SDL_IOStream *src, vs_t *v, SDL_AudioSpec *spec)
                 if (SDL_ReadIO(src, &new_rate_long, sizeof(new_rate_long)) != sizeof(new_rate_long)) {
                     return 0;
                 }
-                new_rate_long = SDL_SwapLE32(new_rate_long);
+                new_rate_long = SDL_Swap32LE(new_rate_long);
                 if (new_rate_long == 0) {
                     Mix_SetError("VOC Sample rate is zero?");
                     return 0;
@@ -226,7 +226,7 @@ static int voc_get_block(SDL_IOStream *src, vs_t *v, SDL_AudioSpec *spec)
                 if (SDL_ReadIO(src, &period, sizeof(period)) != sizeof(period)) {
                     return 0;
                 }
-                period = SDL_SwapLE16(period);
+                period = SDL_Swap16LE(period);
 
                 if (SDL_ReadIO(src, &uc, sizeof(uc)) != sizeof(uc)) {
                     return 0;
@@ -267,7 +267,7 @@ static int voc_get_block(SDL_IOStream *src, vs_t *v, SDL_AudioSpec *spec)
                 if (SDL_ReadIO(src, &new_rate_short, sizeof(new_rate_short)) != sizeof(new_rate_short)) {
                     return 0;
                 }
-                new_rate_short = SDL_SwapLE16(new_rate_short);
+                new_rate_short = SDL_Swap16LE(new_rate_short);
                 if (new_rate_short == 0) {
                    Mix_SetError("VOC sample rate is zero");
                    return 0;
@@ -362,7 +362,7 @@ static Uint32 voc_read(SDL_IOStream *src, vs_t *v, Uint8 *buf, SDL_AudioSpec *sp
             #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
             Uint16 *samples = (Uint16 *)buf;
             for (; v->rest > 0; v->rest -= 2) {
-                *samples = SDL_SwapLE16(*samples);
+                *samples = SDL_Swap16LE(*samples);
                 samples++;
             }
             #endif
diff --git a/src/codecs/music_wav.c b/src/codecs/music_wav.c
index 340ce899..4b9783c8 100644
--- a/src/codecs/music_wav.c
+++ b/src/codecs/music_wav.c
@@ -436,9 +436,9 @@ static int fetch_float64le(void *context, int length)
 static int MS_ADPCM_Init(ADPCM_DecoderState *state, const Uint8 *chunk_data, Uint32 chunk_length)
 {
     const WaveFMTEx *fmt = (WaveFMTEx *)chunk_data;
-    const Uint16 channels = SDL_SwapLE16(fmt->format.channels);
-    const Uint16 blockalign = SDL_SwapLE16(fmt->format.blockalign);
-    const Uint16 bitspersample = SDL_SwapLE16(fmt->format.bitspersample);
+    const Uint16 channels = SDL_Swap16LE(fmt->format.channels);
+    const Uint16 blockalign = SDL_Swap16LE(fmt->format.blockalign);
+    const Uint16 bitspersample = SDL_Swap16LE(fmt->format.bitspersample);
     const size_t blockheadersize = (size_t)channels * 7;
     const size_t blockdatasize = (size_t)blockalign - blockheadersize;
     const size_t blockframebitsize = (size_t)bitspersample * channels;
@@ -474,8 +474,8 @@ static int MS_ADPCM_Init(ADPCM_DecoderState *state, const Uint8 *chunk_data, Uin
         return Mix_SetError("Could not read MS ADPCM format header");
     }
 
-    cbExtSize = SDL_SwapLE16(fmt->cbSize);
-    samplesperblock = SDL_SwapLE16(fmt->Samples.samplesperblock);
+    cbExtSize = SDL_Swap16LE(fmt->cbSize);
+    samplesperblock = SDL_Swap16LE(fmt->Samples.samplesperblock);
     /* Number of coefficient pairs. A pair has two 16-bit integers. */
     coeffcount = chunk_data[20] | ((size_t)chunk_data[21] << 8);
     /* bPredictor, the integer offset into the coefficients array, is only
@@ -711,10 +711,10 @@ static int MS_ADPCM_DecodeBlockData(ADPCM_DecoderState *state)
 static int IMA_ADPCM_Init(ADPCM_DecoderState *state, const Uint8 *chunk_data, Uint32 chunk_length)
 {
     const WaveFMTEx *fmt = (WaveFMTEx *)chunk_data;
-    const Uint16 formattag = SDL_SwapLE16(fmt->format.encoding);
-    const Uint16 channels = SDL_SwapLE16(fmt->format.channels);
-    const Uint16 blockalign = SDL_SwapLE16(fmt->format.blockalign);
-    const Uint16 bitspersample = SDL_SwapLE16(fmt->format.bitspersample);
+    const Uint16 formattag = SDL_Swap16LE(fmt->format.encoding);
+    const Uint16 channels = SDL_Swap16LE(fmt->format.channels);
+    const Uint16 blockalign = SDL_Swap16LE(fmt->format.blockalign);
+    const Uint16 bitspersample = SDL_Swap16LE(fmt->format.bitspersample);
     const size_t blockheadersize = (size_t)channels * 4;
     const size_t blockdatasize = (size_t)blockalign - blockheadersize;
     const size_t blockframebitsize = (size_t)bitspersample * channels;
@@ -742,9 +742,9 @@ static int IMA_ADPCM_Init(ADPCM_DecoderState *state, const Uint8 *chunk_data, Ui
          * format because the extensible header has wSampePerBlocks too.
          */
     } else if (chunk_length >= 20) {
-        Uint16 cbExtSize = SDL_SwapLE16(fmt->cbSize);
+        Uint16 cbExtSize = SDL_Swap16LE(fmt->cbSize);
         if (cbExtSize >= 2) {
-            samplesperblock = SDL_SwapLE16(fmt->Samples.samplesperblock);
+            samplesperblock = SDL_Swap16LE(fmt->Samples.samplesperblock);
         }
     }
 
@@ -1365,7 +1365,7 @@ static SDL_bool ParseFMT(WAV_Music *wave, Uint32 chunk_length)
     SDL_zero(fmt);
     SDL_memcpy(&fmt, chunk, size);
 
-    wave->encoding = SDL_SwapLE16(fmt.format.encoding);
+    wave->encoding = SDL_Swap16LE(fmt.format.encoding);
 
     if (wave->encoding == EXTENSIBLE_CODE) {
         if (size < sizeof(fmt)) {
@@ -1373,7 +1373,7 @@ static SDL_bool ParseFMT(WAV_Music *wave, Uint32 chunk_length)
             SDL_free(chunk);
             return SDL_FALSE;
         }
-        wave->encoding = (Uint16)SDL_SwapLE32(fmt.subencoding);
+        wave->encoding = (Uint16)SDL_Swap32LE(fmt.subencoding);
     }
 
     /* Decode the audio data format */
@@ -1410,8 +1410,8 @@ static SDL_bool ParseFMT(WAV_Music *wave, Uint32 chunk_length)
     }
     SDL_free(chunk);
 
-    spec->freq = (int)SDL_SwapLE32(fmt.format.frequency);
-    bits = (int)SDL_SwapLE16(fmt.format.bitspersample);
+    spec->freq = (int)SDL_Swap32LE(fmt.format.frequency);
+    bits = (int)SDL_Swap16LE(fmt.format.bitspersample);
     switch (bits) {
         case 4:
             switch(wave->encoding) {
@@ -1464,7 +1464,7 @@ static SDL_bool ParseFMT(WAV_Music *wave, Uint32 chunk_length)
             Mix_SetError("Unknown PCM format with %d bits", bits);
             return SDL_FALSE;
     }
-    spec->channels = (Uint8) SDL_SwapLE16(fmt.format.channels);
+    spec->channels = (Uint8) SDL_Swap16LE(fmt.format.channels);
     wave->samplesize = spec->channels * (bits / 8);
     /* SDL_CalculateAudioSpec */
     wave->buflen = SDL_AUDIO_BITSIZE(spec->format) / 8;
@@ -1520,11 +1520,11 @@ static SDL_bool ParseSMPL(WAV_Music *wave, Uint32 chunk_length)
     }
     chunk = (SamplerChunk *)data;
 
-    for (i = 0; i < SDL_SwapLE32(chunk->sample_loops); ++i) {
+    for (i = 0; i < SDL_Swap32LE(chunk->sample_loops); ++i) {
         const Uint32 LOOP_TYPE_FORWARD = 0;
-        Uint32 loop_type = SDL_SwapLE32(chunk->loops[i].type);
+        Uint32 loop_type = SDL_Swap32LE(chunk->loops[i].type);
         if (loop_type == LOOP_TYPE_FORWARD) {
-            AddLoopPoint(wave, SDL_SwapLE32(chunk->loops[i].play_count), SDL_SwapLE32(chunk->loops[i].start), SDL_SwapLE32(chunk->loops[i].end));
+            AddLoopPoint(wave, SDL_Swap32LE(chunk->loops[i].play_count), SDL_Swap32LE(chunk->loops[i].start), SDL_Swap32LE(chunk->loops[i].end));
         }
     }
 
@@ -1540,8 +1540,8 @@ static void read_meta_field(Mix_MusicMetaTags *tags, Mix_MusicMetaTag tag_type,
     char *field = NULL;
     *i += 4;
     len = isID3 ?
-          SDL_SwapBE32(*((Uint32 *)(data + *i))) : /* ID3  */
-          SDL_SwapLE32(*((Uint32 *)(data + *i))); /* LIST */
+          SDL_Swap32BE(*((Uint32 *)(data + *i))) : /* ID3  */
+          SDL_Swap32LE(*((Uint32 *)(data + *i))); /* LIST */
     if (len > chunk_length) {
         return; /* Do nothing due to broken lenght */
     }
diff --git a/src/codecs/timidity/instrum.c b/src/codecs/timidity/instrum.c
index d8b6d86f..cce6dcd2 100644
--- a/src/codecs/timidity/instrum.c
+++ b/src/codecs/timidity/instrum.c
@@ -225,10 +225,10 @@ static void load_instrument(MidiSong *song, const char *name,
   thing = tmpchar;
 #define READ_SHORT(thing)					\
   if (2 != SDL_ReadIO(io, &tmpshort, 2)) goto badread;	\
-  thing = SDL_SwapLE16(tmpshort);
+  thing = SDL_Swap16LE(tmpshort);
 #define READ_LONG(thing)					\
   if (4 != SDL_ReadIO(io, &tmplong, 4))  goto badread;	\
-  thing = (Sint32)SDL_SwapLE32((Uint32)tmplong);
+  thing = (Sint32)SDL_Swap32LE((Uint32)tmplong);
 
       SDL_SeekIO(io, 7, SDL_IO_SEEK_CUR); /* Skip the wave name */
 
@@ -393,7 +393,7 @@ static void load_instrument(MidiSong *song, const char *name,
 	  Sint16 *tmp16=(Sint16 *)sp->data,s;
 	  while (k--)
 	    {
-	      s=SDL_SwapLE16(*tmp16);
+	      s=SDL_Swap16LE(*tmp16);
 	      *tmp16++=s;
 	    }
 	}
diff --git a/src/codecs/timidity/readmidi.c b/src/codecs/timidity/readmidi.c
index 8095c6e9..3ff15bbc 100644
--- a/src/codecs/timidity/readmidi.c
+++ b/src/codecs/timidity/readmidi.c
@@ -331,7 +331,7 @@ static int read_track(MidiSong *song, int append)
       SNDDBG(("Can't read track header.\n"));
       return -1;
     }
-  len=(Sint32)SDL_SwapBE32((Uint32)len);
+  len=(Sint32)SDL_Swap32BE((Uint32)len);
   next_pos = SDL_TellIO(song->io) + len;
   if (SDL_memcmp(tmp, "MTrk", 4))
     {
@@ -582,7 +582,7 @@ MidiEvent *read_midi_file(MidiSong *song, Sint32 *count, Sint32 *sp)
 	return NULL;
       }
   }
-  len=(Sint32)SDL_SwapBE32((Uint32)len);
+  len=(Sint32)SDL_Swap32BE((Uint32)len);
   if (SDL_memcmp(tmp, "MThd", 4) || len < 6)
     {
       SNDDBG(("Not a MIDI file!\n"));
diff --git a/src/effect_position.c b/src/effect_position.c
index cd828c8c..f79b2c25 100644
--- a/src/effect_position.c
+++ b/src/effect_position.c
@@ -647,17 +647,17 @@ static void SDLCALL _Eff_position_s16lsb(int chan, void *stream, int len, void *
 #endif
 
     for (i = 0; i < len; i += sizeof(Sint16) * 2) {
-        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+0))) *
+        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+0))) *
                                     left_f) * dist_f);
-        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+1))) *
+        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+1))) *
                                     right_f) * dist_f);
         if (opp) {
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
         }
         else {
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
         }
     }
 }
@@ -671,38 +671,38 @@ static void SDLCALL _Eff_position_s16lsb_c4(int chan, void *stream, int len, voi
     (void)chan;
 
     for (i = 0; i < len; i += sizeof(Sint16) * 4) {
-        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+0))) *
+        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+0))) *
                                     args->left_f) * args->distance_f);
-        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+1))) *
+        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+1))) *
                                     args->right_f) * args->distance_f);
-        Sint16 swaplr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+1))) *
+        Sint16 swaplr = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+1))) *
                                     args->left_rear_f) * args->distance_f);
-        Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+2))) *
+        Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+2))) *
                                     args->right_rear_f) * args->distance_f);
         switch (args->room_angle) {
         case 0:
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr);
             break;
         case 90:
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaplr);
             break;
         case 180:
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
             break;
         case 270:
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
             break;
         }
     }
@@ -718,50 +718,50 @@ static void SDLCALL _Eff_position_s16lsb_c6(int chan, void *stream, int len, voi
     (void)chan;
 
     for (i = 0; i < len; i += sizeof(Sint16) * 6) {
-        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+0))) *
+        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+0))) *
                                     args->left_f) * args->distance_f);
-        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+1))) *
+        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+1))) *
                                     args->right_f) * args->distance_f);
-        Sint16 swaplr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+2))) *
+        Sint16 swaplr = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+2))) *
                                     args->left_rear_f) * args->distance_f);
-        Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+3))) *
+        Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+3))) *
                                     args->right_rear_f) * args->distance_f);
-        Sint16 swapce = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+4))) *
+        Sint16 swapce = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+4))) *
                                     args->center_f) * args->distance_f);
-        Sint16 swapwf = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+5))) *
+        Sint16 swapwf = (Sint16) ((((float) (Sint16) SDL_Swap16LE(*(ptr+5))) *
                                     args->lfe_f) * args->distance_f);
         switch (args->room_angle) {
         case 0:
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapce);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapce);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapwf);
             break;
         case 90:
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr)/2 + (Sint16) SDL_SwapLE16(swaprr)/2;
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr)/2 + (Sint16) SDL_Swap16LE(swaprr)/2;
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapwf);
             break;
         case 180:
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr)/2 + (Sint16) SDL_SwapLE16(swaplr)/2;
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr)/2 + (Sint16) SDL_Swap16LE(swaplr)/2;
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapwf);
             break;
         case 270:
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapl)/2 + (Sint16) SDL_SwapLE16(swaplr)/2;
-            *(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapl)/2 + (Sint16) SDL_Swap16LE(swaplr)/2;
+            *(ptr++) = (Sint16) SDL_Swap16LE(swapwf);
             break;
         }
     }
@@ -779,12 +779,12 @@ static void SDLCALL _Eff_position_s16msb(int chan, void *stream, int len, void *
     (void)chan;
 
     for (i = 0; i < len; i += sizeof(Sint16) * 2) {
-        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+0))) *
+        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+0))) *
                                     left_f) * dist_f);
-        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+1))) *
+        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+1))) *
                                     right_f) * dist_f);
-        *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
-        *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
+        *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
+        *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
     }
 }
 
@@ -798,38 +798,38 @@ static void SDLCALL _Eff_position_s16msb_c4(int chan, void *stream, int len, voi
     (void)chan;
 
     for (i = 0; i < len; i += sizeof(Sint16) * 4) {
-        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+0))) *
+        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+0))) *
                                     args->left_f) * args->distance_f);
-        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+1))) *
+        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+1))) *
                                     args->right_f) * args->distance_f);
-        Sint16 swaplr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+2))) *
+        Sint16 swaplr = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+2))) *
                                     args->left_rear_f) * args->distance_f);
-        Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+3))) *
+        Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+3))) *
                                     args->right_rear_f) * args->distance_f);
         switch (args->room_angle) {
         case 0:
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr);
             break;
         case 90:
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaplr);
             break;
         case 180:
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
             break;
         case 270:
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
             break;
         }
     }
@@ -845,51 +845,51 @@ static void SDLCALL _Eff_position_s16msb_c6(int chan, void *stream, int len, voi
     (void)chan;
 
     for (i = 0; i < len; i += sizeof(Sint16) * 6) {
-        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+0))) *
+        Sint16 swapl = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+0))) *
                                     args->left_f) * args->distance_f);
-        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+1))) *
+        Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+1))) *
                                     args->right_f) * args->distance_f);
-        Sint16 swaplr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+2))) *
+        Sint16 swaplr = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+2))) *
                                     args->left_rear_f) * args->distance_f);
-        Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+3))) *
+        Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+3))) *
                                     args->right_rear_f) * args->distance_f);
-        Sint16 swapce = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+4))) *
+        Sint16 swapce = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+4))) *
                                     args->center_f) * args->distance_f);
-        Sint16 swapwf = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+5))) *
+        Sint16 swapwf = (Sint16) ((((float) (Sint16) SDL_Swap16BE(*(ptr+5))) *
                                     args->lfe_f) * args->distance_f);
 
         switch (args->room_angle) {
         case 0:
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapce);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapce);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapwf);
             break;
         case 90:
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr)/2 + (Sint16) SDL_SwapBE16(swaprr)/2;
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr)/2 + (Sint16) SDL_Swap16BE(swaprr)/2;
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapwf);
             break;
         case 180:
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr)/2 + (Sint16) SDL_SwapBE16(swaplr)/2;
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr)/2 + (Sint16) SDL_Swap16BE(swaplr)/2;
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapwf);
             break;
         case 270:
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapl)/2 + (Sint16) SDL_SwapBE16(swaplr)/2;
-            *(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaplr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swaprr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapr);
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapl)/2 + (Sint16) SDL_Swap16BE(swaplr)/2;
+            *(ptr++) = (Sint16) SDL_Swap16BE(swapwf);
             break;
         }
     }
@@ -915,17 +915,17 @@ static void SDLCALL _Eff_position_s32lsb(int chan, void *stream, int len, void *
 #endif
 
     for (i = 0; i < len; i += sizeof(Sint32) * 2) {
-        Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_SwapLE32(*(ptr+0))) *
+        Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_Swap32LE(*(ptr+0))) *
                                     left_f) * dist_f);
-        Sint32 swapr = (Sint32) ((((float) (Sint32) SDL_SwapLE32(*(ptr+1))) *
+        Sint32 swapr = (Sint32) ((((float) (Sint32) SDL_Swap32LE(*(ptr+1))) *
                                     right_f) * dist_f);
         if (opp) {
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapr);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapl);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapl);
         }
         else {
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapl);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapl);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapr);
         }
     }
 }
@@ -940,38 +940,38 @@ static void SDLCALL _Eff_position_s32lsb_c4(int chan, void *stream, int len, voi
     (void)chan;
 
     for (i = 0; i < len; i += sizeof(Sint32) * 4) {
-        Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_SwapLE32(*(ptr+0))) *
+        Sint32 swapl = (Sint32) ((((float) (Sint32) SDL_Swap32LE(*(ptr+0))) *
                                     args->left_f) * args->distance_f);
-        Sint32 swapr = (Sint32) ((((float) (Sint32) SDL_SwapLE32(*(ptr+1))) *
+        Sint32 swapr = (Sint32) ((((float) (Sint32) SDL_Swap32LE(*(ptr+1))) *
                                     args->right_f) * args->distance_f);
-        Sint32 swaplr = (Sint32) ((((float) (Sint32) SDL_SwapLE32(*(ptr+1))) *
+        Sint32 swaplr = (Sint32) ((((float) (Sint32) SDL_Swap32LE(*(ptr+1))) *
                                     args->left_rear_f) * args->distance_f);
-        Sint32 swaprr = (Sint32) ((((float) (Sint32) SDL_SwapLE32(*(ptr+2))) *
+        Sint32 swaprr = (Sint32) ((((float) (Sint32) SDL_Swap32LE(*(ptr+2))) *
                                     args->right_rear_f) * args->distance_f);
         switch (args->room_angle) {
         case 0:
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapl);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapr);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swaplr);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swaprr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapl);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swaplr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swaprr);
             break;
         case 90:
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapr);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swaprr);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapl);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swaplr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swaprr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapl);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swaplr);
             break;
         case 180:
-            *(ptr++) = (Sint32) SDL_SwapLE32(swaprr);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swaplr);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapr);
-            *(ptr++) = (Sint32) SDL_SwapLE32(swapl);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swaprr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swaplr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapr);
+            *(ptr++) = (Sint32) SDL_Swap32LE(swapl);
             break;
         case 270:
-            *(ptr++) = (Sint32) SDL_SwapLE32(swaplr);
-            *(ptr++) = 

(Patch may be truncated, please check the link at the top of this post.)