aboutsummaryrefslogtreecommitdiff
path: root/sword2/driver
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-08-23 06:17:40 +0000
committerTorbjörn Andersson2004-08-23 06:17:40 +0000
commit44eca16eb69613c0fc7247c7eb5447d560339466 (patch)
tree520163bc2dea173f0c72ab37a3ee61b6d0225d45 /sword2/driver
parente46c81ad7432330add28f3da2a8f2f8cdf5f0a3a (diff)
downloadscummvm-rg350-44eca16eb69613c0fc7247c7eb5447d560339466.tar.gz
scummvm-rg350-44eca16eb69613c0fc7247c7eb5447d560339466.tar.bz2
scummvm-rg350-44eca16eb69613c0fc7247c7eb5447d560339466.zip
Fixed the bug that caused Vorbis and FLAC to misbehave with compressed
speech. (Apparently it was just an accident that MP3 worked.) Unfortunately I had to change the file format of the compressed files to include both the compressed and uncompressed size, but since the tool to create these files has only lived as an item in the patch tracker, no one should have exptected it to be the final, working version, right? Right. svn-id: r14698
Diffstat (limited to 'sword2/driver')
-rw-r--r--sword2/driver/d_sound.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index 0157b9f54e..d0fd81cec7 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -804,10 +804,17 @@ uint32 Sound::preFetchCompSpeech(uint32 speechid, uint16 **buf) {
if (!soundMode)
return 0;
- fp.seek((speechid + 1) * 8, SEEK_SET);
+ if (soundMode == kWAVMode)
+ fp.seek((speechid + 1) * 8, SEEK_SET);
+ else
+ fp.seek((speechid + 1) * 12, SEEK_SET);
uint32 speechPos = fp.readUint32LE();
uint32 speechLength = fp.readUint32LE();
+ uint32 encLength = 0;
+
+ if (soundMode != kWAVMode)
+ encLength = fp.readUint32LE();
if (!speechPos || !speechLength) {
fp.close();
@@ -819,17 +826,17 @@ uint32 Sound::preFetchCompSpeech(uint32 speechid, uint16 **buf) {
switch (soundMode) {
#ifdef USE_MAD
case kMP3Mode:
- input = makeMP3Stream(&fp, speechLength);
+ input = makeMP3Stream(&fp, encLength);
break;
#endif
#ifdef USE_VORBIS
case kVorbisMode:
- input = makeVorbisStream(&fp, speechLength);
+ input = makeVorbisStream(&fp, encLength);
break;
#endif
#ifdef USE_FLAC
case kFlacMode:
- input = makeFlacStream(&fp, speechLength);
+ input = makeFlacStream(&fp, encLength);
break;
#endif
default: