[Scummvm-cvs-logs] SF.net SVN: scummvm: [24775] scummvm/trunk/engines/queen
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Thu Nov 23 23:10:25 CET 2006
Revision: 24775
http://svn.sourceforge.net/scummvm/?rev=24775&view=rev
Author: cyx
Date: 2006-11-23 14:10:25 -0800 (Thu, 23 Nov 2006)
Log Message:
-----------
Fix for bug #1599393 - FOTAQ: clicks at the beginning of speech. English talkie version (and probably others) has 2 different .SB file formats, with a different size for the header data. Added code to detect that.
Modified Paths:
--------------
scummvm/trunk/engines/queen/resource.cpp
scummvm/trunk/engines/queen/resource.h
scummvm/trunk/engines/queen/sound.cpp
Modified: scummvm/trunk/engines/queen/resource.cpp
===================================================================
--- scummvm/trunk/engines/queen/resource.cpp 2006-11-23 18:14:16 UTC (rev 24774)
+++ scummvm/trunk/engines/queen/resource.cpp 2006-11-23 22:10:25 UTC (rev 24775)
@@ -257,7 +257,7 @@
return NULL;
}
-Common::File *Resource::giveCompressedSound(const char *filename, uint32 *size) {
+Common::File *Resource::giveSound(const char *filename, uint32 *size) {
assert(strstr(filename, ".SB"));
Common::File *f = NULL;
ResourceEntry *re = resourceEntry(filename);
Modified: scummvm/trunk/engines/queen/resource.h
===================================================================
--- scummvm/trunk/engines/queen/resource.h 2006-11-23 18:14:16 UTC (rev 24774)
+++ scummvm/trunk/engines/queen/resource.h 2006-11-23 22:10:25 UTC (rev 24775)
@@ -71,7 +71,7 @@
bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; }
//! returns a reference to a sound file
- Common::File *giveCompressedSound(const char *filename, uint32 *size);
+ Common::File *giveSound(const char *filename, uint32 *size);
bool isDemo() const { return (_version.features & GF_DEMO) != 0; }
bool isInterview() const { return (_version.features & GF_INTERVIEW) != 0; }
Modified: scummvm/trunk/engines/queen/sound.cpp
===================================================================
--- scummvm/trunk/engines/queen/sound.cpp 2006-11-23 18:14:16 UTC (rev 24774)
+++ scummvm/trunk/engines/queen/sound.cpp 2006-11-23 22:10:25 UTC (rev 24775)
@@ -34,7 +34,8 @@
#include "sound/mp3.h"
#include "sound/vorbis.h"
-#define SB_HEADER_SIZE 110
+#define SB_HEADER_SIZE_V104 110
+#define SB_HEADER_SIZE_V110 122
#define STOP_MUSIC -1
namespace Queen {
@@ -188,12 +189,33 @@
}
bool SBSound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) {
- if (_vm->resource()->fileExists(name)) {
- uint32 size;
- uint8 *sound = _vm->resource()->loadFile(name, SB_HEADER_SIZE, &size, true);
- byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE;
- _mixer->playRaw(soundHandle, sound, size, 11025, flags);
- return true;
+ uint32 size;
+ Common::File *f = _vm->resource()->giveSound(name, &size);
+ if (f) {
+ int headerSize;
+ f->seek(2, SEEK_CUR);
+ uint16 version = f->readUint16LE();
+ switch (version) {
+ case 104:
+ headerSize = SB_HEADER_SIZE_V104;
+ break;
+ case 110:
+ headerSize = SB_HEADER_SIZE_V110;
+ break;
+ default:
+ warning("Unhandled SB file version %d, defaulting to 104\n", version);
+ headerSize = SB_HEADER_SIZE_V104;
+ break;
+ }
+ f->seek(headerSize - 4, SEEK_CUR);
+ size -= headerSize;
+ uint8 *sound = (uint8 *)malloc(size);
+ if (sound) {
+ f->read(sound, size);
+ byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE;
+ _mixer->playRaw(soundHandle, sound, size, 11025, flags);
+ return true;
+ }
}
return false;
}
@@ -201,7 +223,7 @@
#ifdef USE_MAD
bool MP3Sound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) {
uint32 size;
- Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
+ Common::File *f = _vm->resource()->giveSound(name, &size);
if (f) {
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(f, size));
return true;
@@ -213,7 +235,7 @@
#ifdef USE_VORBIS
bool OGGSound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) {
uint32 size;
- Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
+ Common::File *f = _vm->resource()->giveSound(name, &size);
if (f) {
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(f, size));
return true;
@@ -225,7 +247,7 @@
#ifdef USE_FLAC
bool FLACSound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) {
uint32 size;
- Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
+ Common::File *f = _vm->resource()->giveSound(name, &size);
if (f) {
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(f, size));
return true;
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