[Scummvm-cvs-logs] CVS: scummvm/sound resample.cpp,1.9,1.10 resample.h,1.2,1.3
Max Horn
fingolfin at users.sourceforge.net
Mon Sep 8 20:51:19 CEST 2003
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv17824
Modified Files:
resample.cpp resample.h
Log Message:
start to use code from the original resample codebase, since it uses fixed point math instead of float; however, the code is not at all complete right now, I just commit this to get it off my HD (neither the old nor the new code in resample.cpp work anyway)
Index: resample.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/resample.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- resample.cpp 6 Aug 2003 17:13:04 -0000 1.9
+++ resample.cpp 8 Sep 2003 15:32:36 -0000 1.10
@@ -1,224 +1,592 @@
-/*
-* July 5, 1991
-* Copyright 1991 Lance Norskog And Sundry Contributors
-* This source code is freely redistributable and may be used for
-* any purpose. This copyright notice must be maintained.
-* Lance Norskog And Sundry Contributors are not responsible for
-* the consequences of using this software.
-*/
-/*
- * Sound Tools rate change effect file.
[...1166 lines suppressed...]
- st_resample_stop(&effp);
+// st_resample_stop(&rstuff);
+ free(X1);
+ free(X2);
+ free(Y1);
+ free(Y2);
}
int ResampleRateConverter::flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol) {
- return st_resample_flow(&effp, input, obuf, &osamp, vol);
+// return st_resample_flow(&rstuff, input, obuf, &osamp, vol);
+ return 0;
}
int ResampleRateConverter::drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol) {
- return st_resample_drain(&effp, obuf, &osamp, vol);
+// return st_resample_drain(&rstuff, obuf, &osamp, vol);
+ return 0;
}
Index: resample.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/resample.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- resample.h 6 Aug 2003 17:13:04 -0000 1.2
+++ resample.h 8 Sep 2003 15:32:37 -0000 1.3
@@ -24,15 +24,64 @@
#include "sound/rate.h"
-typedef struct {
- byte priv[1024];
-} eff_struct;
-typedef eff_struct *eff_t;
+
+/* this Float MUST match that in filter.c */
+#define Float double/*float*/
+
+// From resample's stddef.h
+typedef int16 HWORD;
+typedef uint16 UHWORD;
+typedef int32 WORD;
+typedef uint32 UWORD;
+
+#define MAX_HWORD (32767)
+#define MIN_HWORD (-32768)
+
+
+#define MAXNWING 8192
+
+
+/* Private data for Lerp via LCM file */
+typedef struct resamplestuff {
+ double Factor; /* Factor = Fout/Fin sample rates */
+ int quadr; /* non-zero to use qprodUD quadratic interpolation */
+
+
+ long Nq;
+
+ long dhb;
+
+ long a, b; /* gcd-reduced input,output rates */
+ long t; /* Current time/pos for exact-coeff's method */
+
+ long Xh; /* number of past/future samples needed by filter */
+ long Xoff; /* Xh plus some room for creep */
+ long Xread; /* X[Xread] is start-position to enter new samples */
+ long Xp; /* X[Xp] is position to start filter application */
+ long Xsize, Ysize; /* size (Floats) of X[],Y[] */
+ long Yposition; /* FIXME: offset into Y buffer */
+ Float *X, *Y; /* I/O buffers */
+} *resample_t;
+
/** High quality rate conversion algorithm, based on SoX (http://sox.sourceforge.net). */
class ResampleRateConverter : public RateConverter {
protected:
- eff_struct effp;
+ resamplestuff rstuff;
+
+ int quadr; /* non-zero to use qprodUD quadratic interpolation */
+
+ UHWORD LpScl; /* Unity-gain scale factor */
+ UHWORD Nwing; /* Filter table size */
+ UHWORD Nmult; /* Filter length for up-conversions */
+ HWORD Imp[MAXNWING]; /* Filter coefficients */
+ HWORD ImpD[MAXNWING]; /* ImpD[n] = Imp[n+1]-Imp[n] */
+
+ HWORD *X1, *Y1;
+ HWORD *X2, *Y2;
+
+ UWORD Time; /* Current time/pos in input sample */
+
public:
ResampleRateConverter(st_rate_t inrate, st_rate_t outrate, int quality);
~ResampleRateConverter();
More information about the Scummvm-git-logs
mailing list