[Scummvm-cvs-logs] CVS: scummvm/sword2/driver d_sound.cpp,1.114,1.115

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun Aug 22 23:18:01 CEST 2004


Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24186/sword2/driver

Modified Files:
	d_sound.cpp 
Log Message:
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.


Index: d_sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_sound.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- d_sound.cpp	22 Aug 2004 14:27:57 -0000	1.114
+++ d_sound.cpp	23 Aug 2004 06:17:40 -0000	1.115
@@ -804,10 +804,17 @@
 	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 @@
 	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:





More information about the Scummvm-git-logs mailing list