[Scummvm-cvs-logs] CVS: scummvm/sound audiostream.cpp,1.27,1.28

Max Horn fingolfin at users.sourceforge.net
Mon Aug 4 18:23:02 CEST 2003


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

Modified Files:
	audiostream.cpp 
Log Message:
and finally VorbisInputStream::readBuffer. Once we verified the new readBuffer methods all work, we can get rid of readIntern again and merge those back into the regular read() methods

Index: audiostream.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiostream.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- audiostream.cpp	5 Aug 2003 01:14:27 -0000	1.27
+++ audiostream.cpp	5 Aug 2003 01:22:09 -0000	1.28
@@ -512,10 +512,24 @@
 }
 
 int VorbisInputStream::readBuffer(int16 *buffer, int numSamples) {
-	int samples;
-	for (samples = 0; samples < numSamples && !eosIntern(); samples++) {
+	int samples = 0;
+#if 1
+	const int16 * const bufferEnd = _buffer + ARRAYSIZE(_buffer);
+	while (samples < numSamples && !eosIntern()) {
+		if (_pos >= bufferEnd) {
+			refill();
+		}
+		const int len = MIN(numSamples, bufferEnd - _pos);
+		memcpy(buffer, _pos, len * 2);
+		buffer += len;
+		_pos += len;
+		samples += len;
+	}
+#else
+	for (; samples < numSamples && !eosIntern(); samples++) {
 		*buffer++ = readIntern();
 	}
+#endif
 	return samples;
 }
 





More information about the Scummvm-git-logs mailing list