[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.189,1.190 mixer.h,1.101,1.102

Max Horn fingolfin at users.sourceforge.net
Mon Apr 4 10:43:35 CEST 2005


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10820/sound

Modified Files:
	mixer.cpp mixer.h 
Log Message:
Renamed getActiveChannelSoundID to getSoundID and fixed its semantics to avoid race conditions

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- mixer.cpp	4 Apr 2005 11:43:24 -0000	1.189
+++ mixer.cpp	4 Apr 2005 17:42:59 -0000	1.190
@@ -367,10 +367,10 @@
 	return false;
 }
 
-int SoundMixer::getActiveChannelSoundID(SoundHandle handle) {
+int SoundMixer::getSoundID(SoundHandle handle) {
 	Common::StackLock lock(_mutex);
 	const int index = handle._val % NUM_CHANNELS;
-	if (_channels[index])
+	if (_channels[index] && _channels[index]->_handle._val == handle._val)
 		return _channels[index]->getId();
 	return 0;
 }

Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- mixer.h	4 Apr 2005 11:43:25 -0000	1.101
+++ mixer.h	4 Apr 2005 17:43:00 -0000	1.102
@@ -210,7 +210,7 @@
 	 * @param handle sound to query
 	 * @return sound ID if active
 	 */
-	int getActiveChannelSoundID(SoundHandle handle);
+	int getSoundID(SoundHandle handle);
 
 	/**
 	 * Check if a sound with the given hANDLE is active.





More information about the Scummvm-git-logs mailing list