aboutsummaryrefslogtreecommitdiff
path: root/engines/simon
diff options
context:
space:
mode:
authorTravis Howell2006-04-20 01:54:14 +0000
committerTravis Howell2006-04-20 01:54:14 +0000
commitf9c3e7fd810902f1b28d8038c57e017c0311afce (patch)
tree9861e7b909fcb58c3d428a9e90f63e1d6c57d35d /engines/simon
parent3917351a93c245903d793495dfb278745fae3e58 (diff)
downloadscummvm-rg350-f9c3e7fd810902f1b28d8038c57e017c0311afce.tar.gz
scummvm-rg350-f9c3e7fd810902f1b28d8038c57e017c0311afce.tar.bz2
scummvm-rg350-f9c3e7fd810902f1b28d8038c57e017c0311afce.zip
Add support for compressed speech files in PC verisons of FF
svn-id: r22046
Diffstat (limited to 'engines/simon')
-rw-r--r--engines/simon/sound.cpp53
1 files changed, 45 insertions, 8 deletions
diff --git a/engines/simon/sound.cpp b/engines/simon/sound.cpp
index 27aa57cfa2..c9520648a2 100644
--- a/engines/simon/sound.cpp
+++ b/engines/simon/sound.cpp
@@ -592,19 +592,56 @@ void Sound::stopSfx5() {
}
void Sound::switchVoiceFile(uint disc) {
- if (_lastVoiceFile != disc) {
- stopAll();
+ if (_lastVoiceFile == disc)
+ return;
+
+ stopAll();
+ delete _voice;
+
+ _hasVoiceFile = false;
+ _lastVoiceFile = disc;
+
+ char filename[16];
+ File *file = new File();
- char filename[16];
- _lastVoiceFile = disc;
- sprintf(filename, "voices%d.wav",disc);
- File *file = new File();
+#ifdef USE_FLAC
+ if (!_hasVoiceFile) {
+ sprintf(filename, "voices%d.flac",disc);
+ file->open(filename);
+ if (file->isOpen()) {
+ _hasVoiceFile = true;
+ _voice = new FlacSound(_mixer, file);
+ }
+ }
+#endif
+#ifdef USE_MAD
+ if (!_hasVoiceFile) {
+ sprintf(filename, "voices%d.mp3",disc);
+ file->open(filename);
+ if (file->isOpen()) {
+ _hasVoiceFile = true;
+ _voice = new MP3Sound(_mixer, file);
+ }
+ }
+#endif
+#ifdef USE_VORBIS
+ if (!_hasVoiceFile) {
+ sprintf(filename, "voices%d.ogg",disc);
+ file->open(filename);
+ if (file->isOpen()) {
+ _hasVoiceFile = true;
+ _voice = new VorbisSound(_mixer, file);
+ }
+ }
+#endif
+ if (!_hasVoiceFile) {
+ sprintf(filename, "voices%d.ogg",disc);
file->open(filename);
if (file->isOpen() == false) {
- warning("playVoice: Can't load voice file %s", filename);
+ warning("switchVoiceFile: Can't load voice file %s", filename);
return;
}
- delete _voice;
+ _hasVoiceFile = true;
_voice = new WavSound(_mixer, file);
}
}