commit 68f51552ff65668deaeef923fc8c496d64ea9a60
Merge: 52db6da5 b0519667
Author: Simon Howard <fraggle@gmail.com>
AuthorDate: Sun Mar 6 21:08:32 2011 +0000
Commit: Simon Howard <fraggle@gmail.com>
CommitDate: Sun Mar 6 21:08:32 2011 +0000
Merge from trunk.
Subversion-branch: /branches/raven-branch
Subversion-revision: 2292
NEWS | 6 ++
opl/dbopl.c | 208 +++++++++++++++++++++++++++++++---------------------
opl/dbopl.h | 5 +-
opl/ioperm_sys.c | 16 ++--
src/i_sdlsound.c | 14 +++-
src/setup/display.c | 10 ++-
6 files changed, 162 insertions(+), 97 deletions(-)
diff --cc src/i_sdlsound.c
index 1cfafa6f,14a5147f..2bce2fb1
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@@ -473,20 -352,65 +473,32 @@@ static boolean CacheSFX(sfxinfo_t *sfxi
// 16 bit sample rate field, 32 bit length field
- *samplerate = (data[3] << 8) | data[2];
- *length = (data[7] << 24) | (data[6] << 16) | (data[5] << 8) | data[4];
+ samplerate = (data[3] << 8) | data[2];
+ length = (data[7] << 24) | (data[6] << 16) | (data[5] << 8) | data[4];
- // 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 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)
++ if (length > lumplen - 8 || length <= 48)
{
- W_ReleaseLumpNum(*lumpnum);
- return false;
+ return false;
}
- // 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;
-}
-
-
-// Load and convert a sound effect
-// Returns true if successful
-
-static boolean CacheSFX_SDL(int sound)
-{
- int lumpnum;
- int samplerate;
- uint32_t length;
- byte *data;
-
-#ifdef HAVE_LIBSAMPLERATE
- assert(!use_libsamplerate); // Should be using I_PrecacheSounds_SRC instead
-#endif
-
- if (!LoadSoundLump(sound, &lumpnum, &samplerate, &length, &data))
- return false;
++ data += 16;
++ length -= 32;
+
// Sample rate conversion
- // sound_chunks[sound].alen and abuf are determined by ExpandSoundData.
- sound_chunks[sound].allocated = 1;
- sound_chunks[sound].volume = MIX_MAX_VOLUME;
-
- ExpandSoundData_SDL(data,
- samplerate,
- length,
- &sound_chunks[sound]);
+ ExpandSoundData(sfxinfo, data + 8, samplerate, length);
#ifdef DEBUG_DUMP_WAVS
{