diff options
author | Johannes Schickel | 2010-01-05 02:42:35 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-01-05 02:42:35 +0000 |
commit | 2ef2064f44764e53b7317265dad471f5ee160300 (patch) | |
tree | 2fdba9f815d59e144e0aad0be49a6c8efbf1a824 /sound | |
parent | f5c3bd887e2257fc7fdfb0d141ddbae592f1e83b (diff) | |
download | scummvm-rg350-2ef2064f44764e53b7317265dad471f5ee160300.tar.gz scummvm-rg350-2ef2064f44764e53b7317265dad471f5ee160300.tar.bz2 scummvm-rg350-2ef2064f44764e53b7317265dad471f5ee160300.zip |
Make RateConverter::flow return the number of sample pairs written, like it's documented in the .cpp file.
svn-id: r47014
Diffstat (limited to 'sound')
-rw-r--r-- | sound/rate.cpp | 12 | ||||
-rw-r--r-- | sound/rate.h | 5 |
2 files changed, 11 insertions, 6 deletions
diff --git a/sound/rate.cpp b/sound/rate.cpp index 91213b312c..2321852b8e 100644 --- a/sound/rate.cpp +++ b/sound/rate.cpp @@ -101,7 +101,7 @@ SimpleRateConverter<stereo, reverseStereo>::SimpleRateConverter(st_rate_t inrate /* * 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 @@ int SimpleRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_samp 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 @@ int SimpleRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_samp obuf += 2; } - return ST_SUCCESS; + return (obuf - ostart) / 2; } /** @@ -210,7 +210,7 @@ LinearRateConverter<stereo, reverseStereo>::LinearRateConverter(st_rate_t inrate /* * 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 @@ int LinearRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_samp 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 @@ int LinearRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_samp opos += opos_inc; } } - return ST_SUCCESS; + return (obuf - ostart) / 2; } diff --git a/sound/rate.h b/sound/rate.h index a45601549c..fb231e4c4a 100644 --- a/sound/rate.h +++ b/sound/rate.h @@ -74,7 +74,12 @@ class RateConverter { 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; }; |