[Scummvm-git-logs] scummvm master -> 4266bea78794c03dad8180e71e7792419bb96dbe

AndywinXp noreply at scummvm.org
Fri Nov 8 18:33:45 UTC 2024


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:
58c2667c1e SCUMM: Prevent expiration of music while it's playing
4266bea787 SCUMM: Remove _numSounds check from isSoundInUse()


Commit: 58c2667c1e7cac42eaa5dc754c80c1961e714522
    https://github.com/scummvm/scummvm/commit/58c2667c1e7cac42eaa5dc754c80c1961e714522
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2024-11-08T19:33:42+01:00

Commit Message:
SCUMM: Prevent expiration of music while it's playing

This brings isSoundInUse() and isSoundRunning() closer to each other,
while still maintaining the documented differences. It seems to fix a
problem I had where the "follow the shopkeeper" music in the Mac version
of Monkey Island 1 expired when reaching the island overhead map,
causing the music to be be replaced with the regular overhead map theme.

Changed paths:
    engines/scumm/sound.cpp


diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index a4e29098ab8..d7bf80db303 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -1013,17 +1013,19 @@ bool Sound::isSoundInUse(int sound) const {
 	if (sound == _currentCDSound)
 		return pollCD() != 0;
 
+	if (_mixer->isSoundIDActive(sound))
+		return true;
+
 	if (isSoundInQueue(sound))
 		return true;
 
-	if (!_vm->_res->isResourceLoaded(rtSound, sound))
+	if (sound > _vm->_numSounds || !_vm->_res->isResourceLoaded(rtSound, sound))
 		return false;
 
 	if (_vm->_imuse)
 		return _vm->_imuse->get_sound_active(sound);
-
-	if (_mixer->isSoundIDActive(sound))
-		return 1;
+	else if (_vm->_musicEngine)
+		return _vm->_musicEngine->getSoundStatus(sound);
 
 	return false;
 }


Commit: 4266bea78794c03dad8180e71e7792419bb96dbe
    https://github.com/scummvm/scummvm/commit/4266bea78794c03dad8180e71e7792419bb96dbe
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2024-11-08T19:33:42+01:00

Commit Message:
SCUMM: Remove _numSounds check from isSoundInUse()

Keeping the check, while consistent with the default implementation of
isSoundRunning(), would in fact break HE games. They have their own
implementation of isSoundRunning(), while isSoundInUse() is used by all.

Changed paths:
    engines/scumm/sound.cpp


diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index d7bf80db303..62771592c90 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -994,14 +994,20 @@ int Sound::isSoundRunning(int sound) const {
 
 /**
  * Check whether the sound resource with the specified ID is still
- * used. This is invoked by ScummEngine::isResourceInUse, to determine
+ * used. This is invoked by ScummEngine::isResourceInUse(), to determine
  * which resources can be expired from memory.
- * Technically, this works very similar to isSoundRunning, however it
+ * Technically, this works very similar to isSoundRunning(), however it
  * calls IMuse::get_sound_active() instead of IMuse::getSoundStatus().
  * The difference between those two is in how they treat sounds which
  * are being faded out: get_sound_active() returns true even when the
  * sound is being faded out, while getSoundStatus() returns false in
  * that case.
+ *
+ * Another difference is that isSoundRunning() checks if sound is greater
+ * than _numSounds before checking if the resource is loaded. That check is
+ * only for non-HE games. In HE games, a number higher than _numSounds
+ * represents a (streamed) music track. HE games have their own implementation
+ * of isSoundRunning(), while isSoundInUse() is used by all.
  */
 bool Sound::isSoundInUse(int sound) const {
 
@@ -1019,7 +1025,7 @@ bool Sound::isSoundInUse(int sound) const {
 	if (isSoundInQueue(sound))
 		return true;
 
-	if (sound > _vm->_numSounds || !_vm->_res->isResourceLoaded(rtSound, sound))
+	if (!_vm->_res->isResourceLoaded(rtSound, sound))
 		return false;
 
 	if (_vm->_imuse)




More information about the Scummvm-git-logs mailing list