Opened 10 years ago

Closed 10 years ago

Last modified 12 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)

by m-kiewitz, 10 years ago

Attachment: scummvm-sci-musicfix.patch added

SCI: Music/sound-engine fix

comment:1 by wjp, 10 years ago

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 by m-kiewitz, 10 years ago

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 by wjp, 10 years ago

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 by m-kiewitz, 10 years ago

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 by wjp, 10 years ago

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 by wjp, 10 years ago

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 by m-kiewitz, 10 years ago

Works just fine now

comment:8 by m-kiewitz, 10 years ago

Resolution: wontfix
Status: newclosed

comment:9 by sev-, 10 years ago

Owner: set to wjp
Resolution: wontfixfixed

comment:10 by digitall, 12 months ago

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