[Scummvm-tracker] [ScummVM :: Bugs] #15369: SCUMM: MI (Sega MegaCD) - audio pops at the end of every SBL sound effect
ScummVM :: Bugs
trac at scummvm.org
Thu Feb 20 10:37:58 UTC 2025
#15369: SCUMM: MI (Sega MegaCD) - audio pops at the end of every SBL sound effect
------------------------------+------------------------------
Reporter: dwatteau | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: Engine: SCUMM
Version: | Resolution:
Keywords: segacd,sega,audio | Game: Monkey Island 1
------------------------------+------------------------------
Comment (by eriktorbjorn):
This is my attempt at dissecting the "close door" sound, since it's small
enough to visualize as text:
[[Image(door-closing.png)]]
* The `SBL ` tag (4 bytes)
* The size of the SBL block (4 bytes). This is 114, and covers every
single byte of the remaining resource, including padding.
* The `AUhd` and `AUdt` data that we don't care about (19 bytes). This is
where the `+27` comes from.
* This is where the scrambled data begins. The first byte should always be
1 after unscrambling.
* The next 3 bytes are the size of the audio data, plus 2. 90 - 2 = 88.
It's probably to account for the next two bytes not being part of the
audio data.
* The next byte is the sample rate.
* This is followed by 1 byte of padding.
* The next 88 bytes is the audio data.
* The final byte is probably just to pad it to an even number of bytes.
So we need to unscramble 6 bytes of VOC header data, and 88 bytes of audio
data. 96 bytes in total.
But what we actually unscramble is 114 - 27 = 87 bytes.
I think I see now! We're adding 27 to the resource pointer to get to the
VOC header, which is correct. But we also subtract 27 from the ''SBL''
size, which is incorrect. Because the SBL data does not include the first
8 bytes of the resource. We need to subtract by 19 instead. As far as I
can tell, this bug has been there for 20+ years.
{{{
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 3fb7b6e2050..55e1dbf609a 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -272,7 +272,7 @@ void Sound::triggerSound(int soundID) {
// 80 80 80 80 80 80 80 80 |........|
// 80 80 80 80 80 80 80 80 |........|
- size = READ_BE_UINT32(ptr + 4) - 27;
+ size = READ_BE_UINT32(ptr + 4) - 19;
ptr += 27;
// Fingolfin says: after eyeballing a single SEGA
}}}
This size is only used for the descrambling, so changing it should not
affect anything else. I can't commit right now, but I'll do it later today
unless there are any objections.
--
Ticket URL: <https://bugs.scummvm.org/ticket/15369#comment:5>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list