X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=snd_mem.c;h=d0671eb8740fb88ef143148178beb8500933442f;hp=7535b38c51b396fb2953ad284bf39ec2ab6bd686;hb=1e1dbc1c5b89ae4ab8cdd9b32dc6413c67f5dd84;hpb=dce24d2d5c76d048a9558c4c46cea47f8866eb0c diff --git a/snd_mem.c b/snd_mem.c index 7535b38c..d0671eb8 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -#include "ogg.h" +#include "snd_ogg.h" /* @@ -56,7 +56,7 @@ void ResampleSfx (sfxcache_t *sc, qbyte *data, char *name) ((signed char *)sc->data)[i] = ((unsigned char *)data)[i] - 128; else //if (sc->width == 2) // 16bit for (i = 0;i < srclength;i++) - ((short *)sc->data)[i] = LittleShort (((short *)data)[i]); + ((short *)sc->data)[i] = ((short *)data)[i]; } else { @@ -74,8 +74,8 @@ void ResampleSfx (sfxcache_t *sc, qbyte *data, char *name) fracstep <<= 1; for (i=0 ; iwidth = info.width; sc->stereo = info.channels == 2; +#if BYTE_ORDER != LITTLE_ENDIAN + // We must convert the WAV data from little endian + // to the machine endianess before resampling it + if (info.width == 2) + { + int i; + short* ptr; + + len = info.samples * info.channels; + ptr = (short*)(data + info.dataofs); + for (i = 0; i < len; i++) + ptr[i] = LittleShort (ptr[i]); + } +#endif + ResampleSfx(sc, data + info.dataofs, s->name); Mem_Free(data);