[Scummvm-cvs-logs] SF.net SVN: scummvm:[55147] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Fri Jan 7 17:00:08 CET 2011


Revision: 55147
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55147&view=rev
Author:   peres001
Date:     2011-01-07 16:00:08 +0000 (Fri, 07 Jan 2011)

Log Message:
-----------
PARALLACTION: fix music playback (bug #2879793).

* Do not restart character theme is already playing.
* Play the correct tune in the night club.
* Do not play muisc in the location meant to be silent.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/sound.h
    scummvm/trunk/engines/parallaction/sound_ns.cpp

Modified: scummvm/trunk/engines/parallaction/sound.h
===================================================================
--- scummvm/trunk/engines/parallaction/sound.h	2011-01-07 15:17:07 UTC (rev 55146)
+++ scummvm/trunk/engines/parallaction/sound.h	2011-01-07 16:00:08 UTC (rev 55147)
@@ -133,8 +133,8 @@
 class DosSoundMan_ns : public SoundMan_ns {
 
 	MidiPlayer	*_midiPlayer;
-	int			_musicData1;
-
+	bool		_playing;
+	
 	bool isLocationSilent(const char *locationName);
 	bool locationHasOwnSoftMusic(const char *locationName);
 

Modified: scummvm/trunk/engines/parallaction/sound_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/sound_ns.cpp	2011-01-07 15:17:07 UTC (rev 55146)
+++ scummvm/trunk/engines/parallaction/sound_ns.cpp	2011-01-07 16:00:08 UTC (rev 55147)
@@ -236,7 +236,7 @@
 	player->updateTimer();
 }
 
-DosSoundMan_ns::DosSoundMan_ns(Parallaction_ns *vm, MidiDriver *midiDriver) : SoundMan_ns(vm), _musicData1(0) {
+DosSoundMan_ns::DosSoundMan_ns(Parallaction_ns *vm, MidiDriver *midiDriver) : SoundMan_ns(vm), _playing(false) {
 	_midiPlayer = new MidiPlayer(midiDriver);
 }
 
@@ -273,10 +273,15 @@
 	Common::SeekableReadStream *stream = _vm->_disk->loadMusic(_musicFile);
 	_midiPlayer->play(stream);
 	_midiPlayer->setVolume(255);
+	
+	_playing = true;
 }
 
 void DosSoundMan_ns::stopMusic() {
+	_musicFile[0] = 0;
 	_midiPlayer->stop();
+
+	_playing = false;
 }
 
 void DosSoundMan_ns::pause(bool p) {
@@ -289,52 +294,46 @@
 }
 	
 void DosSoundMan_ns::playCharacterMusic(const char *character) {
-	if (character == NULL) {
+	if (!character || locationHasOwnSoftMusic(_vm->_location._name)) {
 		return;
 	}
 
-	if (locationHasOwnSoftMusic(_vm->_location._name)) {
-		return;
-	}
-
 	char *name = const_cast<char*>(character);
-
+	const char *newMusicFile = 0;
+	
 	if (!scumm_stricmp(name, _dinoName)) {
-		setMusicFile("dino");
+		newMusicFile = "dino";
 	} else
 	if (!scumm_stricmp(name, _donnaName)) {
-		setMusicFile("donna");
+		newMusicFile = "donna";
 	} else
 	if (!scumm_stricmp(name, _doughName)) {
-		setMusicFile("nuts");
+		newMusicFile = "nuts";
 	} else {
 		warning("unknown character '%s' in DosSoundMan_ns_ns::playCharacterMusic", character);
 		return;
 	}
 
-	playMusic();
+	if (!_playing || (newMusicFile && scumm_stricmp(newMusicFile, _musicFile))) {
+		// avoid restarting the same piece
+		setMusicFile(newMusicFile);
+		playMusic();
+		debugC(2, kDebugExec, "changeLocation: started character specific music (%s)", newMusicFile);
+	}
 }
 
 void DosSoundMan_ns::playLocationMusic(const char *location) {
-	if (_musicData1 != 0) {
-		playCharacterMusic(_vm->_char.getBaseName());
-		_musicData1 = 0;
-		debugC(2, kDebugExec, "changeLocation: started character specific music");
-	}
-
 	if (locationHasOwnSoftMusic(location)) {
 		setMusicFile("soft");
 		playMusic();
-
 		debugC(2, kDebugExec, "changeLocation: started music 'soft'");
-	}
-
+	} else
 	if (isLocationSilent(location)) {
 		stopMusic();
-		_musicData1 = 1;
-
 		debugC(2, kDebugExec, "changeLocation: music stopped");
-	}
+	} else {
+		playCharacterMusic(_vm->_char.getBaseName());
+	}	
 }
 
 


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