[Scummvm-cvs-logs] CVS: scummvm/sound rate.cpp,1.13,1.14
Max Horn
fingolfin at users.sourceforge.net
Sat Aug 2 04:39:03 CEST 2003
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv2667
Modified Files:
rate.cpp
Log Message:
previous mod was techincally incorrect, this one should be better (but might still be buggy?)
Index: rate.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/rate.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- rate.cpp 2 Aug 2003 10:47:35 -0000 1.13
+++ rate.cpp 2 Aug 2003 11:38:23 -0000 1.14
@@ -144,7 +144,7 @@
resume:
// Loop as long as the outpos trails behind, and as long as there is
// still space in the output buffer.
- while (rate->ipos > rate->opos && obuf < oend) {
+ while (rate->ipos > rate->opos) {
// interpolate
out = (st_sample_t) (ilast[0] + (((icur[0] - ilast[0]) * rate->opos_frac + (1UL << (FRAC_BITS-1))) >> FRAC_BITS));
@@ -168,6 +168,9 @@
tmp = rate->opos_frac + rate->opos_inc_frac;
rate->opos = rate->opos + rate->opos_inc + (tmp >> FRAC_BITS);
rate->opos_frac = tmp & ((1UL << FRAC_BITS) - 1);
+
+ if (obuf < oend)
+ goto the_end;
}
// Increment input position again (for the sample we read now)
@@ -179,13 +182,11 @@
the_end:
*osamp = (obuf - ostart) / 2;
- if (!input.eof()) {
- rate->ilast[0] = ilast[0];
- rate->icur[0] = input.read();
- if (stereo) {
- rate->ilast[1] = ilast[1];
- rate->icur[1] = input.read();
- }
+ rate->ilast[0] = ilast[0];
+ rate->icur[0] = icur[0];
+ if (stereo) {
+ rate->ilast[1] = ilast[1];
+ rate->icur[1] = icur[1];
}
return (ST_SUCCESS);
}
More information about the Scummvm-git-logs
mailing list