[Scummvm-cvs-logs] CVS: scummvm/simon sound.cpp,1.52,1.53 sound.h,1.13,1.14

Travis Howell kirben at users.sourceforge.net
Fri Dec 12 17:55:04 CET 2003


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv30056/simon

Modified Files:
	sound.cpp sound.h 
Log Message:

Don't switch voice file in simon2mac unless needed.


Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- sound.cpp	1 Dec 2003 00:45:16 -0000	1.52
+++ sound.cpp	13 Dec 2003 01:54:17 -0000	1.53
@@ -242,6 +242,7 @@
 	_ambient_paused = false;
 
 	_filenums = 0;
+	_last_voice_file = 0;
 	_offsets = 0;
 
 	_voice_handle = 0;
@@ -396,21 +397,25 @@
 
 void SimonSound::playVoice(uint sound) {
 	if (_game == GAME_SIMON2MAC && _filenums) {
-		stopAll();
+		if (_last_voice_file != _filenums[sound]) {
+			warning("Loading voice file %d", _filenums[sound]);
+			stopAll();
 
-		char filename[16];
-		sprintf(filename, "voices%d.dat", _filenums[sound]);
-		File *file = new File();
-		file->open(filename, _gameDataPath);
-		if (file->isOpen() == false) {
-			warning("playVoice: Can't load voice file %s", filename);
-			return;
-		} 
-		// FIXME freeing voice at this point causes frequent game crashes
-		// Maybe related to sound effects and speech using same sound format ?
-		// In any case, this means we currently leak.
-		// delete _voice;
-		_voice = new WavSound(_mixer, file, _offsets);
+			char filename[16];
+			_last_voice_file = _filenums[sound];
+			sprintf(filename, "voices%d.dat", _filenums[sound]);
+			File *file = new File();
+			file->open(filename, _gameDataPath);
+			if (file->isOpen() == false) {
+				warning("playVoice: Can't load voice file %s", filename);
+				return;
+			} 
+			// FIXME freeing voice at this point causes frequent game crashes
+			// Maybe related to sound effects and speech using same sound format ?
+			// In any case, this means we currently leak.
+			// delete _voice;
+			_voice = new WavSound(_mixer, file, _offsets);
+		}
 	}
 
 	if (!_voice)

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- sound.h	10 Oct 2003 13:55:07 -0000	1.13
+++ sound.h	13 Dec 2003 01:54:17 -0000	1.14
@@ -46,6 +46,7 @@
 
 	uint16 *_filenums;
 	uint32 *_offsets;
+	uint16 _last_voice_file;
 
 public:
 	PlayingSoundHandle _voice_handle;





More information about the Scummvm-git-logs mailing list