aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2004-02-22 14:11:16 +0000
committerMax Horn2004-02-22 14:11:16 +0000
commitaa6ec62e9db78db12912d0e48025241c5d7ef4f7 (patch)
tree0afae2b795f07b9bd1c00dc75af3dca3864dac5f /scumm
parent6db3a8819e7ef847f6aefac8e40f542cad006481 (diff)
downloadscummvm-rg350-aa6ec62e9db78db12912d0e48025241c5d7ef4f7.tar.gz
scummvm-rg350-aa6ec62e9db78db12912d0e48025241c5d7ef4f7.tar.bz2
scummvm-rg350-aa6ec62e9db78db12912d0e48025241c5d7ef4f7.zip
Patch #885904 (Flac Support) with some tweaks by me
svn-id: r12984
Diffstat (limited to 'scumm')
-rw-r--r--scumm/sound.cpp42
-rw-r--r--scumm/sound.h2
2 files changed, 32 insertions, 12 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 519ff980db..61e4da3d77 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -37,6 +37,7 @@
#include "sound/mp3.h"
#include "sound/voc.h"
#include "sound/vorbis.h"
+#include "sound/flac.h"
namespace Scumm {
@@ -831,17 +832,25 @@ void Sound::pauseSounds(bool pause) {
void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
- AudioStream *input = 0;
+ AudioStream *input = NULL;
if (file_size > 0) {
- if (_vorbis_mode) {
+ switch (_sound_mode) {
+ case kMP3Mode:
+#ifdef USE_MAD
+ input = makeMP3Stream(file, file_size);
+#endif
+ break;
+ case kVorbisMode:
#ifdef USE_VORBIS
input = makeVorbisStream(file, file_size);
#endif
- } else {
-#ifdef USE_MAD
- input = makeMP3Stream(file, file_size);
+ break;
+ case kFlacMode:
+#ifdef USE_FLAC
+ input = makeFlacStream(file, file_size);
#endif
+ break;
}
} else {
input = makeVOCStream(_sfxFile);
@@ -869,13 +878,24 @@ File *Sound::openSfxFile() {
* same directory */
offset_table = NULL;
+#ifdef USE_FLAC
+ if (!file->isOpen()) {
+ sprintf(buf, "%s.sof", _vm->getGameName());
+ if (!file->open(buf, _vm->getGameDataPath()))
+ file->open("monster.sof", _vm->getGameDataPath());
+ if (file->isOpen())
+ _sound_mode = kFlacMode;
+ }
+#endif
+
#ifdef USE_MAD
- sprintf(buf, "%s.so3", _vm->getGameName());
- if (!file->open(buf, _vm->getGameDataPath())) {
- file->open("monster.so3", _vm->getGameDataPath());
+ if (!file->isOpen()) {
+ sprintf(buf, "%s.so3", _vm->getGameName());
+ if (!file->open(buf, _vm->getGameDataPath()))
+ file->open("monster.so3", _vm->getGameDataPath());
+ if (file->isOpen())
+ _sound_mode = kMP3Mode;
}
- if (file->isOpen())
- _vorbis_mode = false;
#endif
#ifdef USE_VORBIS
@@ -884,7 +904,7 @@ File *Sound::openSfxFile() {
if (!file->open(buf, _vm->getGameDataPath()))
file->open("monster.sog", _vm->getGameDataPath());
if (file->isOpen())
- _vorbis_mode = true;
+ _sound_mode = kVorbisMode;
}
#endif
diff --git a/scumm/sound.h b/scumm/sound.h
index c785853018..97c19029de 100644
--- a/scumm/sound.h
+++ b/scumm/sound.h
@@ -52,7 +52,7 @@ protected:
MP3OffsetTable *offset_table; // SO3 MP3 compressed audio
int num_sound_effects; // SO3 MP3 compressed audio
- bool _vorbis_mode; // true if using SOG, false if using SO3
+ enum { kMP3Mode, kVorbisMode, kFlacMode } _sound_mode;
int _currentCDSound;