X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=snd_wav.c;h=d23a8b5126487ca3b01196c8c5c17ffc61492565;hb=8881e4f2a4725a8e45db56db3e280b2361c5b3fe;hp=258b501c4d7cf08c6e132f7987f481147c6bb5b5;hpb=ff0e0fd9ea6ce001e9c2c6f9e18ecda6aef15d10;p=xonotic%2Fdarkplaces.git diff --git a/snd_wav.c b/snd_wav.c index 258b501c..d23a8b51 100644 --- a/snd_wav.c +++ b/snd_wav.c @@ -22,10 +22,10 @@ */ -#include "quakedef.h" +#include "darkplaces.h" #include "snd_main.h" #include "snd_wav.h" - +#include "sound.h" typedef struct wavinfo_s { @@ -265,7 +265,7 @@ const snd_fetcher_t wav_fetcher = { WAV_GetSamplesFloat, NULL, WAV_FreeSfx }; S_LoadWavFile ============== */ -qboolean S_LoadWavFile (const char *filename, sfx_t *sfx) +qbool S_LoadWavFile (const char *filename, sfx_t *sfx) { fs_offset_t filesize; unsigned char *data; @@ -303,19 +303,6 @@ qboolean S_LoadWavFile (const char *filename, sfx_t *sfx) //if (info.channels == 2) // Log_Printf("stereosounds.log", "%s\n", sfx->name); - // We must convert the WAV data from little endian - // to the machine endianess before resampling it - if (info.width == 2 && mem_bigendian) - { - unsigned int len, i; - short* ptr; - - len = info.samples * info.channels; - ptr = (short*)(data + info.dataofs); - for (i = 0; i < len; i++) - ptr[i] = LittleShort (ptr[i]); - } - sfx->format.speed = info.rate; sfx->format.width = info.width; sfx->format.channels = info.channels; @@ -357,5 +344,6 @@ qboolean S_LoadWavFile (const char *filename, sfx_t *sfx) sfx->loopstart = min(sfx->loopstart, sfx->total_length); sfx->flags &= ~SFXFLAG_STREAMED; + Mem_Free(data); // we already got a copy of this in fetcher_data return true; }