[Scummvm-cvs-logs] SF.net SVN: scummvm:[40855] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun May 24 11:40:49 CEST 2009


Revision: 40855
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40855&view=rev
Author:   thebluegr
Date:     2009-05-24 09:40:48 +0000 (Sun, 24 May 2009)

Log Message:
-----------
Fixed audio synchronization in the CD version of KQ5

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/resource.cpp

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2009-05-24 08:53:46 UTC (rev 40854)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2009-05-24 09:40:48 UTC (rev 40855)
@@ -1029,6 +1029,7 @@
 // Used for speech playback in CD games
 reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) {
 	Audio::Mixer *mixer = g_system->getMixer();
+	int sampleLen = 0;
 
 	switch (UKPV(0)) {
 	case kSci1AudioWPlay:
@@ -1041,6 +1042,7 @@
 
 		if (audioRes) {
 			audioStream = Audio::makeLinearInputStream(audioRes->data, audioRes->size, _audioRate, Audio::Mixer::FLAG_UNSIGNED, 0, 0);
+			sampleLen = audioRes->size * 60 / _audioRate; 
 		} else {
 			// No patch file found, read it from the audio volume
 			byte volume;
@@ -1070,13 +1072,16 @@
 								Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, 0, 0);
 					}
 				}
+
+				sampleLen = size * 60 / _audioRate;
 			}
 		}
 
 		if (audioStream)
 			mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_audioHandle, audioStream);
 		}
-		break;
+
+		return make_reg(0, sampleLen);		// return sample length in ticks
 	case kSci1AudioStop:
 		mixer->stopHandle(_audioHandle);
 		break;
@@ -1088,7 +1093,7 @@
 		break;
 	case kSci1AudioPosition:
 		if (mixer->isSoundHandleActive(_audioHandle)) {
-			return make_reg(0, mixer->getSoundElapsedTime(_audioHandle) * 6 / 100); // return elapsed time in 1/60th
+			return make_reg(0, mixer->getSoundElapsedTime(_audioHandle) * 6 / 100); // return elapsed time in ticks
 		} else {	
 			return make_reg(0, -1); // Sound finished
 		}

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2009-05-24 08:53:46 UTC (rev 40854)
+++ scummvm/trunk/engines/sci/resource.cpp	2009-05-24 09:40:48 UTC (rev 40855)
@@ -54,7 +54,7 @@
 	"SCI WIN/32"
 };
 
-const int sci_max_resource_nr[] = {65536, 1000, 2048, 2048, 2048, 8192, 8192, 65536};
+const int sci_max_resource_nr[] = {65536, 1000, 2048, 2048, 2048, 65536, 65536, 65536};
 
 const char *sci_error_types[] = {
 	"No error",


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