Opened 2 years ago

Closed 21 months ago

Last modified 21 months ago

#13555 closed defect (fixed)

LSL6HIRES: Door close sound plays at wrong moment

Reported by: RayKoopa Owned by: sluicebox
Priority: normal Component: Engine: SCI
Version: Keywords: sound
Cc: Game: Leisure Suit Larry 6

Description (last modified by RayKoopa)

ScummVM 2.7.0git101-gf37f00331ca (Jun 8 2022 14:35:39)
Game language: English
Game version: Hi-Res 1.000.000
Windows 11 21H2 10.0.22000.675

The soft bang sound when a door was closed plays at the wrong moment in case of the Sauna door:

Steps to reproduce:

  • Start a new game.
  • Go to the Health Spa, grab a towel.
  • Go to the Locker Room and undress with the towel.
  • Go to the mud baths, and enter the Sauna.
  • Leave the Sauna. Notice how the door does not close with a sound.
  • Do anything else generating a voice line. The door close sound will play once the voice line ended. - or - Click Game > Save-O-Matic™️ and accept or cancel the dialog to play the sound.

This also happens with the following doors:

  • Electro-Shock to Mud Bath
  • Mud Bath to Weight Room
  • Aerobics Room to Swimming Pool

This does not happen in lo-res.

In DOSBox, the door close sound plays once the door closes, as with any other door.

Attachments (1)

lsl6hires.003 (34.4 KB ) - added by RayKoopa 2 years ago.

Download all attachments as: .zip

Change History (8)

by RayKoopa, 2 years ago

Attachment: lsl6hires.003 added

comment:1 by RayKoopa, 2 years ago

Description: modified (diff)

comment:2 by sluicebox, 2 years ago

Interesting, I don't know why this works in the original. The scripts pause the door-close sound immediately after playing it. Completing speech audio resumes paused sounds. Why does the door sound not pause in the original?

When entering mud bath (room 400) from the steam room (370) or the shock room (380):

  1. The door closes in handsOff mode
  2. Sound 33 plays with a Sound:flags value of 0
  3. LSL6:handsOn is immediately called
  4. LSL6:handsOn pauses all sounds that don't have flag $0001 set

Most sound objects in this game set flag $0001, the no-pause flag. Or, scenes are programmed like the entrance from the shower which waits on sound 33 to complete before calling handsOn.

That's why you can hear sound 33 briefly play and quickly stop. The background bubbles sound also pauses. In the original, only the bubbles pause. Maybe there's a timing thing where pausing doesn't work if the sample has just been queued to start? Or maybe a sample can't be interrupted with a pause at all? (The bubbles loop and aren't a sample)

I can eventually do some script-patch experiments to test some of these theories in the original.

comment:3 by RayKoopa, 2 years ago

Unrelated, but this reminds me of a bug in a custom game engine I worked on once.
A sound was queued to start but also told to stop before the sound system could put it into the "playing sounds" list. When telling it to stop, it immediately iterated over this list, didn't find the sound, and thus never set it's immediate stop state, so the sound just started playing completely once the sound system did the next update...
Maybe SCI works kinda similar, who knows - well at least I sadly don't ;-)

comment:4 by RayKoopa, 2 years ago

Description: modified (diff)

comment:5 by sluicebox, 22 months ago

I see what's going on now: the interpreter for this game didn't support pausing digital samples *at all*. kDoSoundPause on a digital sample had no effect. That feature was added in the next version of the interpreter, dated a month later in 1994 in PQ4 CD.

ScummVM is doing the right thing by pausing the door sound, but the game scripts are doing the wrong thing by asking ScummVM to pause the door sound. They got away with it in the original because that feature didn't work so it didn't matter.

This sound code already has a lot of version checks so I want to proceed carefully with changes. But the problem is now known and the solution will be for ScummVM to not do anything when kDoSoundFade is called on digital sounds for certain games.

comment:6 by sluicebox, 21 months ago

Owner: set to sluicebox
Resolution: fixed
Status: newclosed

comment:7 by RayKoopa, 21 months ago

Can confirm it's fixed!

Note: See TracTickets for help on using tickets.