diff options
Diffstat (limited to 'src/i_sdlsound.c')
-rw-r--r-- | src/i_sdlsound.c | 14 |
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); |