add purely experimental & untested Ogg Vorbis support to Simon

svn-id: r11816
This commit is contained in:
Max Horn 2003-12-21 16:01:36 +00:00
parent 71057255ea
commit 5eef5d4e15
3 changed files with 115 additions and 56 deletions

View File

@ -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
};

View File

@ -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

View File

@ -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) {