aboutsummaryrefslogtreecommitdiff
path: root/sound/resample.h
diff options
context:
space:
mode:
authorMax Horn2003-09-08 15:32:37 +0000
committerMax Horn2003-09-08 15:32:37 +0000
commitef373fe2e8f60a8740d6201c8d8928af1a9b6dba (patch)
tree971bda1b6e7fe67d45d8209cba9368b1b49b8f2c /sound/resample.h
parent63cd3051f33f8e8279f36a3436be676e1881f376 (diff)
downloadscummvm-rg350-ef373fe2e8f60a8740d6201c8d8928af1a9b6dba.tar.gz
scummvm-rg350-ef373fe2e8f60a8740d6201c8d8928af1a9b6dba.tar.bz2
scummvm-rg350-ef373fe2e8f60a8740d6201c8d8928af1a9b6dba.zip
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)
svn-id: r10089
Diffstat (limited to 'sound/resample.h')
-rw-r--r--sound/resample.h59
1 files changed, 54 insertions, 5 deletions
diff --git a/sound/resample.h b/sound/resample.h
index c64787906d..46c33244ce 100644
--- a/sound/resample.h
+++ b/sound/resample.h
@@ -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();