aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-10-03 09:16:14 +0000
committerMax Horn2002-10-03 09:16:14 +0000
commita9d25bb24ad1c6f7222f145a58aa15529e21ff91 (patch)
treed055da0f47b8f9587a57a0447446314d12e0a12c
parent121e26cf51de4fca136b68e93f29ce7be1ab2b59 (diff)
downloadscummvm-rg350-a9d25bb24ad1c6f7222f145a58aa15529e21ff91.tar.gz
scummvm-rg350-a9d25bb24ad1c6f7222f145a58aa15529e21ff91.tar.bz2
scummvm-rg350-a9d25bb24ad1c6f7222f145a58aa15529e21ff91.zip
patch #617417: Sound fix for Sam & Max demo
svn-id: r5085
-rw-r--r--scumm/sound.cpp42
1 files changed, 29 insertions, 13 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index defa3946c3..6fc38a817f 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -248,8 +248,8 @@ void Sound::playSound(int sound) {
else if (READ_UINT32_UNALIGNED(ptr) == MKID('SBL ')) {
debug(2, "Using SBL sound effect");
- // TODO - Figuring out how the SBL chunk works. Here's an
- // example:
+ // TODO - Figuring out how the SBL chunk works. Here's
+ // an example:
//
// 53 42 4c 20 00 00 11 ae |SBL ....|
// 41 55 68 64 00 00 00 03 |AUhd....|
@@ -259,20 +259,36 @@ void Sound::playSound(int sound) {
// 7e 7f 7f 80 80 7f 7f 7f |~.......|
// 7f 80 80 7f 7e 7d 7d 7e |....~}}~|
// 7e 7e 7e 7e 7e 7e 7e 7f |~~~~~~~.|
- // 7f 7f 7f 80 80 80 80 80 |........|
- // 80 81 80 80 7f 7f 80 85 |........|
- // 8b 8b 83 78 72 6d 6f 75 |...xrmou|
- // 7a 78 77 7d 83 84 83 81 |zxw}....|
//
- // The length of the AUhd chunk always seems to be 3 bytes.
- // Let's skip that for now.
+ // The length of the AUhd chunk always seems to be 3
+ // bytes. Let's skip that for now.
//
- // The starting offset, length and sample rate is all pure
- // guesswork. The result sounds reasonable to me, but I've
- // never heard the original.
-
+ // The starting offset, length and sample rate is all
+ // pure guesswork. The result sounds reasonable to me,
+ // but I've never heard the original.
+ //
+ // I've since discovered that the non-interactive
+ // Sam & Max demo also uses SBL sound effects, but
+ // with different sub-chunks. Example:
+ //
+ // 53 42 4c 20 00 01 15 6e |SBL ...n|
+ // 57 56 68 64 00 00 00 03 |WVhd....|
+ // 00 00 80 57 56 64 74 00 |...WVdt.|
+ // 01 15 5b 01 56 15 01 a6 |..[.V...|
+ // 00 80 80 80 80 80 80 80 |........|
+ // 80 80 80 80 80 80 80 80 |........|
+ // 80 80 80 80 80 80 80 80 |........|
+ // 80 80 80 80 80 80 80 80 |........|
+ //
+ // I'm going to assume that the sample frequency is
+ // the only important difference between the two.
+
+ if (READ_UINT32_UNALIGNED(ptr + 8) == MKID('WVhd'))
+ rate = 11025;
+ else
+ rate = 8000;
+
size = READ_BE_UINT32_UNALIGNED(ptr + 4) - 27;
- rate = 8000;
// Allocate a sound buffer, copy the data into it, and play
char *sound = (char*)malloc(size);