From 6fa3c10aedfc0a6277428707edd8b3b35d1df2c6 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 2 Jan 2010 17:16:59 +0000 Subject: SCI/newmusic: fading signal handling changed... fixes lsl1demo and gk1demo svn-id: r46891 --- engines/sci/sfx/music.cpp | 3 ++- engines/sci/sfx/music.h | 1 + engines/sci/sfx/soundcmd.cpp | 16 ++++++---------- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'engines/sci/sfx') diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index cedcd1c923..852321bb37 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -535,6 +535,7 @@ MusicEntry::MusicEntry() { fadeTicker = 0; fadeTickerStep = 0; fadeSetVolume = false; + fadeCompleted = false; status = kSoundStopped; @@ -572,7 +573,7 @@ void MusicEntry::doFade() { if (((fadeStep > 0) && (fadeVolume >= fadeTo)) || ((fadeStep < 0) && (fadeVolume <= fadeTo))) { fadeVolume = fadeTo; fadeStep = 0; - signal = SIGNAL_OFFSET; + fadeCompleted = true; } volume = fadeVolume; diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index f59e594939..5f101ed39f 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -94,6 +94,7 @@ public: uint32 fadeTicker; uint32 fadeTickerStep; bool fadeSetVolume; + bool fadeCompleted; SoundStatus status; diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index f7ff987838..e8e599bc5c 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -803,16 +803,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { } break; case SIGNAL_OFFSET: - // Check if this signal is the end of the track or the end of fading effect. - // If this came from a fading effect, don't stop the track here, it'll be stopped - // by the engine scripts - if (musicSlot->fadeSetVolume) { - musicSlot->fadeSetVolume = false; - // Notify the game scripts that music fading is done - PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET); - } else { - cmdStopSound(obj, 0); - } + cmdStopSound(obj, 0); break; default: // Sync the signal of the sound object @@ -821,6 +812,11 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { } } + if (musicSlot->fadeCompleted) { + musicSlot->fadeCompleted = false; + PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET); + } + // Sync loop selector for SCI0 if (_soundVersion <= SCI_VERSION_0_LATE) PUT_SEL32V(_segMan, obj, loop, musicSlot->loop); -- cgit v1.2.3