[Scummvm-cvs-logs] CVS: scummvm/simon intern.h,1.29,1.30 simon.cpp,1.422,1.423 sound.cpp,1.64,1.65
Max Horn
fingolfin at users.sourceforge.net
Sun Feb 22 06:25:09 CET 2004
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv387/simon
Modified Files:
intern.h simon.cpp sound.cpp
Log Message:
Patch #885904 (Flac Support) with some tweaks by me
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/intern.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- intern.h 6 Jan 2004 12:45:31 -0000 1.29
+++ intern.h 22 Feb 2004 14:11:15 -0000 1.30
@@ -125,19 +125,23 @@
const char *voc_filename;
const char *mp3_filename;
const char *vorbis_filename;
+ const char *flac_filename;
const char *voc_effects_filename;
const char *mp3_effects_filename;
const char *vorbis_effects_filename;
+ const char *flac_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 flac_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 flac_effects_filename[12];
const char gamepc_filename[12];
#endif
};
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.422
retrieving revision 1.423
diff -u -d -r1.422 -r1.423
--- simon.cpp 13 Feb 2004 11:00:37 -0000 1.422
+++ simon.cpp 22 Feb 2004 14:11:15 -0000 1.423
@@ -137,9 +137,11 @@
"SIMON.VOC", // voc_filename
"SIMON.MP3", // mp3_filename
"SIMON.OGG", // vorbis_filename
+ "SIMON.FLA", // flac_filename
"EFFECTS.VOC", // voc_effects_filename
"EFFECTS.MP3", // mp3_effects_filename
"EFFECTS.OGG", // vorbis_effects_filename
+ "EFFECTS.FLA", // flac_effects_filename
"GAMEPC", // gamepc_filename
};
@@ -149,9 +151,11 @@
"SIMON", // voc_filename
"SIMON.MP3", // mp3_filename
"SIMON.OGG", // vorbis_filename
+ "SIMON.FLA", // flac_filename
"EFFECTS", // voc_effects_filename
"EFFECTS.MP3", // mp3_effects_filename
"EFFECTS.OGG", // vorbis_effects_filename
+ "EFFECTS.FLA", // flac_effects_filename
"GAMEBASE", // gamepc_filename
};
@@ -161,9 +165,11 @@
"", // voc_filename
"SIMON.MP3", // mp3_filename
"SIMON.OGG", // vorbis_filename
+ "SIMON.FLA", // flac_filename
"", // voc_effects_filename
"", // mp3_effects_filename
"", // vorbis_effects_filename
+ "", // flac_effects_filename
"gameamiga", // gamepc_filename
};
@@ -173,9 +179,11 @@
"", // voc_filename
"", // mp3_filename
"", // vorbis_filename
+ "", // flac_filename
"", // voc_effects_filename
"", // mp3_effects_filename
"", // vorbis_effects_filename
+ "", // flac_effects_filename
"GDEMO", // gamepc_filename
};
@@ -185,9 +193,11 @@
"SIMON2.VOC", // voc_filename
"SIMON2.MP3", // mp3_filename
"SIMON2.OGG", // vorbis_filename
+ "SIMON2.FLA", // flac_filename
"", // voc_effects_filename
"", // mp3_effects_filename
"", // vorbis_effects_filename
+ "", // flac_effects_filename
"GSPTR30", // gamepc_filename
};
@@ -197,9 +207,11 @@
"", // voc_filename
"SIMON2.MP3", // mp3_filename
"SIMON2.OGG", // vorbis_filename
+ "SIMON2.FLA", // flac_filename
"", // voc_effects_filename
"", // mp3_effects_filename
"", // vorbis_effects_filename
+ "", // flac_effects_filename
"gsptr30", // gamepc_filename
};
@@ -209,9 +221,11 @@
"", // voc_filename
"", // mp3_filename
"", // vorbis_filename
+ "", // flac_filename
"", // voc_effects_filename
"", // mp3_effects_filename
"", // vorbis_effects_filename
+ "", // flac_effects_filename
"GAME32", // gamepc_filename
};
#endif
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- sound.cpp 19 Jan 2004 17:50:38 -0000 1.64
+++ sound.cpp 22 Feb 2004 14:11:16 -0000 1.65
@@ -241,6 +241,30 @@
}
#endif
+#ifdef USE_FLAC
+class FlacSound : public BaseSound {
+public:
+ FlacSound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
+ void playSound(uint sound, PlayingSoundHandle *handle, byte flags);
+};
+
+void FlacSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags)
+{
+ if (_offsets == NULL)
+ return;
+
+ _file->seek(_offsets[sound], SEEK_SET);
+
+ int i = 1;
+ while (_offsets[sound + i] == _offsets[sound])
+ i++;
+
+ uint32 size = _offsets[sound + i] - _offsets[sound];
+
+ _mixer->playFlac(handle, _file, size);
+}
+#endif
+
Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::String &gameDataPath, SoundMixer *mixer)
: _game(game), _gameDataPath(gameDataPath), _mixer(mixer) {
_voice = 0;
@@ -259,6 +283,15 @@
File *file = new File();
const char *s;
+#ifdef USE_FLAC
+ if (!_voice && gss->flac_filename && gss->flac_filename[0]) {
+ file->open(gss->flac_filename, gameDataPath);
+ if (file->isOpen()) {
+ _voice_file = true;
+ _voice = new FlacSound(_mixer, file);
+ }
+ }
+#endif
#ifdef USE_MAD
if (!_voice && gss->mp3_filename && gss->mp3_filename[0]) {
file->open(gss->mp3_filename, gameDataPath);
@@ -341,6 +374,14 @@
}
}
#endif
+#ifdef USE_FLAC
+ if (!_effects && gss->flac_effects_filename && gss->flac_effects_filename[0]) {
+ file->open(gss->flac_effects_filename, gameDataPath);
+ if (file->isOpen()) {
+ _effects = new FlacSound(_mixer, file);
+ }
+ }
+#endif
if (!_effects) {
s = gss->voc_effects_filename;
file->open(s, gameDataPath);
More information about the Scummvm-git-logs
mailing list