aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README3
-rw-r--r--engines/sword1/sound.cpp27
-rw-r--r--engines/sword1/sound.h3
3 files changed, 30 insertions, 3 deletions
diff --git a/README b/README
index 20d6f7be33..ed99c49f21 100644
--- a/README
+++ b/README
@@ -1422,6 +1422,9 @@ files.
Running "compress_sword1 --vorbis" will compress the files using Ogg Vorbis
instead of MP3.
+Running "compress_sword1 --flac" will compress the files using Flac
+instead of MP3.
+
Use "compress_sword1 --help" to get a full list of the options.
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index 4d8601a0d8..a266e5e1a8 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -197,8 +197,8 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
if (data)
_mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_speechHandle, data, size, 11025, SPEECH_FLAGS, SOUND_SPEECH_ID, speechVol, speechPan);
}
-#ifdef USE_MAD
- else if (_cowMode == CowMp3) {
+#ifdef USE_FLAC
+ else if (_cowMode == CowFlac) {
_cowFile.seek(index);
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
// with compressed audio, we can't calculate the wave volume.
@@ -212,6 +212,19 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
else if (_cowMode == CowVorbis) {
_cowFile.seek(index);
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
+ // with compressed audio, we can't calculate the wave volume.
+ // so default to talking.
+ for (int cnt = 0; cnt < 480; cnt++)
+ _waveVolume[cnt] = true;
+ _waveVolPos = 0;
+ }
+#endif
+#ifdef USE_MAD
+ else if (_cowMode == CowMp3) {
+ _cowFile.seek(index);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
+ // with compressed audio, we can't calculate the wave volume.
+ // so default to talking.
for (int cnt = 0; cnt < 480; cnt++)
_waveVolume[cnt] = true;
_waveVolPos = 0;
@@ -332,6 +345,16 @@ void Sound::initCowSystem(void) {
/* look for speech1/2.clu in the data dir
and speech/speech.clu (running from cd or using cd layout)
*/
+#ifdef USE_FLAC
+ if (!_cowFile.isOpen()) {
+ sprintf(cowName, "SPEECH%d.CLF", SwordEngine::_systemVars.currentCD);
+ _cowFile.open(cowName);
+ if (_cowFile.isOpen()) {
+ debug(1, "Using Vorbis compressed Speech Cluster");
+ _cowMode = CowFlac;
+ }
+ }
+#endif
#ifdef USE_VORBIS
if (!_cowFile.isOpen()) {
sprintf(cowName, "SPEECH%d.CLV", SwordEngine::_systemVars.currentCD);
diff --git a/engines/sword1/sound.h b/engines/sword1/sound.h
index fb608a9631..fafc9c2d06 100644
--- a/engines/sword1/sound.h
+++ b/engines/sword1/sound.h
@@ -66,8 +66,9 @@ class ResMan;
enum CowMode {
CowWave = 0,
- CowMp3,
+ CowFlac,
CowVorbis,
+ CowMp3,
CowDemo
};