diff --git a/sound/mixer.cpp b/sound/mixer.cpp index b9e3f2441bc..40f59714ab7 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -27,6 +27,7 @@ #include "sound/mixer.h" #include "sound/rate.h" +#include "sound/audiostream.h" #pragma mark - diff --git a/sound/rate.cpp b/sound/rate.cpp index 552c3fbd14b..a99794c6ef8 100644 --- a/sound/rate.cpp +++ b/sound/rate.cpp @@ -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. diff --git a/sound/rate.h b/sound/rate.h index a3ef9652d13..67224b23776 100644 --- a/sound/rate.h +++ b/sound/rate.h @@ -22,13 +22,12 @@ #ifndef SOUND_RATE_H #define SOUND_RATE_H -#include -#include #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; diff --git a/sound/resample.cpp b/sound/resample.cpp index 32cc19e2c58..99deeaf3aa6 100644 --- a/sound/resample.cpp +++ b/sound/resample.cpp @@ -50,18 +50,55 @@ * Get the idea? :) */ +#include "stdafx.h" #include -#include -#include -#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< bad for quality of course, but easiest to implement and would get this going again. @@ -293,6 +331,7 @@ But better for efficiency would be to rewrite those to deal with 2 channels, too 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); @@ -740,17 +779,6 @@ static void LpFilter(double *c, long N, double frq, double Beta, long Num) { #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) { // FIXME: quality is for now a nasty hack. // Valid values are 0,1,2,3 (everything else is treated like 0 for now) diff --git a/sound/resample.h b/sound/resample.h index f66ad75a5d9..c64787906dd 100644 --- a/sound/resample.h +++ b/sound/resample.h @@ -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@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. +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001-2003 The ScummVM project * - * This source code is distributed in the hope that it will be useful, + * 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. + + * 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. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * 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. + * + * $Header$ * */ -/* Conversion constants */ -#define Lc 7 -#define Nc (1<