aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1
diff options
context:
space:
mode:
authorTravis Howell2007-06-26 03:08:03 +0000
committerTravis Howell2007-06-26 03:08:03 +0000
commit9cee28492d5c7d4beb0763aee138be570c5156c8 (patch)
tree29dd34346c59b026fedc91cfcb4c12e0dc49c7a5 /engines/sword1
parent38cbbf14fc36f96e022d348d582d3d3a64d0df41 (diff)
downloadscummvm-rg350-9cee28492d5c7d4beb0763aee138be570c5156c8.tar.gz
scummvm-rg350-9cee28492d5c7d4beb0763aee138be570c5156c8.tar.bz2
scummvm-rg350-9cee28492d5c7d4beb0763aee138be570c5156c8.zip
Add FLAC support for speech in Broken Sword 1.
svn-id: r27721
Diffstat (limited to 'engines/sword1')
-rw-r--r--engines/sword1/sound.cpp27
-rw-r--r--engines/sword1/sound.h3
2 files changed, 27 insertions, 3 deletions
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
};