Opened 10 years ago

Closed 10 years ago

Last modified 8 months ago

#9037 closed patch (fixed)

SCI: Music/Sound-engine fix

Reported by: m-kiewitz Owned by: wjp
Priority: normal Component: Engine: SCI
Keywords: Cc:
Game: Quest for Glory 2

Description

Hi there,

Music in intro of QfG2 is ending after a sample is played (and not only there). It's quite strange, when debugging it it worked. So I guessed it must be some race condition, locked the update() function via mutex and it seems to work now.

Regards
M. Kiewitz

Ticket imported from: #2816695. Ticket imported from: patches/1142.

Attachments (1)

scummvm-sci-musicfix.patch (807 bytes) - added by m-kiewitz 10 years ago.
SCI: Music/sound-engine fix

Download all attachments as: .zip

Change History (11)

Changed 10 years ago by m-kiewitz

Attachment: scummvm-sci-musicfix.patch added

SCI: Music/sound-engine fix

comment:1 Changed 10 years ago by wjp

It doesn't look like updateMultiSong is ever called twice at the same time during the QfG2 intro, so adding a mutex to the updateMultiSong() function exclusively shouldn't have any effect. (And on my system the problem still exists after your patch.)

According to Walter, this problem was probably introduced when song iterators were rewritten some time ago.

comment:2 Changed 10 years ago by m-kiewitz

I tried the game several times and it works now just fine. I don't really understand it. What platform do you use? Could you try on win32?
What happens if you set a breakpoint on SfxState::updateMultiSong?
Also what happens if you rem out
case SI_FINISHED:
setSongStatus(song, SOUND_STATUS_STOPPED);
update();
/* ...fall through... */
in SfxState::sfx_poll_specific?

comment:3 Changed 10 years ago by wjp

I'm on Linux. If I remove the entire SI_FINISHED case, everything freezes as soon as the first sound effect (the genie's right hand hitting the mountain) is played.

If I break on updateMultiSong (and just hit continue whenever it is triggered), the music freezes after the genie claps his hands. (This is what happens nearly all the time for me, with or without debugging.)

One thing I noticed in the console output, I get the following message exactly when the music freezes, and it doesn't show up when the music continues:

[song-iterator] Song finished. mask = 0c1f, cm=0000

comment:4 Changed 10 years ago by m-kiewitz

And if you remove update() only in the SI_FINISHED case?

Song finished is misleading. This actually means the sample played.
Anyway I added several debug messages to my version. Do you have Win32 anywhere? I would like to upload my binary just to check, if it's just my notebook that's now working or if its the extra debug messages (I guess they could delay some code for some msecs, so the bug doesnt occur)

comment:5 Changed 10 years ago by wjp

I just committed r42112, which should fix this bug. Can you confirm that it now works?

I changed the behaviour of a morphing TeeSongIterator. It now transfer its death listeners to its remaining child.

comment:6 Changed 10 years ago by wjp

r42113 fixes a related bug causing hanging notes in QfG2. Both these regressions were caused by our port of the incomplete (or broken, depending on your perspective) "death listener" of FreeSCI.

comment:7 Changed 10 years ago by m-kiewitz

Works just fine now

comment:8 Changed 10 years ago by m-kiewitz

Resolution: wontfix
Status: newclosed

comment:9 Changed 10 years ago by sev-

Owner: set to wjp
Resolution: wontfixfixed

comment:10 Changed 8 months ago by digitall

Component: Engine: SCI
Game: Quest for Glory 2
Note: See TracTickets for help on using tickets.