Opened 14 years ago

Closed 14 years ago

#4400 closed defect (fixed)

DIG: Cutscene does not stop existing music before playing

Reported by: SF/auroris Owned by: aquadran
Priority: high Component: Engine: SCUMM
Version: Keywords:
Cc: Game: The Dig


Cutscenes, pre-rendered video sequences, do not properly stop scene music before playing. The result is overlapping music tracks playing. Bug is present in Win32 ScummVM Daily Snapshot (build from Subversion trunk, 3154K Win32 exe file, last update: July 12, 2009, 10:10 am) Bug is also present in ScummVM 0.13.1 Release.

Ticket imported from: #2820389. Ticket imported from: bugs/4400.

Change History (9)

comment:1 by lordhoto, 14 years ago

Summary: Cutscene does not stop existing music before playingDIG: Cutscene does not stop existing music before playing

comment:2 by eriktorbjorn, 14 years ago

Owner: set to aquadran

comment:3 by eriktorbjorn, 14 years ago

The problem may be that during cutscenes, we don't call scummLoop_handleSound(), so even if the script says that a track should be faded or a sequence stopped or whatever, it won't happen until possibly after the cutscene has finished.

Assigning to aquadran, since he's the one who actually understands Digital iMUSE.

comment:4 by eriktorbjorn, 14 years ago

To clarify a bit, I've looked at what happens at the beginning of the game, when setting off the explosives. This is part of the game script:

[01D9] (BA) talkActor("/COCKPIT.013/Confirm everybody inside.",13) [0204] (A9) wait.waitForMessage() [0206] (BA) talkActor("/COCKPIT.014/All in, Cora.",3) [0225] (A9) wait.waitForMessage() [0227] (AC) soundKludge([4097,2020]) [0231] (AC) soundKludge([4096,8]) [023B] (43) VAR_MAINMENU_KEY = 0 [0241] (A4) VAR_VIDEONAME[0] = "sq2.san" [0250] (C9) kernelSetFunctions.startVideo([0])

The "soundKludge" opcodes translate to:

ImuseSetSequence(2020) ImuseSetState(8)

I'm not very familiar with how Digital iMUSE works, but ImuseSetSequence() eventually leads to playDigMusic() being called for "seqExplosion1b", with transition tpe 6. This sets _stopingSequence to 1.

The _stopingSequence counter is handled in refreshScripts(), where it eventually triggers a "force restore music state" event, i.e. ImuseSetSequence(0). I'm speculating that this would stop the music. However, it won't happen until after the SMUSH cutscene has finished, because we don't call refreshScripts() while the cutscene is running.

The refreshScripts() function is called from scummLoop_handleSound(). That's why I said that maybe the problem is that we don't call that function.

comment:5 by sev-, 14 years ago

This bug is nice to get fixed before the release. Raising priority for keeping the track.

comment:6 by sev-, 14 years ago

Priority: normalhigh

comment:7 by aquadran, 14 years ago

I made change to smush loop to handle imuse state, stopingSequence works as suppose to work. But final result is not what suppose to work. Imuse must work while smush playing, it must finish still played old song. But it start new one that one which suppose to work after animation sequence. I have idea how to workaround this.

comment:8 by aquadran, 14 years ago

Resolution: fixed
Status: newclosed

comment:9 by aquadran, 14 years ago

I made workaround which fix issue.

Note: See TracTickets for help on using tickets.