diff options
author | Filippos Karapetis | 2010-01-03 18:06:48 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-01-03 18:06:48 +0000 |
commit | 7fa62cdd2bf1cc364f8459e56cf642310ae5b399 (patch) | |
tree | cc2dda73bc72dc69439b5c946ffcd628b44d13e3 /engines | |
parent | 0cfd6a4d769a8aae2dbd442a0b7e09ff0c94ee7c (diff) | |
download | scummvm-rg350-7fa62cdd2bf1cc364f8459e56cf642310ae5b399.tar.gz scummvm-rg350-7fa62cdd2bf1cc364f8459e56cf642310ae5b399.tar.bz2 scummvm-rg350-7fa62cdd2bf1cc364f8459e56cf642310ae5b399.zip |
SCI/new music code: Proper handling of disposed sounds when loading a saved game. Also, addressed a possible mutex issue with cmdPauseSound
svn-id: r46937
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index 24d63036b5..a7424c0136 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -277,6 +277,8 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) { newSound->resnum = number; if (number && _resMan->testResource(ResourceId(kResourceTypeSound, number))) newSound->soundRes = new SoundResource(number, _resMan, _soundVersion); + else + newSound->soundRes = 0; newSound->soundObj = obj; newSound->loop = GET_SEL32V(_segMan, obj, loop); newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF; @@ -514,6 +516,8 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) { changeSoundStatus(obj, value ? SOUND_STATUS_SUSPENDED : SOUND_STATUS_PLAYING); #else + Common::StackLock lock(_music->_mutex); + MusicEntry *musicSlot = NULL; MusicList::iterator slotLoop = NULL; @@ -532,8 +536,6 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) { } } - Common::StackLock lock(_music->_mutex); - do { if (_soundVersion <= SCI_VERSION_0_LATE) { PUT_SEL32V(_segMan, musicSlot->soundObj, state, kSoundPaused); @@ -1023,8 +1025,12 @@ void SoundCommandParser::reconstructPlayList(int savegame_version) { (*i)->volume = GET_SEL32V(_segMan, (*i)->soundObj, vol); } - (*i)->soundRes = new SoundResource((*i)->resnum, _resMan, _soundVersion); - _music->soundInitSnd(*i); + if ((*i)->resnum && _resMan->testResource(ResourceId(kResourceTypeSound, (*i)->resnum))) { + (*i)->soundRes = new SoundResource((*i)->resnum, _resMan, _soundVersion); + _music->soundInitSnd(*i); + } else { + (*i)->soundRes = 0; + } if ((*i)->status == kSoundPlaying) cmdPlaySound((*i)->soundObj, 0); } |