summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2011-03-06 20:59:51 +0000
committerSimon Howard2011-03-06 20:59:51 +0000
commitb0519667da8edcea1592a0ba7b0dfa4b4709e034 (patch)
tree7da721cf2aa11c4cae9e93f8bdf5986085353bbd /src
parent6a5d123fc662bcdbc08d973e3b8b79a95f24fa51 (diff)
downloadchocolate-doom-b0519667da8edcea1592a0ba7b0dfa4b4709e034.tar.gz
chocolate-doom-b0519667da8edcea1592a0ba7b0dfa4b4709e034.tar.bz2
chocolate-doom-b0519667da8edcea1592a0ba7b0dfa4b4709e034.zip
Discard very short sound effects and strip lead-in / lead-out samples
that apparently aren't played by Vanilla Doom (thanks Quasar). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2291
Diffstat (limited to 'src')
-rw-r--r--src/i_sdlsound.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c
index a26a81dd..14a5147f 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -359,7 +359,13 @@ static boolean LoadSoundLump(int sound,
// greater than the length of the lump itself, this is an invalid
// sound lump.
- if (*length > lumplen - 8)
+ // We also discard sound lumps that are less than 49 samples long,
+ // as this is how DMX behaves - although the actual cut-off length
+ // seems to vary slightly depending on the sample rate. This needs
+ // further investigation to better understand the correct
+ // behavior.
+
+ if (*length > lumplen - 8 || *length <= 48)
{
W_ReleaseLumpNum(*lumpnum);
return false;
@@ -368,6 +374,12 @@ static boolean LoadSoundLump(int sound,
// Prune header
*data_ref += 8;
+ // The DMX sound library seems to skip the first 16 and last 16
+ // bytes of the lump - reason unknown.
+
+ *data_ref += 16;
+ *length -= 32;
+
return true;
}