[Scummvm-cvs-logs] SF.net SVN: scummvm: [27500] scummvm/trunk/sound
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Jun 17 01:41:38 CEST 2007
Revision: 27500
http://scummvm.svn.sourceforge.net/scummvm/?rev=27500&view=rev
Author: fingolfin
Date: 2007-06-16 16:41:37 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
cleanup
Modified Paths:
--------------
scummvm/trunk/sound/rate.cpp
scummvm/trunk/sound/rate.h
Modified: scummvm/trunk/sound/rate.cpp
===================================================================
--- scummvm/trunk/sound/rate.cpp 2007-06-16 23:07:25 UTC (rev 27499)
+++ scummvm/trunk/sound/rate.cpp 2007-06-16 23:41:37 UTC (rev 27500)
@@ -78,7 +78,7 @@
SimpleRateConverter(st_rate_t inrate, st_rate_t outrate);
int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r);
int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol) {
- return (ST_SUCCESS);
+ return ST_SUCCESS;
}
};
@@ -128,7 +128,7 @@
inPtr = inBuf;
inLen = input.readBuffer(inBuf, ARRAYSIZE(inBuf));
if (inLen <= 0)
- goto the_end;
+ return ST_EOF;
}
inLen -= (stereo ? 2 : 1);
opos--;
@@ -152,8 +152,7 @@
obuf += 2;
}
-the_end:
- return (ST_SUCCESS);
+ return ST_SUCCESS;
}
/**
@@ -189,7 +188,7 @@
LinearRateConverter(st_rate_t inrate, st_rate_t outrate);
int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r);
int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol) {
- return (ST_SUCCESS);
+ return ST_SUCCESS;
}
};
@@ -244,7 +243,7 @@
inPtr = inBuf;
inLen = input.readBuffer(inBuf, ARRAYSIZE(inBuf));
if (inLen <= 0)
- goto the_end;
+ return ST_EOF;
}
inLen -= (stereo ? 2 : 1);
ilast0 = icur0;
@@ -258,10 +257,10 @@
// Loop as long as the outpos trails behind, and as long as there is
// still space in the output buffer.
- while (0 > opos) {
+ while (0 > opos && obuf < oend) {
// interpolate
st_sample_t out0, out1;
- out0 = (st_sample_t)(ilast0 + (((icur0 - ilast0) * opos_frac + (1UL << (FRAC_BITS-1))) >> FRAC_BITS));
+ out0 = (st_sample_t)(ilast0 + (((icur0 - ilast0) * opos_frac + (1UL << (FRAC_BITS-1))) >> FRAC_BITS));
out1 = (stereo ?
(st_sample_t)(ilast1 + (((icur1 - ilast1) * opos_frac + (1UL << (FRAC_BITS-1))) >> FRAC_BITS)) :
out0);
@@ -278,14 +277,9 @@
long tmp = opos_frac + opos_inc_frac;
opos += opos_inc + (tmp >> FRAC_BITS);
opos_frac = tmp & ((1UL << FRAC_BITS) - 1);
-
- // Abort if we reached the end of the output buffer
- if (obuf >= oend)
- goto the_end;
}
}
-the_end:
- return (ST_SUCCESS);
+ return ST_SUCCESS;
}
@@ -339,11 +333,11 @@
obuf += 2;
}
- return (ST_SUCCESS);
+ return ST_SUCCESS;
}
virtual int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol) {
- return (ST_SUCCESS);
+ return ST_SUCCESS;
}
};
Modified: scummvm/trunk/sound/rate.h
===================================================================
--- scummvm/trunk/sound/rate.h 2007-06-16 23:07:25 UTC (rev 27499)
+++ scummvm/trunk/sound/rate.h 2007-06-16 23:41:37 UTC (rev 27500)
@@ -40,11 +40,15 @@
typedef uint32 st_rate_t;
/* Minimum and maximum values a sample can hold. */
-#define ST_SAMPLE_MAX 0x7fffL
-#define ST_SAMPLE_MIN (-ST_SAMPLE_MAX - 1L)
+enum {
+ ST_SAMPLE_MAX = 0x7fffL,
+ ST_SAMPLE_MIN = (-ST_SAMPLE_MAX - 1L)
+};
-#define ST_EOF (-1)
-#define ST_SUCCESS (0)
+enum {
+ ST_EOF = -1,
+ ST_SUCCESS = 0
+};
static inline void clampedAdd(int16& a, int b) {
register int val;
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