[Scummvm-git-logs] scummvm master -> ab7495ebf9735b232d2ba36f750d3d4ccb5a7297

fracturehill noreply at scummvm.org
Wed Nov 13 14:07:29 UTC 2024


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

Summary:
ab7495ebf9 NANCY: Move numLoops adjustment for sounds


Commit: ab7495ebf9735b232d2ba36f750d3d4ccb5a7297
    https://github.com/scummvm/scummvm/commit/ab7495ebf9735b232d2ba36f750d3d4ccb5a7297
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-11-13T15:05:00+01:00

Commit Message:
NANCY: Move numLoops adjustment for sounds

In a previous commit, a code path that would adjust
the number of loops for a sound was forgotten and
rendered useless. This commit moves it earlier in
the call chain, where it could still have an effect.

Changed paths:
    engines/nancy/sound.cpp


diff --git a/engines/nancy/sound.cpp b/engines/nancy/sound.cpp
index a421db93136..c23f0c04935 100644
--- a/engines/nancy/sound.cpp
+++ b/engines/nancy/sound.cpp
@@ -310,8 +310,17 @@ void SoundManager::loadSound(const SoundDescription &description, SoundEffectDes
 	Common::Path path(description.name + (g_nancy->getGameType() == kGameTypeVampire ? ".dwd" : ".his"));
 	Common::SeekableReadStream *file = SearchMan.createReadStreamForMember(path);
 	if (file) {
+		uint numLoops = chan.numLoops;
+		if (chan.playCommands & kPlayRandomTime) {
+			// We want to add randomized time delays between repeats, which is not doable with
+			// a simple LoopingAudioStream. The delays are added in soundEffectMaintenance();
+			numLoops = 1;
+
+			// Decrement the number of loops since we start playing immediately after
+			--chan.numLoops;
+		}
 		chan.stream = makeHISStream(file, DisposeAfterUse::YES, description.samplesPerSec);
-		chan.streamForMixer = Audio::makeLoopingAudioStream(chan.stream, chan.numLoops);
+		chan.streamForMixer = Audio::makeLoopingAudioStream(chan.stream, numLoops);
 	}
 }
 
@@ -373,17 +382,6 @@ void SoundManager::playSound(uint16 channelID) {
 		}
 	}
 
-	// FIXME: numLoops now unused. is this an oversight or just dead code?
-	//uint numLoops = chan.numLoops;
-	if (chan.playCommands & kPlayRandomTime) {
-		// We want to add randomized time delays between repeats, which is not doable with
-		// a simple LoopingAudioStream. The delays are added in soundEffectMaintenance();
-		//numLoops = 1;
-
-		// Decrement the number of loops since we start playing immediately after
-		--chan.numLoops;
-	}
-
 	_mixer->playStream(	chan.type,
 						&chan.handle,
 						chan.streamForMixer,




More information about the Scummvm-git-logs mailing list