*/
-#include "quakedef.h"
+#include "darkplaces.h"
#include "snd_main.h"
#include "snd_wav.h"
-
+#include "sound.h"
typedef struct wavinfo_s
{
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;
//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;
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;
}