[Scummvm-cvs-logs] CVS: scummvm/sound audiostream.h,1.29,1.30 vorbis.cpp,1.8,1.9

James Brown ender at users.sourceforge.net
Sat Jan 17 06:21:01 CET 2004


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv12860/sound

Modified Files:
	audiostream.h vorbis.cpp 
Log Message:
Update BS2 cutscene player with changes from roever: overlay support (default, 8bit backends should define BACKEND_8BIT for fast colour remapping) and sound syncronisation.


Index: audiostream.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiostream.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- audiostream.h	6 Jan 2004 12:45:33 -0000	1.29
+++ audiostream.h	17 Jan 2004 14:20:32 -0000	1.30
@@ -74,6 +74,19 @@
 
 	/** Sample rate of the stream. */
 	virtual int getRate() const = 0;
+
+	/**
+	 * This function returns the number of samples that were delivered to
+	 * the mixer which is a rough estimate of how moch time of the stream
+	 * has been played.
+	 * The exact value is not available as it needs information from the
+	 * audio device on how many samples have been already played
+	 * As our buffer is relatively short the estimate is exact enough
+	 * The return -1 is kind of a hack as this function is only required
+	 * for the video audio sync in the bs2 cutscenes I am to lazy to
+	 * implement it for all subclasses
+	 */
+	virtual int getSamplesPlayed() const { return -1; }
 };
 
 class AppendableAudioStream : public AudioStream {

Index: vorbis.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/vorbis.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- vorbis.cpp	6 Jan 2004 12:45:33 -0000	1.8
+++ vorbis.cpp	17 Jan 2004 14:20:32 -0000	1.9
@@ -172,6 +172,7 @@
 	int16 _buffer[4096];
 	const int16 *_bufferEnd;
 	const int16 *_pos;
+	int _played;
 	
 	void refill();
 	inline bool eosIntern() const;
@@ -184,6 +185,8 @@
 	bool isStereo() const		{ return _numChannels >= 2; }
 	
 	int getRate() const			{ return ov_info(_ov_file, -1)->rate; }
+	int getSamplesPlayed() const { return _played / _numChannels; }
+
 };
 
 
@@ -193,7 +196,7 @@
 
 
 VorbisInputStream::VorbisInputStream(OggVorbis_File *file, int duration) 
-	: _ov_file(file), _bufferEnd(_buffer + ARRAYSIZE(_buffer)) {
+	: _ov_file(file), _bufferEnd(_buffer + ARRAYSIZE(_buffer)), _played(0) {
 
 	// Check the header, determine if this is a stereo stream
 	_numChannels = ov_info(_ov_file, -1)->channels;
@@ -215,6 +218,7 @@
 	if (_pos >= _bufferEnd) {
 		refill();
 	}
+	_played++;
 	return sample;
 }
 
@@ -234,6 +238,7 @@
 			refill();
 		}
 	}
+	_played += samples;
 	return samples;
 }
 





More information about the Scummvm-git-logs mailing list