[Scummvm-cvs-logs] scummvm master -> 9a79a336aa5427e8b52683bd39088a2c557245db

clone2727 clone2727 at gmail.com
Thu Aug 25 17:21:52 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9a79a336aa AUDIO: Don't abuse rewind() for looping in XA


Commit: 9a79a336aa5427e8b52683bd39088a2c557245db
    https://github.com/scummvm/scummvm/commit/9a79a336aa5427e8b52683bd39088a2c557245db
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-25T08:16:58-07:00

Commit Message:
AUDIO: Don't abuse rewind() for looping in XA

Thanks to LordHoto for pointing out my stupidity :P

Changed paths:
    audio/decoders/xa.cpp



diff --git a/audio/decoders/xa.cpp b/audio/decoders/xa.cpp
index ab7fd66..818cd2d 100644
--- a/audio/decoders/xa.cpp
+++ b/audio/decoders/xa.cpp
@@ -41,6 +41,8 @@ private:
 	Common::SeekableReadStream *_stream;
 	DisposeAfterUse::Flag _disposeAfterUse;
 
+	void seekToPos(uint pos);
+
 	byte _predictor;
 	double _samples[28];
 	byte _samplesRemaining;
@@ -100,7 +102,7 @@ int XAStream::readBuffer(int16 *buffer, const int numSamples) {
 		byte flags = _stream->readByte();
 		if (flags == 3) {
 			// Loop
-			rewind();
+			seekToPos(_loopPoint);
 			continue;
 		} else if (flags == 6) {
 			// Set loop point
@@ -143,13 +145,16 @@ int XAStream::readBuffer(int16 *buffer, const int numSamples) {
 }
 
 bool XAStream::rewind() {
-	_stream->seek(_loopPoint);
+	seekToPos(0);
+	return true;
+}
+
+void XAStream::seekToPos(uint pos) {
+	_stream->seek(pos);
 	_samplesRemaining = 0;
 	_predictor = 0;
 	_s1 = _s2 = 0.0;
 	_endOfData = false;
-
-	return true;
 }
 
 RewindableAudioStream *makeXAStream(Common::SeekableReadStream *stream, int rate, DisposeAfterUse::Flag disposeAfterUse) {






More information about the Scummvm-git-logs mailing list