aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2003-07-31 19:08:57 +0000
committerMax Horn2003-07-31 19:08:57 +0000
commit16425977b75b1128bae917f22ca9cec9720fc863 (patch)
tree99503ee03a42598da64a80cb42880fa251a23268 /sound
parent1bcdcffc7d6defa280f4c0d6a08e8cab1ebe2078 (diff)
downloadscummvm-rg350-16425977b75b1128bae917f22ca9cec9720fc863.tar.gz
scummvm-rg350-16425977b75b1128bae917f22ca9cec9720fc863.tar.bz2
scummvm-rg350-16425977b75b1128bae917f22ca9cec9720fc863.zip
icur was not being saved between rate conversion calls
svn-id: r9344
Diffstat (limited to 'sound')
-rw-r--r--sound/rate.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/sound/rate.cpp b/sound/rate.cpp
index 23752dcbb8..8416b88dc8 100644
--- a/sound/rate.cpp
+++ b/sound/rate.cpp
@@ -19,6 +19,7 @@
#include "rate.h"
#include <math.h>
+
/*
* Linear Interpolation.
*
@@ -44,15 +45,19 @@
typedef struct ratestuff
{
- unsigned long opos_frac; /* fractional position of the output stream in input stream unit */
- unsigned long opos;
+ /** fractional position of the output stream in input stream unit */
+ unsigned long opos, opos_frac;
- unsigned long opos_inc_frac; /* fractional position increment in the output stream */
- unsigned long opos_inc;
+ /** fractional position increment in the output stream */
+ unsigned long opos_inc, opos_inc_frac;
- unsigned long ipos; /* position in the input stream (integer) */
+ /** position in the input stream (integer) */
+ unsigned long ipos;
- st_sample_t ilast[2]; /* last sample(s) in the input stream (left/right channel) */
+ /** last sample(s) in the input stream (left/right channel) */
+ st_sample_t ilast[2];
+ /** current sample(s) in the input stream (left/right channel) */
+ st_sample_t icur[2];
} *rate_t;
/*
@@ -84,8 +89,9 @@ int st_rate_start(eff_t effp, st_rate_t inrate, st_rate_t outrate)
rate->ipos = 0;
- rate->ilast[0] = 0;
- rate->ilast[1] = 0;
+ rate->ilast[0] = rate->ilast[1] = 0;
+ rate->icur[0] = rate->icur[1] = 0;
+
return (ST_SUCCESS);
}
@@ -102,8 +108,11 @@ int st_rate_flow(eff_t effp, AudioInputStream &input, st_sample_t *obuf, st_size
unsigned long tmp;
ilast[0] = rate->ilast[0];
- if (stereo)
+ icur[0] = rate->icur[0];
+ if (stereo) {
ilast[1] = rate->ilast[1];
+ icur[1] = rate->icur[1];
+ }
ostart = obuf;
oend = obuf + *osamp * 2;
@@ -171,8 +180,11 @@ resume:
the_end:
*osamp = (obuf - ostart) / 2;
rate->ilast[0] = ilast[0];
- if (stereo)
+ rate->icur[0] = icur[0];
+ if (stereo) {
rate->ilast[1] = ilast[1];
+ rate->icur[1] = icur[1];
+ }
return (ST_SUCCESS);
}