[Scummvm-cvs-logs] CVS: scummvm/simon intern.h,1.27,1.28 simon.cpp,1.389,1.390 sound.cpp,1.55,1.56

Max Horn fingolfin at users.sourceforge.net
Sun Dec 21 08:02:01 CET 2003


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

Modified Files:
	intern.h simon.cpp sound.cpp 
Log Message:
add purely experimental & untested Ogg Vorbis support to Simon

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/intern.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- intern.h	21 Dec 2003 09:01:58 -0000	1.27
+++ intern.h	21 Dec 2003 16:01:35 -0000	1.28
@@ -124,16 +124,20 @@
 	const char *wav_filename;
 	const char *voc_filename;
 	const char *mp3_filename;
+	const char *vorbis_filename;
 	const char *voc_effects_filename;
 	const char *mp3_effects_filename;
+	const char *vorbis_effects_filename;
  	const char *gamepc_filename;
  #else
 	const char gme_filename[12];
 	const char wav_filename[12];
 	const char voc_filename[12];
 	const char mp3_filename[12];
+	const char vorbis_filename[12];
 	const char voc_effects_filename[12];
 	const char mp3_effects_filename[12];
+	const char vorbis_effects_filename[12];
  	const char gamepc_filename[12]; 
  #endif
 };

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.389
retrieving revision 1.390
diff -u -d -r1.389 -r1.390
--- simon.cpp	21 Dec 2003 15:29:51 -0000	1.389
+++ simon.cpp	21 Dec 2003 16:01:36 -0000	1.390
@@ -136,73 +136,87 @@
 #else
 #define PTR(a) &a
 static const GameSpecificSettings simon1_settings = {
-	"SIMON.GME",									// gme_filename
-	"SIMON.WAV",									// wav_filename
-	"SIMON.VOC",									// voc_filename
-	"SIMON.MP3",									// mp3_filename
-	"EFFECTS.VOC",									// voc_effects_filename
-	"EFFECTS.MP3",									// mp3_effects_filename
-	"GAMEPC",									// gamepc_filename
+	"SIMON.GME",                            // gme_filename
+	"SIMON.WAV",                            // wav_filename
+	"SIMON.VOC",                            // voc_filename
+	"SIMON.MP3",                            // mp3_filename
+	"SIMON.OGG",                            // vorbis_filename
+	"EFFECTS.VOC",                          // voc_effects_filename
+	"EFFECTS.MP3",                          // mp3_effects_filename
+	"EFFECTS.OGG",                          // vorbis_effects_filename
+	"GAMEPC",                               // gamepc_filename
 };
 
 static const GameSpecificSettings simon1acorn_settings = {
-	"DATA",										// gme_filename
-	"",										// wav_filename
-	"SIMON",									// voc_filename
-	"SIMON.MP3",									// mp3_filename
-	"EFFECTS",									// voc_effects_filename
-	"EFFECTS.MP3",									// mp3_effects_filename
-	"GAMEBASE",									// gamepc_filename
+	"DATA",                                 // gme_filename
+	"",                                     // wav_filename
+	"SIMON",                                // voc_filename
+	"SIMON.MP3",                            // mp3_filename
+	"SIMON.OGG",                            // vorbis_filename
+	"EFFECTS",                              // voc_effects_filename
+	"EFFECTS.MP3",                          // mp3_effects_filename
+	"EFFECTS.OGG",                          // vorbis_effects_filename
+	"GAMEBASE",                             // gamepc_filename
 };
 
 static const GameSpecificSettings simon1amiga_settings = {
-	"",										// gme_filename
-	"",										// wav_filename
-	"",										// voc_filename
-	"SIMON.MP3",									// mp3_filename
-	"",										// voc_effects_filename
-	"",										// mp3_effects_filename
-	"gameamiga",									// gamepc_filename
+	"",                                     // gme_filename
+	"",                                     // wav_filename
+	"",                                     // voc_filename
+	"SIMON.MP3",                            // mp3_filename
+	"SIMON.OGG",                            // vorbis_filename
+	"",                                     // voc_effects_filename
+	"",                                     // mp3_effects_filename
+	"",                                     // vorbis_effects_filename
+	"gameamiga",                            // gamepc_filename
 };
 
 static const GameSpecificSettings simon1demo_settings = {
-	"",										// gme_filename
-	"",										// wav_filename
-	"",										// voc_filename
-	"",										// mp3_filename
-	"",										// voc_effects_filename
-	"",										// mp3_effects_filename
-	"GDEMO",									// gamepc_filename
+	"",                                     // gme_filename
+	"",                                     // wav_filename
+	"",                                     // voc_filename
+	"",                                     // mp3_filename
+	"",                                     // vorbis_filename
+	"",                                     // voc_effects_filename
+	"",                                     // mp3_effects_filename
+	"",                                     // vorbis_effects_filename
+	"GDEMO",                                // gamepc_filename
 };
 
 static const GameSpecificSettings simon2win_settings = {
-	"SIMON2.GME",									// gme_filename
-	"SIMON2.WAV",									// wav_filename
-	"SIMON2.VOC",									// voc_filename
-	"SIMON2.MP3",									// mp3_filename
-	"",										// voc_effects_filename
-	"",										// mp3_effects_filename
-	"GSPTR30",									// gamepc_filename
+	"SIMON2.GME",                           // gme_filename
+	"SIMON2.WAV",                           // wav_filename
+	"SIMON2.VOC",                           // voc_filename
+	"SIMON2.MP3",                           // mp3_filename
+	"SIMON2.OGG",                           // vorbis_filename
+	"",                                     // voc_effects_filename
+	"",                                     // mp3_effects_filename
+	"",                                     // vorbis_effects_filename
+	"GSPTR30",                              // gamepc_filename
 };
 
 static const GameSpecificSettings simon2mac_settings = {
-	"Simon2.gme",									// gme_filename
-	"",										// wav_filename
-	"",										// voc_filename
-	"SIMON2.MP3",									// mp3_filename
-	"",										// voc_effects_filename
-	"",										// mp3_effects_filename
-	"gsptr30",									// gamepc_filename
+	"Simon2.gme",                           // gme_filename
+	"",                                     // wav_filename
+	"",                                     // voc_filename
+	"SIMON2.MP3",                           // mp3_filename
+	"SIMON2.OGG",                           // vorbis_filename
+	"",                                     // voc_effects_filename
+	"",                                     // mp3_effects_filename
+	"",                                     // vorbis_effects_filename
+	"gsptr30",                              // gamepc_filename
 };
 
 static const GameSpecificSettings simon2dos_settings = {
-	"SIMON2.GME",									// gme_filename
-	"",										// wav_filename
-	"",										// voc_filename
-	"",										// mp3_filename
-	"",										// voc_effects_filename
-	"",										// mp3_effects_filename
-	"GAME32",									// gamepc_filename
+	"SIMON2.GME",                           // gme_filename
+	"",                                     // wav_filename
+	"",                                     // voc_filename
+	"",                                     // mp3_filename
+	"",                                     // vorbis_filename
+	"",                                     // voc_effects_filename
+	"",                                     // mp3_effects_filename
+	"",                                     // vorbis_effects_filename
+	"GAME32",                               // gamepc_filename
 };
 #endif
 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- sound.cpp	21 Dec 2003 00:05:00 -0000	1.55
+++ sound.cpp	21 Dec 2003 16:01:36 -0000	1.56
@@ -230,6 +230,26 @@
 }
 #endif
 
+#ifdef USE_VORBIS
+class VorbisSound : public BaseSound {
+public:
+	VorbisSound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
+	void playSound(uint sound, PlayingSoundHandle *handle, byte flags);
+};
+
+void VorbisSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags)
+{
+	if (_offsets == NULL)
+		return;
+
+	_file->seek(_offsets[sound], SEEK_SET);
+
+	uint32 size = _offsets[sound+1] - _offsets[sound];
+
+	_mixer->playVorbis(handle, _file, size);
+}
+#endif
+
 SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const Common::String &gameDataPath, SoundMixer *mixer)
 	: _game(game), _gameDataPath(gameDataPath), _mixer(mixer) {
 	_voice = 0;
@@ -253,10 +273,21 @@
 	const char *s;
 
 #ifdef USE_MAD
-	file->open(gss->mp3_filename, gameDataPath);
-	if (file->isOpen()) {
-		_voice_file = true;
-		_voice = new MP3Sound(_mixer, file);
+	if (!_voice && gss->mp3_filename && gss->mp3_filename[0]) {
+		file->open(gss->mp3_filename, gameDataPath);
+		if (file->isOpen()) {
+			_voice_file = true;
+			_voice = new MP3Sound(_mixer, file);
+		}
+	}
+#endif
+#ifdef USE_VORBIS
+	if (!_voice && gss->vorbis_filename && gss->vorbis_filename[0]) {
+		file->open(gss->vorbis_filename, gameDataPath);
+		if (file->isOpen()) {
+			_voice_file = true;
+			_voice = new VorbisSound(_mixer, file);
+		}
 	}
 #endif
 	if (!_voice) {
@@ -308,9 +339,19 @@
 	if (_game == GAME_SIMON1ACORN || _game == GAME_SIMON1TALKIE) {
 		file = new File();
 #ifdef USE_MAD
-		file->open(gss->mp3_effects_filename, gameDataPath);
-		if (file->isOpen()) {
-			_effects = new MP3Sound(_mixer, file);
+		if (!_effects && gss->mp3_effects_filename && gss->mp3_effects_filename[0]) {
+			file->open(gss->mp3_effects_filename, gameDataPath);
+			if (file->isOpen()) {
+				_effects = new MP3Sound(_mixer, file);
+			}
+		}
+#endif
+#ifdef USE_VORBIS
+		if (!_effects && gss->vorbis_effects_filename && gss->vorbis_effects_filename[0]) {
+			file->open(gss->vorbis_effects_filename, gameDataPath);
+			if (file->isOpen()) {
+				_effects = new VorbisSound(_mixer, file);
+			}
 		}
 #endif
 		if (!_effects) {





More information about the Scummvm-git-logs mailing list