fix for misparsing of sound length in "data" chunk of WAVE, this should fix stereo...
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 28 Apr 2002 20:15:05 +0000 (20:15 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 28 Apr 2002 20:15:05 +0000 (20:15 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1781 d7cf8633-e32d-0410-b094-e92efae38249

snd_mem.c

index 3290038..a54e84c 100644 (file)
--- a/snd_mem.c
+++ b/snd_mem.c
@@ -266,6 +266,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)
        sc = s->sfxcache = Mem_Alloc(s->mempool, len + sizeof(sfxcache_t));
        if (!sc)
        {
+               Mem_FreePool(&s->mempool);
                Mem_Free(data);
                return NULL;
        }
@@ -331,7 +332,7 @@ void FindNextChunk(char *name)
                        data_p = NULL;
                        return;
                }
-               
+
                data_p += 4;
                iff_chunk_len = GetLittleLong();
                if (iff_chunk_len < 0)
@@ -455,7 +456,7 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength)
        }
 
        data_p += 4;
-       samples = GetLittleLong () / info.width;
+       samples = GetLittleLong () / info.width / info.channels;
 
        if (info.samples)
        {