X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=snd_wav.c;h=7eb118d7a1c2b64563c037dba1f8282d59f1d13a;hb=a37cd455150d17f68eec25ae6fa57808d940f1ae;hp=01c7993f3d8a7f7d5b8124eb0c1bc768b457bc8e;hpb=8d376b57de94bafd3bae224088b469649c853028;p=xonotic%2Fdarkplaces.git diff --git a/snd_wav.c b/snd_wav.c index 01c7993f..7eb118d7 100644 --- a/snd_wav.c +++ b/snd_wav.c @@ -65,7 +65,7 @@ static int GetLittleLong(void) return val; } -static void FindNextChunk(char *name) +static void FindNextChunk(const char *name) { while (1) { @@ -91,7 +91,7 @@ static void FindNextChunk(char *name) } } -static void FindChunk(char *name) +static void FindChunk(const char *name) { last_chunk = iff_data; FindNextChunk (name); @@ -297,10 +297,9 @@ qboolean S_LoadWavFile (const char *filename, sfx_t *sfx) //if (info.channels == 2) // Log_Printf("stereosounds.log", "%s\n", sfx->name); -#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) + if (info.width == 2 && mem_bigendian) { unsigned int len, i; short* ptr; @@ -310,7 +309,6 @@ qboolean S_LoadWavFile (const char *filename, sfx_t *sfx) for (i = 0; i < len; i++) ptr[i] = LittleShort (ptr[i]); } -#endif wav_format.speed = info.rate; wav_format.width = info.width; @@ -330,7 +328,7 @@ qboolean S_LoadWavFile (const char *filename, sfx_t *sfx) if (info.loopstart < 0) sfx->loopstart = sfx->total_length; else - sfx->loopstart = (double)info.loopstart * (double)snd_renderbuffer->format.speed / (double)sb->format.speed; + sfx->loopstart = (unsigned int) ((double)info.loopstart * (double)sb->format.speed / (double)info.rate); sfx->loopstart = min(sfx->loopstart, sfx->total_length); sfx->flags &= ~SFXFLAG_STREAMED;