diff options
author | Torbjörn Andersson | 2009-02-20 22:47:05 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2009-02-20 22:47:05 +0000 |
commit | ab4f1d69adc77d6b899539d83bce568efe57dd00 (patch) | |
tree | 73100e18c5d89815a6103cbe8f59dfe7c9592f40 /engines | |
parent | 478257f624cf665b315192ebab48732c54bbcc4b (diff) | |
download | scummvm-rg350-ab4f1d69adc77d6b899539d83bce568efe57dd00.tar.gz scummvm-rg350-ab4f1d69adc77d6b899539d83bce568efe57dd00.tar.bz2 scummvm-rg350-ab4f1d69adc77d6b899539d83bce568efe57dd00.zip |
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").
svn-id: r38638
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sword2/music.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 4e7aa74c71..8f5b951783 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -579,9 +579,8 @@ void Sound::stopMusic(bool immediately) { * @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 @@ int32 Sound::streamCompMusic(uint32 musicId, bool loop) { // Don't start streaming if the volume is off. if (isMusicMute()) { - _mutex.unlock(); return RD_OK; } @@ -645,20 +643,15 @@ int32 Sound::streamCompMusic(uint32 musicId, bool loop) { _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; } |