summaryrefslogtreecommitdiff
path: root/src/i_sdlsound.c
diff options
context:
space:
mode:
authorSimon Howard2011-03-06 21:08:32 +0000
committerSimon Howard2011-03-06 21:08:32 +0000
commit68f51552ff65668deaeef923fc8c496d64ea9a60 (patch)
treea23137a2b6124e33a31948690f751c15094d2174 /src/i_sdlsound.c
parent52db6da5814c867fc6dd6bb0ec5d51d76b1fcc4e (diff)
parentb0519667da8edcea1592a0ba7b0dfa4b4709e034 (diff)
downloadchocolate-doom-68f51552ff65668deaeef923fc8c496d64ea9a60.tar.gz
chocolate-doom-68f51552ff65668deaeef923fc8c496d64ea9a60.tar.bz2
chocolate-doom-68f51552ff65668deaeef923fc8c496d64ea9a60.zip
Merge from trunk.
Subversion-branch: /branches/raven-branch Subversion-revision: 2292
Diffstat (limited to 'src/i_sdlsound.c')
-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 1cfafa6f..2bce2fb1 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -479,11 +479,23 @@ static boolean CacheSFX(sfxinfo_t *sfxinfo)
// If the header specifies that the length of the sound is 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)
{
return false;
}
+ // The DMX sound library seems to skip the first 16 and last 16
+ // bytes of the lump - reason unknown.
+
+ data += 16;
+ length -= 32;
+
// Sample rate conversion
ExpandSoundData(sfxinfo, data + 8, samplerate, length);