[Scummvm-cvs-logs] CVS: scummvm/sound resample.cpp,1.8,1.9 resample.h,1.1,1.2 rate.h,1.17,1.18 rate.cpp,1.25,1.26 mixer.cpp,1.107,1.108

Max Horn fingolfin at users.sourceforge.net
Wed Aug 6 10:14:05 CEST 2003


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv6126

Modified Files:
	resample.cpp resample.h rate.h rate.cpp mixer.cpp 
Log Message:
some cleanup

Index: resample.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/resample.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- resample.cpp	5 Aug 2003 23:03:42 -0000	1.8
+++ resample.cpp	6 Aug 2003 17:13:04 -0000	1.9
@@ -50,18 +50,55 @@
  * Get the idea? :)
  */
 
+#include "stdafx.h"
 #include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include "rate.h"
+#include "sound/resample.h"
+#include "sound/audiostream.h"
 
-/* resample includes */
-#include "resample.h"
 
-typedef struct {
-	byte priv[1024];
-} eff_struct;
-typedef eff_struct *eff_t;
+/* Conversion constants */
+#define Lc        7
+#define Nc       (1<<Lc)
+#define La        16
+#define Na       (1<<La)
+#define Lp       (Lc+La)
+#define Np       (1<<Lp)
+#define Amask    (Na-1)
+#define Pmask    (Np-1)
+
+#define MAXNWING  (80<<Lc)
+/* Description of constants:
+ *
+ * Nc - is the number of look-up values available for the lowpass filter
+ *    between the beginning of its impulse response and the "cutoff time"
+ *    of the filter.  The cutoff time is defined as the reciprocal of the
+ *    lowpass-filter cut off frequence in Hz.  For example, if the
+ *    lowpass filter were a sinc function, Nc would be the index of the
+ *    impulse-response lookup-table corresponding to the first zero-
+ *    crossing of the sinc function.  (The inverse first zero-crossing
+ *    time of a sinc function equals its nominal cutoff frequency in Hz.)
+ *    Nc must be a power of 2 due to the details of the current
+ *    implementation. The default value of 128 is sufficiently high that
+ *    using linear interpolation to fill in between the table entries
+ *    gives approximately 16-bit precision, and quadratic interpolation
+ *    gives about 23-bit (float) precision in filter coefficients.
+ *
+ * Lc - is log base 2 of Nc.
+ *
+ * La - is the number of bits devoted to linear interpolation of the
+ *    filter coefficients.
+ *
+ * Lp - is La + Lc, the number of bits to the right of the binary point
+ *    in the integer "time" variable. To the left of the point, it indexes
+ *    the input array (X), and to the right, it is interpreted as a number
+ *    between 0 and 1 sample of the input X.  The default value of 23 is
+ *    about right.  There is a constraint that the filter window must be
+ *    "addressable" in a int32_t, more precisely, if Nmult is the number
+ *    of sinc zero-crossings in the right wing of the filter window, then
+ *    (Nwing<<Lp) must be expressible in 31 bits.
+ *
+ */
+
 
 /* this Float MUST match that in filter.c */
 #define Float double/*float*/
@@ -284,6 +321,7 @@
 	long Nproc;		// The number of bytes we process to generate Nout output bytes
 	const long obufSize = *osamp;
 
+/*
 TODO: adjust for the changes made to AudioInputStream; add support for stereo
 initially, could just average the left/right channel -> bad for quality of course,
 but easiest to implement and would get this going again.
@@ -293,6 +331,7 @@
 Because esp in SrcEX/SrcUD, only very few computations depend on the input data,
 and dealing with both channels in parallel should only be a little slower than dealing
 with them alone
+*/
 
 	// Constrain amount we actually process
 	//fprintf(stderr,"Xp %d, Xread %d\n",r->Xp, r->Xread);
@@ -738,17 +777,6 @@
 
 
 #pragma mark -
-
-
-class ResampleRateConverter : public RateConverter {
-protected:
-	eff_struct effp;
-public:
-	ResampleRateConverter(st_rate_t inrate, st_rate_t outrate, int quality);
-	~ResampleRateConverter();
-	virtual int flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol);
-	virtual int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol);
-};
 
 
 ResampleRateConverter::ResampleRateConverter(st_rate_t inrate, st_rate_t outrate, int quality) {

Index: resample.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/resample.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- resample.h	24 Jul 2003 17:46:38 -0000	1.1
+++ resample.h	6 Aug 2003 17:13:04 -0000	1.2
@@ -1,61 +1,44 @@
-/*
- * FILE: resample.h
- *   BY: Julius Smith (at CCRMA, Stanford U)
- * C BY: translated from SAIL to C by Christopher Lee Fraley
- *          (cf0v at andrew.cmu.edu)
- * DATE: 7-JUN-88
- * VERS: 2.0  (17-JUN-88, 3:00pm)
- */
-
-/*
- * October 29, 1999
- * Various changes, bugfixes(?), increased precision, by Stan Brooks.
- *
- * This source code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001-2003 The ScummVM project
  *
- */
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
 
-/* Conversion constants */
-#define Lc        7
-#define Nc       (1<<Lc)
-#define La        16
-#define Na       (1<<La)
-#define Lp       (Lc+La)
-#define Np       (1<<Lp)
-#define Amask    (Na-1)
-#define Pmask    (Np-1)
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
 
-#define MAXNWING  (80<<Lc)
-/* Description of constants:
- *
- * Nc - is the number of look-up values available for the lowpass filter
- *    between the beginning of its impulse response and the "cutoff time"
- *    of the filter.  The cutoff time is defined as the reciprocal of the
- *    lowpass-filter cut off frequence in Hz.  For example, if the
- *    lowpass filter were a sinc function, Nc would be the index of the
- *    impulse-response lookup-table corresponding to the first zero-
- *    crossing of the sinc function.  (The inverse first zero-crossing
- *    time of a sinc function equals its nominal cutoff frequency in Hz.)
- *    Nc must be a power of 2 due to the details of the current
- *    implementation. The default value of 128 is sufficiently high that
- *    using linear interpolation to fill in between the table entries
- *    gives approximately 16-bit precision, and quadratic interpolation
- *    gives about 23-bit (float) precision in filter coefficients.
- *
- * Lc - is log base 2 of Nc.
- *
- * La - is the number of bits devoted to linear interpolation of the
- *    filter coefficients.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * Lp - is La + Lc, the number of bits to the right of the binary point
- *    in the integer "time" variable. To the left of the point, it indexes
- *    the input array (X), and to the right, it is interpreted as a number
- *    between 0 and 1 sample of the input X.  The default value of 23 is
- *    about right.  There is a constraint that the filter window must be
- *    "addressable" in a int32_t, more precisely, if Nmult is the number
- *    of sinc zero-crossings in the right wing of the filter window, then
- *    (Nwing<<Lp) must be expressible in 31 bits.
+ * $Header$
  *
  */
+
+#ifndef SOUND_RESAMPLE_H
+#define SOUND_RESAMPLE_H
+
+#include "sound/rate.h"
+
+typedef struct {
+	byte priv[1024];
+} eff_struct;
+typedef eff_struct *eff_t;
+
+/** High quality rate conversion algorithm, based on SoX (http://sox.sourceforge.net). */
+class ResampleRateConverter : public RateConverter {
+protected:
+	eff_struct effp;
+public:
+	ResampleRateConverter(st_rate_t inrate, st_rate_t outrate, int quality);
+	~ResampleRateConverter();
+	virtual int flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol);
+	virtual int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol);
+};
+
+
+#endif

Index: rate.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/rate.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- rate.h	5 Aug 2003 23:03:42 -0000	1.17
+++ rate.h	6 Aug 2003 17:13:04 -0000	1.18
@@ -22,13 +22,12 @@
 #ifndef SOUND_RATE_H
 #define SOUND_RATE_H
 
-#include <stdio.h>
-#include <assert.h>
 #include "common/scummsys.h"
 #include "common/engine.h"
 #include "common/util.h"
 
-#include "sound/audiostream.h"
+//#include "sound/audiostream.h"
+class AudioInputStream;
 
 typedef int16 st_sample_t;
 typedef uint16 st_volume_t;

Index: rate.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/rate.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- rate.cpp	4 Aug 2003 22:49:29 -0000	1.25
+++ rate.cpp	6 Aug 2003 17:13:04 -0000	1.26
@@ -29,6 +29,7 @@
 
 #include "stdafx.h"
 #include "sound/rate.h"
+#include "sound/audiostream.h"
 
 /**
  * The precision of the fractional computations used by the rate converter.

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- mixer.cpp	5 Aug 2003 23:03:42 -0000	1.107
+++ mixer.cpp	6 Aug 2003 17:13:04 -0000	1.108
@@ -27,6 +27,7 @@
 
 #include "sound/mixer.h"
 #include "sound/rate.h"
+#include "sound/audiostream.h"
 
 
 #pragma mark -





More information about the Scummvm-git-logs mailing list