aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/queen/sound.cpp19
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();