diff options
| author | Willem Jan Palenstijn | 2014-10-07 21:24:49 +0200 | 
|---|---|---|
| committer | Willem Jan Palenstijn | 2015-02-15 13:57:03 +0100 | 
| commit | 5964cc239b920a4a5d3b8475cb6c0b111e968e03 (patch) | |
| tree | 76c334fe1802bda79f467dfb67fca7c7ffd9bcb2 | |
| parent | 58ef44eb8d9d3eb78eb013441a8d6d12940ee5e3 (diff) | |
| download | scummvm-rg350-5964cc239b920a4a5d3b8475cb6c0b111e968e03.tar.gz scummvm-rg350-5964cc239b920a4a5d3b8475cb6c0b111e968e03.tar.bz2 scummvm-rg350-5964cc239b920a4a5d3b8475cb6c0b111e968e03.zip | |
SCI: Always re-sort playlist in soundPlay
Previously, it would only sort if a song wasn't already in the playlist.
Since initSound already adds it, this effectively prevented the list
from being sorted.
| -rw-r--r-- | engines/sci/engine/savegame.cpp | 8 | ||||
| -rw-r--r-- | engines/sci/sound/music.cpp | 3 | 
2 files changed, 8 insertions, 3 deletions
| diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 692fa77a80..eee4c49729 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -639,8 +639,12 @@ void SoundCommandParser::syncPlayList(Common::Serializer &s) {  void SoundCommandParser::reconstructPlayList() {  	Common::StackLock lock(_music->_mutex); -	const MusicList::iterator end = _music->getPlayListEnd(); -	for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) { +	// We store all songs here because starting songs may re-shuffle their order +	MusicList songs; +	for (MusicList::iterator i = _music->getPlayListStart(); i != _music->getPlayListEnd(); ++i) +		songs.push_back(*i); + +	for (MusicList::iterator i = songs.begin(); i != songs.end(); ++i) {  		initSoundResource(*i);  		if ((*i)->status == kSoundPlaying) { diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 4606d66ace..5b205c82d7 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -410,9 +410,10 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {  	}  	if (playListNo == playListCount) { // not found  		_playList.push_back(pSnd); -		sortPlayList();  	} +	sortPlayList(); +  	_mutex.unlock();	// unlock to perform mixer-related calls  	if (pSnd->pMidiParser) { | 
