aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorOliver Kiehl2003-03-06 13:51:56 +0000
committerOliver Kiehl2003-03-06 13:51:56 +0000
commitf8475649da19d402821b9da8c56b980887169ff5 (patch)
treeda0b6156d4b5a56dd72a82eab2f053ff5d3df596 /simon
parentfa98fe8b7e298d83b28206b1de57bf259ba35b0f (diff)
downloadscummvm-rg350-f8475649da19d402821b9da8c56b980887169ff5.tar.gz
scummvm-rg350-f8475649da19d402821b9da8c56b980887169ff5.tar.bz2
scummvm-rg350-f8475649da19d402821b9da8c56b980887169ff5.zip
added mp3 support for simon2mac
svn-id: r6711
Diffstat (limited to 'simon')
-rw-r--r--simon/sound.cpp110
1 files changed, 54 insertions, 56 deletions
diff --git a/simon/sound.cpp b/simon/sound.cpp
index 1e58257fcd..6352528b98 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -43,73 +43,71 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const c
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::loadSfxTable(File *gameFile, uint32 base)
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();