[Scummvm-cvs-logs] scummvm master -> 53e5522e5a895ba8bdd7fc20b03d0c67bc840eeb

dreammaster dreammaster at scummvm.org
Thu Jul 28 13:38:50 CEST 2011


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:
53e5522e5a TSAGE: Fixed a problem with only the first Fx sound being played


Commit: 53e5522e5a895ba8bdd7fc20b03d0c67bc840eeb
    https://github.com/scummvm/scummvm/commit/53e5522e5a895ba8bdd7fc20b03d0c67bc840eeb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-07-28T04:36:15-07:00

Commit Message:
TSAGE: Fixed a problem with only the first Fx sound being played

Changed paths:
    engines/tsage/sound.cpp



diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 3d725a4..da70ea2 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -2306,16 +2306,17 @@ void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) {
 					for (uint entryIndex = 0; entryIndex < vtStruct->_entries.size(); ++entryIndex) {
 						VoiceStructEntry &vte = vtStruct->_entries[entryIndex];
 						VoiceStructEntryType1 &vse = vte._type1;
-						if ((vse._sound == this) && (vse._channelNum == channel) && (vse._field4 == vtStruct->_total)) {
+						if ((vse._sound == this) && (vse._channelNum == channel) && (vse._field4 == *(channelData + 1))) {
 							SoundDriver *driver = vte._driver;
 
-							int v1, isEnded;
-							driver->proc42(vte._voiceNum, vtStruct->_total, _loop ? 1 : 0, &v1, &isEnded);
+							int isEnded, resetTimer;
+							driver->proc42(vte._voiceNum, vtStruct->_total, _loop ? 1 : 0, &isEnded, &resetTimer);
 							if (isEnded) {
 								_trkState[trackIndex] = 0;
-							} else if (vtStruct->_total) {
+							} else if (resetTimer) {
 								_timer = 0;
 							}
+							return;
 						}
 					}
 
@@ -2911,15 +2912,18 @@ void AdlibFxSoundDriver::proc42(int channel, int cmd, int value, int *v1, int *v
 	// Note: Checking whether a playing Fx sound had finished was originally done in another
 	// method in the sample playing code. But since we're using the ScummVM audio soundsystem,
 	// it's easier simply to do the check right here
-	if (_audioStream && _audioStream->endOfStream()) {
-		delete _audioStream;
+	if (_audioStream && (_audioStream->numQueuedStreams() == 0)) {
+		_mixer->stopHandle(_soundHandle);
 		_audioStream = NULL;
 		_channelData = NULL;
 	}
 
 	if (!_channelData)
 		// Flag that sound isn't playing
-		*v2 = 1;
+		*v1 = 1;
+
+	// TODO: v2 is used for flagging a reset of the timer. I'm not sure if it's needed
+	*v2 = 0;
 }
 
 void AdlibFxSoundDriver::write(int v) {






More information about the Scummvm-git-logs mailing list