aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorMax Horn2003-12-21 16:01:36 +0000
committerMax Horn2003-12-21 16:01:36 +0000
commit5eef5d4e15ddd4c99ff1234a969651572c8e0812 (patch)
treeb814022701442398f57e9b27e06b74e99e1c229f /simon
parent71057255eac588e04fb611ecd423ceb9bc17d045 (diff)
downloadscummvm-rg350-5eef5d4e15ddd4c99ff1234a969651572c8e0812.tar.gz
scummvm-rg350-5eef5d4e15ddd4c99ff1234a969651572c8e0812.tar.bz2
scummvm-rg350-5eef5d4e15ddd4c99ff1234a969651572c8e0812.zip
add purely experimental & untested Ogg Vorbis support to Simon
svn-id: r11816
Diffstat (limited to 'simon')
-rw-r--r--simon/intern.h4
-rw-r--r--simon/simon.cpp112
-rw-r--r--simon/sound.cpp55
3 files changed, 115 insertions, 56 deletions
diff --git a/simon/intern.h b/simon/intern.h
index 955bf331f2..52f28bc705 100644
--- a/simon/intern.h
+++ b/simon/intern.h
@@ -124,16 +124,20 @@ struct GameSpecificSettings {
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
};
diff --git a/simon/simon.cpp b/simon/simon.cpp
index cdfb09a83f..29aa790900 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -136,73 +136,87 @@ static const GameSpecificSettings *simon2dos_settings;
#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
diff --git a/simon/sound.cpp b/simon/sound.cpp
index 27e8241120..d0f17b3f24 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -230,6 +230,26 @@ void MP3Sound::playSound(uint sound, PlayingSoundHandle *handle, byte flags)
}
#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 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const C
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 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const C
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) {