[Scummvm-cvs-logs] SF.net SVN: scummvm:[34169] scummvm/trunk/engines/queen/sound.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Aug 25 20:47:31 CEST 2008


Revision: 34169
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34169&view=rev
Author:   eriktorbjorn
Date:     2008-08-25 18:47:27 +0000 (Mon, 25 Aug 2008)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/queen/sound.cpp

Modified: scummvm/trunk/engines/queen/sound.cpp
===================================================================
--- scummvm/trunk/engines/queen/sound.cpp	2008-08-25 18:33:18 UTC (rev 34168)
+++ scummvm/trunk/engines/queen/sound.cpp	2008-08-25 18:47:27 UTC (rev 34169)
@@ -54,10 +54,27 @@
 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 @@
 		return _stream->endOfStream();
 	}
 	int getRate() const {
-		return 11840;
+		return _rate;
 	}
 	int32 getTotalPlayTime() {
 		return _stream->getTotalPlayTime();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list