diff options
Diffstat (limited to 'engines/queen/sound.cpp')
-rw-r--r-- | engines/queen/sound.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index 6513a92018..ccaac8227d 100644 --- a/engines/queen/sound.cpp +++ b/engines/queen/sound.cpp @@ -54,10 +54,27 @@ namespace Queen { class AudioStreamWrapper : public Audio::AudioStream { protected: Audio::AudioStream *_stream; + int _rate; public: AudioStreamWrapper(Audio::AudioStream *stream) { _stream = stream; + + int rate = _stream->getRate(); + + // A file where the sample rate claims to be 11025 Hz is + // probably compressed with the old tool. We force the real + // sample rate, which is 11840 Hz. + // + // However, a file compressed with the newer tool is not + // guaranteed to have a sample rate of 11840 Hz. LAME will + // automatically resample it to 12000 Hz. So in all other + // cases, we use the rate from the file. + + if (rate == 11025) + _rate = 11840; + else + _rate = rate; } ~AudioStreamWrapper() { delete _stream; @@ -75,7 +92,7 @@ public: return _stream->endOfStream(); } int getRate() const { - return 11840; + return _rate; } int32 getTotalPlayTime() { return _stream->getTotalPlayTime(); @@ -314,10 +331,8 @@ void SBSound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *so if (sound) { f->read(sound, size); byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE; - if (soundHandle == &_speechHandle) - _mixer->playRaw(Audio::Mixer::kSpeechSoundType, soundHandle, sound, size, 11025, flags); - else - _mixer->playRaw(Audio::Mixer::kSFXSoundType, soundHandle, sound, size, 11025, flags); + Audio::Mixer::SoundType type = (soundHandle == &_speechHandle) ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType; + _mixer->playRaw(type, soundHandle, sound, size, 11840, flags); } } |