[Scummvm-cvs-logs] CVS: scummvm/simon sound.cpp,1.11,1.12
Oliver Kiehl
olki at users.sourceforge.net
Thu Mar 6 05:53:02 CET 2003
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv22770
Modified Files:
sound.cpp
Log Message:
added mp3 support for simon2mac
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- sound.cpp 1 Mar 2003 22:52:49 -0000 1.11
+++ sound.cpp 6 Mar 2003 13:51:56 -0000 1.12
@@ -43,73 +43,71 @@
File *file2 = new File();
const char *s;
- // for simon2 mac/amiga, only read index file
- if (_game == GAME_SIMON2MAC) {
- file->open("voices.idx", gameDataPath);
- if (file->isOpen() == false) {
- warning("Can't open voice index file 'voices.idx'");
- } else {
- file->seek(0, SEEK_END);
- int end = file->pos();
- file->seek(0, SEEK_SET);
- _filenums = (uint16 *)malloc(end / 3 + 1);
- _offsets = (uint32 *)malloc((end / 6) * 4 + 1);
-
- for (int i = 1; i <= end / 6; i++) {
- _filenums[i] = file->readUint16BE();
- _offsets[i] = file->readUint32BE();
- }
- _voice_file = true;
- }
- } else {
#ifdef USE_MAD
- file->open(gss->mp3_filename, gameDataPath);
- if (file->isOpen() == false) {
+ file->open(gss->mp3_filename, gameDataPath);
+ if (file->isOpen() == false) {
#endif
- if (_game & GF_WIN) {
- s = gss->wav_filename;
- file->open(s, gameDataPath);
- if (file->isOpen() == false) {
- warning("Can't open voice file %s", s);
- } else {
- _voice_file = true;
- _voice = new WavSound(_mixer, file);
- }
- } else if (_game & GF_TALKIE) {
- s = gss->voc_filename;
- file->open(s, gameDataPath);
- if (file->isOpen() == false) {
- warning("Can't open voice file %s", s);
- } else {
- _voice_file = true;
- _voice = new VocSound(_mixer, file);
+ // for simon2 mac/amiga, only read index file
+ if (_game == GAME_SIMON2MAC) {
+ file->open("voices.idx", gameDataPath);
+ if (file->isOpen() == false) {
+ warning("Can't open voice index file 'voices.idx'");
+ } else {
+ file->seek(0, SEEK_END);
+ int end = file->pos();
+ file->seek(0, SEEK_SET);
+ _filenums = (uint16 *)malloc(end / 3 + 1);
+ _offsets = (uint32 *)malloc((end / 6) * 4 + 1);
+
+ for (int i = 1; i <= end / 6; i++) {
+ _filenums[i] = file->readUint16BE();
+ _offsets[i] = file->readUint32BE();
}
+ _voice_file = true;
+ }
+ } else if (_game & GF_WIN) {
+ s = gss->wav_filename;
+ file->open(s, gameDataPath);
+ if (file->isOpen() == false) {
+ warning("Can't open voice file %s", s);
+ } else {
+ _voice_file = true;
+ _voice = new WavSound(_mixer, file);
+ }
+ } else if (_game & GF_TALKIE) {
+ s = gss->voc_filename;
+ file->open(s, gameDataPath);
+ if (file->isOpen() == false) {
+ warning("Can't open voice file %s", s);
+ } else {
+ _voice_file = true;
+ _voice = new VocSound(_mixer, file);
}
-#ifdef USE_MAD
- } else {
- _voice_file = true;
- _voice = new MP3Sound(_mixer, file);
}
+#ifdef USE_MAD
+ } else {
+ _voice_file = true;
+ _voice = new MP3Sound(_mixer, file);
+ }
#endif
- if (_game == GAME_SIMON1TALKIE) {
+ if (_game == GAME_SIMON1TALKIE) {
#ifdef USE_MAD
- file2->open(gss->mp3_effects_filename, gameDataPath);
- if (file2->isOpen() == false) {
+ file2->open(gss->mp3_effects_filename, gameDataPath);
+ if (file2->isOpen() == false) {
#endif
- s = gss->voc_effects_filename;
- file2->open(s, gameDataPath);
- if (file2->isOpen() == false) {
- warning("Can't open effects file %s", s);
- } else {
- _effects = new VocSound(_mixer, file2);
- }
-#ifdef USE_MAD
+ s = gss->voc_effects_filename;
+ file2->open(s, gameDataPath);
+ if (file2->isOpen() == false) {
+ warning("Can't open effects file %s", s);
} else {
- _effects = new MP3Sound(_mixer, file2);
+ _effects = new VocSound(_mixer, file2);
}
-#endif
+#ifdef USE_MAD
+ } else {
+ _effects = new MP3Sound(_mixer, file2);
}
+#endif
}
}
@@ -149,7 +147,7 @@
void SimonSound::playVoice(uint sound)
{
- if (_game == GAME_SIMON2MAC) {
+ if (_game == GAME_SIMON2MAC && _filenums) {
char filename[16];
sprintf(filename, "voices%d.dat", _filenums[sound]);
File *file = new File();
More information about the Scummvm-git-logs
mailing list