[Scummvm-cvs-logs] CVS: scummvm/scumm scummvm.cpp,1.67,1.68 sound.cpp,1.45,1.46 sound.h,1.16,1.17

James Brown ender at users.sourceforge.net
Mon Oct 28 04:57:08 CET 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv8361/scumm

Modified Files:
	scummvm.cpp sound.cpp sound.h 
Log Message:
Fix using MAD -without- Vorbis, and remove COMPRESSED_SOUND_FILE define.

Please keep in mind that if you put an 'else' statement in an if clause, keep in mind that if the code it's supposed to 
'else' is in another define.... and that isn't set... the NEXT statement of code will be used as the 'if..else' 
condition.




Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- scummvm.cpp	28 Oct 2002 09:03:02 -0000	1.67
+++ scummvm.cpp	28 Oct 2002 12:56:42 -0000	1.68
@@ -325,9 +325,7 @@
 
 	getGraphicsPerformance();
 
-#ifdef COMPRESSED_SOUND_FILE
 	_sound->_current_cache = 0;
-#endif
 
 	_timer->installProcedure(&autosave, 5 * 60 * 1000);
 }

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- sound.cpp	27 Oct 2002 19:32:36 -0000	1.45
+++ sound.cpp	28 Oct 2002 12:56:42 -0000	1.46
@@ -453,13 +453,11 @@
 	}
 }
 
-#ifdef COMPRESSED_SOUND_FILE
 static int compar(const void *a, const void *b)
 {
 	return ((MP3OffsetTable *) a)->org_offset -
 		((MP3OffsetTable *) b)->org_offset;
 }
-#endif
 
 int Sound::startTalkSound(uint32 offset, uint32 b, int mode) {
 	int num = 0, i;
@@ -491,7 +489,7 @@
 	if (b > 8) {
 		num = (b - 8) >> 1;
 	}
-#ifdef COMPRESSED_SOUND_FILE
+
 	if (offset_table != NULL) {
 		MP3OffsetTable *result = NULL, key;
 
@@ -510,9 +508,7 @@
 		}
 		offset = result->new_offset;
 		size = result->compressed_size;
-	} else
-#endif
-	{
+	} else {
 		offset += 8;
 		size = -1;
 	}
@@ -738,11 +734,10 @@
 	int rate, comp;
 	byte *data;
 
-#ifdef COMPRESSED_SOUND_FILE
 	if (file_size > 0) {
 		int alloc_size = file_size;
 #ifdef USE_MAD
-		if (! _vorbis_mode)
+		if (!_vorbis_mode)
 			alloc_size += MAD_BUFFER_GUARD;
 #endif
 		data = (byte *)calloc(alloc_size, 1);
@@ -757,7 +752,7 @@
 		else
 			return playSfxSound_MP3(data, file_size);
 	}
-#endif
+
 	if (file->read(ident, 8) != 8)
 		goto invalid;
 
@@ -810,7 +805,6 @@
 	/* Try opening the file <_exe_name>.sou first, eg tentacle.sou.
 	 * That way, you can keep .sou files for multiple games in the
 	 * same directory */
-#ifdef COMPRESSED_SOUND_FILE
 	offset_table = NULL;
 
 #ifdef USE_MAD
@@ -820,19 +814,19 @@
 	}
 	if (file->isOpen())
 		_vorbis_mode = false;
-	else
 #endif
+
 #ifdef USE_VORBIS
-		{
-			sprintf(buf, "%s.sog", _scumm->_exe_name);
-			if (!file->open(buf, _scumm->getGameDataPath()))
-				file->open("monster.sog", _scumm->getGameDataPath());
-			if (file->isOpen())
-				_vorbis_mode = true;
-		}
+	if (!file->isOpen()) {
+		sprintf(buf, "%s.sog", _scumm->_exe_name);
+		if (!file->open(buf, _scumm->getGameDataPath()))
+			file->open("monster.sog", _scumm->getGameDataPath());
+		if (file->isOpen())
+			_vorbis_mode = true;
+	}
 #endif
 
-	if (file->isOpen() == true) {
+	if (file->isOpen()) {
 		/* Now load the 'offset' index in memory to be able to find the MP3 data
 
 		   The format of the .SO3 file is easy :
@@ -849,7 +843,6 @@
 		 */
 		int size, compressed_offset;
 		MP3OffsetTable *cur;
-
 		compressed_offset = file->readUint32BE();
 		offset_table = (MP3OffsetTable *) malloc(compressed_offset);
 		num_sound_effects = compressed_offset / 16;
@@ -866,7 +859,7 @@
 		}
 		return file;
 	}
-#endif
+
 	sprintf(buf, "%s.sou", _scumm->_exe_name);
 	if (!file->open(buf, _scumm->getGameDataPath())) {
 		file->open("monster.sou", _scumm->getGameDataPath());
@@ -1286,9 +1279,7 @@
 
 void Sound::playCDTrack(int track, int num_loops, int start, int delay)
 {
-#ifdef COMPRESSED_SOUND_FILE
 	if (playMP3CDTrack(track, num_loops, start, delay) == -1)
-#endif
 		_scumm->_system->play_cdrom(track, num_loops, start, delay);
 
 	// Start the timer after starting the track. Starting an MP3 track is
@@ -1301,31 +1292,24 @@
 void Sound::stopCD()
 {
 	stopCDTimer();
-#ifdef COMPRESSED_SOUND_FILE
 	if (stopMP3CD() == -1)
-#endif
 		_scumm->_system->stop_cdrom();
 }
 
 int Sound::pollCD()
 {
-#ifdef COMPRESSED_SOUND_FILE
 	if (pollMP3CD())
 		return 1;
-#endif
+
 	return _scumm->_system->poll_cdrom();
 }
 
 void Sound::updateCD()
 {
-#ifdef COMPRESSED_SOUND_FILE
 	if (updateMP3CD() == -1)
-#endif
 		_scumm->_system->update_cdrom();
 }
 
-#ifdef COMPRESSED_SOUND_FILE
-
 int Sound::getCachedTrack(int track) {
 	int i;
 	char track_name[1024];
@@ -1381,7 +1365,7 @@
 	}
 #endif
 
-	debug(1, "Track %d not available in compressed format", track);
+	debug(2, "Track %d not available in compressed format", track);
 	return -1;
 }
 
@@ -1649,7 +1633,5 @@
 		delete _file;
 	}
 }
-
-#endif
 
 #endif

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- sound.h	27 Oct 2002 11:41:07 -0000	1.16
+++ sound.h	28 Oct 2002 12:56:42 -0000	1.17
@@ -65,7 +65,6 @@
 	uint16 _mouthSyncTimes[52];
 	uint _curSoundPos;
 
-#ifdef COMPRESSED_SOUND_FILE
 	MP3OffsetTable *offset_table;	// SO3 MP3 compressed audio
 	int num_sound_effects;		// SO3 MP3 compressed audio
 	bool _vorbis_mode;	// true if using SOG, false if using SO3
@@ -122,18 +121,12 @@
 	};
 #endif
 
-#endif
-
 	Scumm * _scumm;
 
 public:
 
-#ifdef COMPRESSED_SOUND_FILE
-
 	int _current_cache;
 
-#endif
-
 	int _talkChannel;	/* Mixer channel actor is talking on */
 	int _cd_timer_value;
 	bool _soundsPaused;
@@ -184,13 +177,11 @@
 	void updateCD();
 
 protected:
-#ifdef COMPRESSED_SOUND_FILE
 	int getCachedTrack(int track);
 	int playMP3CDTrack(int track, int num_loops, int start, int delay);
 	int stopMP3CD();
 	int pollMP3CD();
 	int updateMP3CD();
-#endif
 };
 
 #endif





More information about the Scummvm-git-logs mailing list