[Scummvm-cvs-logs] SF.net SVN: scummvm: [32274] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Mon May 26 01:12:32 CEST 2008


Revision: 32274
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32274&view=rev
Author:   drmccoy
Date:     2008-05-25 16:12:32 -0700 (Sun, 25 May 2008)

Log Message:
-----------
Increased _soundSliceLength's accuracy. This fixes the A/V sync problems in Woodruff's intro

Modified Paths:
--------------
    scummvm/trunk/engines/gob/coktelvideo.cpp
    scummvm/trunk/engines/gob/coktelvideo.h

Modified: scummvm/trunk/engines/gob/coktelvideo.cpp
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.cpp	2008-05-25 22:46:16 UTC (rev 32273)
+++ scummvm/trunk/engines/gob/coktelvideo.cpp	2008-05-25 23:12:32 UTC (rev 32274)
@@ -123,8 +123,9 @@
 			return false;
 		}
 
-		_soundSliceLength = 1000 / (_soundFreq / _soundSliceSize);
-		_frameLength = _soundSliceLength;
+		_soundSliceLength = (uint32) (((double) (1000 << 16)) / 
+				((double) _soundFreq / (double) _soundSliceSize));
+		_frameLength = _soundSliceLength >> 16;
 
 		_soundStage = 1;
 		_hasSound = true;
@@ -325,8 +326,8 @@
 			return;
 
 		if (_skipFrames == 0) {
-			int32 waitTime = (_curFrame * _soundSliceLength) -
-				(g_system->getMillis() - _soundStartTime);
+			int32 waitTime = ((_curFrame * _soundSliceLength) -
+				((g_system->getMillis() - _soundStartTime) << 16)) >> 16;
 
 			if (waitTime < 0) {
 				_skipFrames = -waitTime / _soundSliceLength;
@@ -943,11 +944,10 @@
 			_soundSliceSize = -_soundSliceSize;
 		}
 
-		_soundSliceLength = (uint16) (1000.0 /
+		_soundSliceLength = (uint32) (((double) (1000 << 16)) / 
 				((double) _soundFreq / (double) _soundSliceSize));
+		_frameLength = _soundSliceLength >> 16;
 
-		_frameLength = _soundSliceLength;
-
 		_soundStage = 1;
 		_audioStream = Audio::makeAppendableAudioStream(_soundFreq,
 				(_soundBytesPerSample == 2) ? Audio::Mixer::FLAG_16BITS : 0);

Modified: scummvm/trunk/engines/gob/coktelvideo.h
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.h	2008-05-25 22:46:16 UTC (rev 32273)
+++ scummvm/trunk/engines/gob/coktelvideo.h	2008-05-25 23:12:32 UTC (rev 32274)
@@ -190,7 +190,11 @@
 	int16 getHeight() const { return _height; }
 	uint16 getFramesCount() const { return _framesCount; }
 	uint16 getCurrentFrame() const { return _curFrame; }
-	int16 getFrameRate() const { if (_hasSound) return 1000 / _soundSliceLength; return _frameRate; }
+	int16 getFrameRate() const {
+		if (_hasSound)
+			return 1000 / (_soundSliceLength >> 16);
+		return _frameRate;
+	}
 	uint32 getSyncLag() const { return _skipFrames; }
 	const byte *getPalette() const { return _palette; }
 
@@ -260,7 +264,7 @@
 	int16 _soundFreq;
 	int16 _soundSliceSize;
 	int16 _soundSlicesCount;
-	uint16 _soundSliceLength;
+	uint32 _soundSliceLength;
 
 	Audio::AppendableAudioStream *_audioStream;
 	Audio::SoundHandle _audioHandle;


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