[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.320,1.321 sound.h,1.62,1.63

Max Horn fingolfin at users.sourceforge.net
Sun Feb 22 06:24:02 CET 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv387/scumm

Modified Files:
	sound.cpp sound.h 
Log Message:
Patch #885904 (Flac Support) with some tweaks by me

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.320
retrieving revision 1.321
diff -u -d -r1.320 -r1.321
--- sound.cpp	14 Feb 2004 04:12:22 -0000	1.320
+++ sound.cpp	22 Feb 2004 14:11:13 -0000	1.321
@@ -37,6 +37,7 @@
 #include "sound/mp3.h"
 #include "sound/voc.h"
 #include "sound/vorbis.h"
+#include "sound/flac.h"
 
 
 namespace Scumm {
@@ -831,17 +832,25 @@
 
 void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
 
-	AudioStream *input = 0;
+	AudioStream *input = NULL;
 	
 	if (file_size > 0) {
-		if (_vorbis_mode) {
+		switch (_sound_mode) {
+		case kMP3Mode:
+#ifdef USE_MAD
+			input = makeMP3Stream(file, file_size);
+#endif
+			break;
+		case kVorbisMode:
 #ifdef USE_VORBIS
 			input = makeVorbisStream(file, file_size);
 #endif
-		} else {
-#ifdef USE_MAD
-			input = makeMP3Stream(file, file_size);
+			break;
+		case kFlacMode:
+#ifdef USE_FLAC
+			input = makeFlacStream(file, file_size);
 #endif
+			break;
 		}
 	} else {
 		input = makeVOCStream(_sfxFile);
@@ -869,13 +878,24 @@
 	 * same directory */
 	offset_table = NULL;
 
+#ifdef USE_FLAC
+	if (!file->isOpen()) {
+		sprintf(buf, "%s.sof", _vm->getGameName());
+		if (!file->open(buf, _vm->getGameDataPath()))
+			file->open("monster.sof", _vm->getGameDataPath());
+		if (file->isOpen())
+			_sound_mode = kFlacMode;
+	}
+#endif
+
 #ifdef USE_MAD
-	sprintf(buf, "%s.so3", _vm->getGameName());
-	if (!file->open(buf, _vm->getGameDataPath())) {
-		file->open("monster.so3", _vm->getGameDataPath());
+	if (!file->isOpen()) {
+		sprintf(buf, "%s.so3", _vm->getGameName());
+		if (!file->open(buf, _vm->getGameDataPath()))
+			file->open("monster.so3", _vm->getGameDataPath());
+		if (file->isOpen())
+			_sound_mode = kMP3Mode;
 	}
-	if (file->isOpen())
-		_vorbis_mode = false;
 #endif
 
 #ifdef USE_VORBIS
@@ -884,7 +904,7 @@
 		if (!file->open(buf, _vm->getGameDataPath()))
 			file->open("monster.sog", _vm->getGameDataPath());
 		if (file->isOpen())
-			_vorbis_mode = true;
+			_sound_mode = kVorbisMode;
 	}
 #endif
 

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- sound.h	8 Jan 2004 20:37:25 -0000	1.62
+++ sound.h	22 Feb 2004 14:11:14 -0000	1.63
@@ -52,7 +52,7 @@
 
 	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
+	enum {  kMP3Mode, kVorbisMode, kFlacMode } _sound_mode;	
 
 	int _currentCDSound;
 





More information about the Scummvm-git-logs mailing list