[Scummvm-cvs-logs] SF.net SVN: scummvm:[38638] scummvm/trunk/engines/sword2/music.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Fri Feb 20 23:47:05 CET 2009


Revision: 38638
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38638&view=rev
Author:   eriktorbjorn
Date:     2009-02-20 22:47:05 +0000 (Fri, 20 Feb 2009)

Log Message:
-----------
Since opening a compressed piece of music should no longer be an expensive
operation, we can probably keep the mutex locked throughout the entire
streamCompMusic() function. I'm not convinced that it was ever safe to unlock
and relock it partway through. In fact, that's my prime suspect for bug #2614306
("BS2: noise in music or speech").

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/music.cpp

Modified: scummvm/trunk/engines/sword2/music.cpp
===================================================================
--- scummvm/trunk/engines/sword2/music.cpp	2009-02-20 22:43:13 UTC (rev 38637)
+++ scummvm/trunk/engines/sword2/music.cpp	2009-02-20 22:47:05 UTC (rev 38638)
@@ -579,9 +579,8 @@
  * @return RD_OK or an error code
  */
 int32 Sound::streamCompMusic(uint32 musicId, bool loop) {
-	//Common::StackLock lock(_mutex);
+	Common::StackLock lock(_mutex);
 
-	_mutex.lock();
 	int cd = _vm->_resman->getCD();
 
 	if (loop)
@@ -637,7 +636,6 @@
 
 	// Don't start streaming if the volume is off.
 	if (isMusicMute()) {
-		_mutex.unlock();
 		return RD_OK;
 	}
 
@@ -645,20 +643,15 @@
 		_music[secondary]->fadeDown();
 	SoundFileHandle *fh = (cd == 1) ? &_musicFile[0] : &_musicFile[1];
 	fh->inUse = true;
-	_mutex.unlock();
 
 	MusicInputStream *tmp = new MusicInputStream(cd, fh, musicId, loop);
 
 	if (tmp->isReady()) {
-		_mutex.lock();
 		_music[primary] = tmp;
 		fh->inUse = false;
-		_mutex.unlock();
 		return RD_OK;
 	} else {
-		_mutex.lock();
 		fh->inUse = false;
-		_mutex.unlock();
 		delete tmp;
 		return RDERR_INVALIDFILENAME;
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list