[Scummvm-cvs-logs] SF.net SVN: scummvm:[34170] scummvm/branches/branch-0-12-0/engines/queen/ sound.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Aug 25 20:48:10 CEST 2008


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

Log Message:
-----------
Backported refinement for the workaround for old compressed files.

Modified Paths:
--------------
    scummvm/branches/branch-0-12-0/engines/queen/sound.cpp

Modified: scummvm/branches/branch-0-12-0/engines/queen/sound.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/engines/queen/sound.cpp	2008-08-25 18:47:27 UTC (rev 34169)
+++ scummvm/branches/branch-0-12-0/engines/queen/sound.cpp	2008-08-25 18:48:05 UTC (rev 34170)
@@ -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