[Scummvm-cvs-logs] CVS: scummvm/scumm/smush smush_player.cpp,1.130,1.131 smush_player.h,1.32,1.33

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Sep 18 11:10:09 CEST 2004


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

Modified Files:
	smush_player.cpp smush_player.h 
Log Message:
added experimental ogg file support for comi smush audio track

Index: smush_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- smush_player.cpp	22 Aug 2004 09:14:19 -0000	1.130
+++ smush_player.cpp	18 Sep 2004 18:09:35 -0000	1.131
@@ -234,6 +234,7 @@
 	_subtitles = ConfMan.getBool("subtitles");
 	_dst = NULL;
 	_storeFrame = false;
+	_compressedFileMode = false;
 	_width = 0;
 	_height = 0;
 	_IACTpos = 0;
@@ -289,7 +290,9 @@
 		free(_specialBuffer);
 		_specialBuffer = NULL;
 	}
-	
+
+	_vm->_mixer->stopHandle(_compressedFileSoundHandle);
+
 	_vm->_mixer->stopHandle(_IACTchannel);
 
 	_vm->_fullRedraw = true;
@@ -850,7 +853,8 @@
 			break;
 #endif
 		case TYPE_PSAD:
-			handleSoundFrame(*sub);
+			if (!_compressedFileMode)
+				handleSoundFrame(*sub);
 			break;
 		case TYPE_TRES:
 			handleTextResource(*sub);
@@ -862,8 +866,10 @@
 			// FIXME: check parameters
 			if (_insanity)
 				_vm->_insane->procIACT(_dst, 0, 0, 0, *sub, 0, 0);
-			else
-				handleIACT(*sub);
+			else {
+				if (!_compressedFileMode)
+					handleIACT(*sub);
+			}
 			break;
 		case TYPE_STOR:
 			handleStore(*sub);
@@ -1113,6 +1119,25 @@
 	_frame = contFrame;
 }
 
+void SmushPlayer::tryOggFile(const char *filename) {
+	_compressedFileMode = false;
+	const char *i = strrchr(filename, '.');
+	if (i == NULL) {
+		error("invalid filename : %s", filename);
+	}
+	char fname[260];
+	memcpy(fname, filename, i - filename);
+	strcpy(fname + (i - filename), ".ogg");
+#ifdef USE_VORBIS
+	_compressedFile.open(fname);
+	if (_compressedFile.isOpen()) {
+		int size = _compressedFile.size();
+		_compressedFileMode = true;
+		_vm->_mixer->playVorbis(&_compressedFileSoundHandle, &_compressedFile, size);
+	}
+#endif
+}
+
 void SmushPlayer::play(const char *filename, int32 offset, int32 startFrame) {
 
 	// Verify the specified file exists
@@ -1124,6 +1149,8 @@
 	}
 	f.close();
 
+	tryOggFile(filename);
+
 	_updateNeeded = false;
 	
 	// Hide mouse

Index: smush_player.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- smush_player.h	27 Jun 2004 21:52:25 -0000	1.32
+++ smush_player.h	18 Sep 2004 18:09:35 -0000	1.33
@@ -57,6 +57,9 @@
 	int32 _frame;
 
 	PlayingSoundHandle _IACTchannel;
+	PlayingSoundHandle _compressedFileSoundHandle;
+	bool _compressedFileMode;
+	File _compressedFile;
 	byte _IACToutput[4096];
 	int32 _IACTpos;
 	bool _storeFrame;
@@ -94,6 +97,7 @@
 	void release();
 	void setupAnim(const char *file);
 	void updateScreen();
+	void tryOggFile(const char *filename);
 
 	bool readString(const char *file);
 	void checkBlock(const Chunk &, Chunk::type, uint32 = 0);





More information about the Scummvm-git-logs mailing list