diff options
author | Torbjörn Andersson | 2008-08-25 18:47:27 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2008-08-25 18:47:27 +0000 |
commit | 235ab94ef3b964ddae6a817aa64706f362fc7c9b (patch) | |
tree | e7f9a325c1ea3fb294f1a1f60fd3c33c47d8c5ad /engines | |
parent | 7214ab5f5b9050972b2eb9d133b55ef7be45d124 (diff) | |
download | scummvm-rg350-235ab94ef3b964ddae6a817aa64706f362fc7c9b.tar.gz scummvm-rg350-235ab94ef3b964ddae6a817aa64706f362fc7c9b.tar.bz2 scummvm-rg350-235ab94ef3b964ddae6a817aa64706f362fc7c9b.zip |
Refined the workaround for wrongly compressed audio. If the sample rate is given
as 11025 Hz, it should be 11840 Hz. However, a fixed version of compress_queen
won't necessarily produce files with that sample rate, since LAME will resample
the sounds to 12000 Hz. I.e. we can only override the rate if it's exactly 11025.
svn-id: r34169
Diffstat (limited to 'engines')
-rw-r--r-- | engines/queen/sound.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index 27cf1bf6a2..d4fed86bb7 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(); |