[Scummvm-git-logs] scummvm master -> 4e214c4f2a60d4fdf2531ccf30029f883a72481c

bluegr noreply at scummvm.org
Sun May 1 10:46:11 UTC 2022


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c2975276a3 SCI: fix music handling during auto-save
4e214c4f2a SCI: add comment to SciMusic::pauseAll()


Commit: c2975276a3541ade356498f6a53e3ca97928b9e1
    https://github.com/scummvm/scummvm/commit/c2975276a3541ade356498f6a53e3ca97928b9e1
Author: athrxx (athrxx at scummvm.org)
Date: 2022-05-01T13:46:05+03:00

Commit Message:
SCI: fix music handling during auto-save

Changed paths:
    engines/sci/sound/music.cpp


diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index ff1e252007b..270d0981b2d 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -261,10 +261,17 @@ void SciMusic::clearPlayList() {
 
 void SciMusic::pauseAll(bool pause) {
 	const MusicList::iterator end = _playList.end();
+	bool alreadyUnpaused = (_globalPause <= 0);
+
 	if (pause)
 		_globalPause++;
 	else
-		_globalPause = MAX<int>(_globalPause - 1, 0);
+		_globalPause--;
+
+	bool stillUnpaused = (_globalPause <= 0);
+	if (alreadyUnpaused && stillUnpaused)
+		return;
+
 	for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
 #ifdef ENABLE_SCI32
 		// The entire DAC will have been paused by the caller;
@@ -797,7 +804,7 @@ void SciMusic::soundResume(MusicEntry *pSnd) {
 		pSnd->pauseCounter--;
 	if (pSnd->pauseCounter != 0)
 		return;
-	if (pSnd->status != kSoundPaused || (_globalPause && !_needsResume))
+	if (pSnd->status != kSoundPaused || (_globalPause > 0 && !_needsResume))
 		return;
 	_needsResume = (_soundVersion > SCI_VERSION_0_LATE);
 	if (pSnd->pStreamAud) {


Commit: 4e214c4f2a60d4fdf2531ccf30029f883a72481c
    https://github.com/scummvm/scummvm/commit/4e214c4f2a60d4fdf2531ccf30029f883a72481c
Author: athrxx (athrxx at scummvm.org)
Date: 2022-05-01T13:46:05+03:00

Commit Message:
SCI: add comment to SciMusic::pauseAll()

Changed paths:
    engines/sci/sound/music.cpp


diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 270d0981b2d..7c79ca56f87 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -269,6 +269,16 @@ void SciMusic::pauseAll(bool pause) {
 		_globalPause--;
 
 	bool stillUnpaused = (_globalPause <= 0);
+	// This check is for a specific situation (the ScummVM autosave) which will try to unpause the music,
+	// although it is already unpaused, and after the save it will then pause it again. We allow the
+	// _globalPause counter to go into the negative, so that the final outcome of both calls is a _globalPause
+	// counter of 0 (First: 0, then -1, then 0 again). However, the pause counters of the individual sounds
+	// do not support negatives. And it would be somewhat more likely to cause regressions to add that
+	// support than to just contain it here...
+	// So, for cases where the status of the _globalPause counter only changes in the range below or equal 0
+	// we return here. The individual sounds only need to get targeted if they ACTUALLY get paused or
+	// unpaused (_globalPause counter changes from 0 to 1 or from 1 to 0) or if the pause counter is
+	// increased above 1 (since positive counters are supported and required for the individual sounds).
 	if (alreadyUnpaused && stillUnpaused)
 		return;
 




More information about the Scummvm-git-logs mailing list