[Scummvm-cvs-logs] CVS: scummvm/sound audiostream.cpp,1.15,1.16

Max Horn fingolfin at users.sourceforge.net
Thu Jul 31 12:33:28 CEST 2003


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

Modified Files:
	audiostream.cpp 
Log Message:
fixed MP3InputStream, now seems to work properly (kind of a surprise)

Index: audiostream.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiostream.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- audiostream.cpp	31 Jul 2003 18:35:01 -0000	1.15
+++ audiostream.cpp	31 Jul 2003 19:32:38 -0000	1.16
@@ -259,7 +259,7 @@
 
 		} else if (MAD_RECOVERABLE(_stream.error)) {
 			// FIXME: should we do anything here?
-			warning("MP3InputStream: Recoverable error...");
+			debug(1, "MP3InputStream: Recoverable error...");
 		} else {
 			error("MP3InputStream: Unrecoverable error");
 		}
@@ -279,14 +279,7 @@
 	// Time over -> input steam ends
 	if (mad_timer_compare(_duration, mad_timer_zero) <= 0)
 		return true;
-	// Data left in the PCM buffer -> we are not yet done! 
-	if (_posInFrame < _synth.pcm.length)
-		return false;
-	// EOF of the input file, we are done
-	if (_size < 0)
-		return true;
-	// Otherwise, we are still good to go
-	return false;
+	return (_posInFrame >= _synth.pcm.length);
 }
 
 static inline int scale_sample(mad_fixed_t sample) {
@@ -304,13 +297,9 @@
 }
 
 int16 MP3InputStream::read() {
-	if (_posInFrame >= _synth.pcm.length) {
-		refill();
-		if (_size < 0)	// EOF
-			return 0;
-	}
+	if (_size < 0 || _posInFrame >= _synth.pcm.length)	// EOF
+		return 0;
 
-	
 	int16 sample;
 	if (_isStereo) {
 		sample = (int16)scale_sample(_synth.pcm.samples[_curChannel][_posInFrame]);
@@ -324,7 +313,11 @@
 		sample = (int16)scale_sample(_synth.pcm.samples[0][_posInFrame]);
 		_posInFrame++;
 	}
-	
+
+	if (_posInFrame >= _synth.pcm.length) {
+		refill();
+	}
+
 	return sample;
 }
 





More information about the Scummvm-git-logs mailing list