[Scummvm-cvs-logs] SF.net SVN: scummvm:[47014] scummvm/trunk/sound

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jan 5 03:42:36 CET 2010


Revision: 47014
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47014&view=rev
Author:   lordhoto
Date:     2010-01-05 02:42:35 +0000 (Tue, 05 Jan 2010)

Log Message:
-----------
Make RateConverter::flow return the number of sample pairs written, like it's documented in the .cpp file.

Modified Paths:
--------------
    scummvm/trunk/sound/rate.cpp
    scummvm/trunk/sound/rate.h

Modified: scummvm/trunk/sound/rate.cpp
===================================================================
--- scummvm/trunk/sound/rate.cpp	2010-01-05 02:27:24 UTC (rev 47013)
+++ scummvm/trunk/sound/rate.cpp	2010-01-05 02:42:35 UTC (rev 47014)
@@ -101,7 +101,7 @@
 
 /*
  * Processed signed long samples from ibuf to obuf.
- * Return number of samples processed.
+ * Return number of sample pairs processed.
  */
 template<bool stereo, bool reverseStereo>
 int SimpleRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) {
@@ -119,7 +119,7 @@
 				inPtr = inBuf;
 				inLen = input.readBuffer(inBuf, ARRAYSIZE(inBuf));
 				if (inLen <= 0)
-					return ST_EOF;
+					return (obuf - ostart) / 2;
 			}
 			inLen -= (stereo ? 2 : 1);
 			opos--;
@@ -143,7 +143,7 @@
 
 		obuf += 2;
 	}
-	return ST_SUCCESS;
+	return (obuf - ostart) / 2;
 }
 
 /**
@@ -210,7 +210,7 @@
 
 /*
  * Processed signed long samples from ibuf to obuf.
- * Return number of samples processed.
+ * Return number of sample pairs processed.
  */
 template<bool stereo, bool reverseStereo>
 int LinearRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) {
@@ -228,7 +228,7 @@
 				inPtr = inBuf;
 				inLen = input.readBuffer(inBuf, ARRAYSIZE(inBuf));
 				if (inLen <= 0)
-					return ST_EOF;
+					return (obuf - ostart) / 2;
 			}
 			inLen -= (stereo ? 2 : 1);
 			ilast0 = icur0;
@@ -262,7 +262,7 @@
 			opos += opos_inc;
 		}
 	}
-	return ST_SUCCESS;
+	return (obuf - ostart) / 2;
 }
 
 

Modified: scummvm/trunk/sound/rate.h
===================================================================
--- scummvm/trunk/sound/rate.h	2010-01-05 02:27:24 UTC (rev 47013)
+++ scummvm/trunk/sound/rate.h	2010-01-05 02:42:35 UTC (rev 47014)
@@ -74,7 +74,12 @@
 public:
 	RateConverter() {}
 	virtual ~RateConverter() {}
+
+	/**
+	 * @return Number of sample pairs written into the buffer.
+	 */
 	virtual int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) = 0;
+
 	virtual int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol) = 0;
 };
 


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