[Scummvm-cvs-logs] SF.net SVN: scummvm: [22046] scummvm/trunk/engines/simon/sound.cpp
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Wed Apr 19 18:55:01 CEST 2006
Revision: 22046
Author: kirben
Date: 2006-04-19 18:54:14 -0700 (Wed, 19 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22046&view=rev
Log Message:
-----------
Add support for compressed speech files in PC verisons of FF
Modified Paths:
--------------
scummvm/trunk/engines/simon/sound.cpp
Modified: scummvm/trunk/engines/simon/sound.cpp
===================================================================
--- scummvm/trunk/engines/simon/sound.cpp 2006-04-20 01:50:17 UTC (rev 22045)
+++ scummvm/trunk/engines/simon/sound.cpp 2006-04-20 01:54:14 UTC (rev 22046)
@@ -592,19 +592,56 @@
}
void Sound::switchVoiceFile(uint disc) {
- if (_lastVoiceFile != disc) {
- stopAll();
+ if (_lastVoiceFile == disc)
+ return;
- char filename[16];
- _lastVoiceFile = disc;
- sprintf(filename, "voices%d.wav",disc);
- File *file = new File();
+ stopAll();
+ delete _voice;
+
+ _hasVoiceFile = false;
+ _lastVoiceFile = disc;
+
+ char filename[16];
+ 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);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list