summaryrefslogtreecommitdiff
path: root/src/i_sdlsound.c
diff options
context:
space:
mode:
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 03e9d85b..e3118a82 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -664,11 +664,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
if (!ExpandSoundData(sfxinfo, data + 8, samplerate, length))