[Scummvm-cvs-logs] SF.net SVN: scummvm:[33472] scummvm/branches/branch-0-12-0

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Jul 31 15:46:57 CEST 2008


Revision: 33472
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33472&view=rev
Author:   eriktorbjorn
Date:     2008-07-31 13:46:55 +0000 (Thu, 31 Jul 2008)

Log Message:
-----------
Backported patch #2030058 ("Workaround for incorrectly compressed FotAQ").

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

Modified: scummvm/branches/branch-0-12-0/NEWS
===================================================================
--- scummvm/branches/branch-0-12-0/NEWS	2008-07-31 13:45:58 UTC (rev 33471)
+++ scummvm/branches/branch-0-12-0/NEWS	2008-07-31 13:46:55 UTC (rev 33472)
@@ -26,6 +26,10 @@
      Simon the Sorcerer 1.
    - Fixed palette issues in Amiga versions of Simon the Sorcerer 1.
 
+ Queen:
+   - Speech is played at the correct sample rate. (It used to be pitched a bit
+     too low.)
+
  SCUMM:
    - Rewrote parts of Digital iMUSE, fixing some bugs.
    - Rewrote the internal timer code, fixing some speed issues in e.g. COMI.

Modified: scummvm/branches/branch-0-12-0/engines/queen/sound.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/engines/queen/sound.cpp	2008-07-31 13:45:58 UTC (rev 33471)
+++ scummvm/branches/branch-0-12-0/engines/queen/sound.cpp	2008-07-31 13:46:55 UTC (rev 33472)
@@ -35,6 +35,7 @@
 #include "queen/queen.h"
 #include "queen/resource.h"
 
+#include "sound/audiostream.h"
 #include "sound/flac.h"
 #include "sound/mididrv.h"
 #include "sound/mp3.h"
@@ -45,6 +46,42 @@
 
 namespace Queen {
 
+// The sounds in the PC versions are all played at 11840 Hz. Unfortunately, we
+// did not know that at the time, so there are plenty of compressed versions
+// which claim that they should be played at 11025 Hz. This "wrapper" class
+// works around that.
+
+class AudioStreamWrapper : public Audio::AudioStream {
+protected:
+	Audio::AudioStream *_stream;
+
+public:
+	AudioStreamWrapper(Audio::AudioStream *stream) {
+		_stream = stream;
+	}
+	~AudioStreamWrapper() {
+		delete _stream;
+	}
+	int readBuffer(int16 *buffer, const int numSamples) {
+		return _stream->readBuffer(buffer, numSamples);
+	}
+	bool isStereo() const {
+		return _stream->isStereo();
+	}
+	bool endOfData() const {
+		return _stream->endOfData();
+	}
+	bool endOfStream() {
+		return _stream->endOfStream();
+	}
+	int getRate() const {
+		return 11840;
+	}
+	int32 getTotalPlayTime() {
+		return _stream->getTotalPlayTime();
+	}
+};
+
 class SilentSound : public PCSound {
 public:
 	SilentSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
@@ -69,7 +106,7 @@
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
 		Common::MemoryReadStream *tmp = f->readStream(size);
 		assert(tmp);
-		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(tmp, true));
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeMP3Stream(tmp, true)));
 	}
 };
 #endif
@@ -82,7 +119,7 @@
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
 		Common::MemoryReadStream *tmp = f->readStream(size);
 		assert(tmp);
-		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(tmp, true));
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeVorbisStream(tmp, true)));
 	}
 };
 #endif
@@ -95,7 +132,7 @@
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
 		Common::MemoryReadStream *tmp = f->readStream(size);
 		assert(tmp);
-		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(tmp, true));
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeFlacStream(tmp, true)));
 	}
 };
 #endif // #ifdef USE_FLAC


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