michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: /// michael@0: /// Linear interpolation routine. michael@0: /// michael@0: /// Author : Copyright (c) Olli Parviainen michael@0: /// Author e-mail : oparviai 'at' iki.fi michael@0: /// SoundTouch WWW: http://www.surina.net/soundtouch michael@0: /// michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: // michael@0: // $Id: InterpolateLinear.h 179 2014-01-06 18:41:42Z oparviai $ michael@0: // michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: // michael@0: // License : michael@0: // michael@0: // SoundTouch audio processing library michael@0: // Copyright (c) Olli Parviainen michael@0: // michael@0: // This library is free software; you can redistribute it and/or michael@0: // modify it under the terms of the GNU Lesser General Public michael@0: // License as published by the Free Software Foundation; either michael@0: // version 2.1 of the License, or (at your option) any later version. michael@0: // michael@0: // This library is distributed in the hope that it will be useful, michael@0: // but WITHOUT ANY WARRANTY; without even the implied warranty of michael@0: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU michael@0: // Lesser General Public License for more details. michael@0: // michael@0: // You should have received a copy of the GNU Lesser General Public michael@0: // License along with this library; if not, write to the Free Software michael@0: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA michael@0: // michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: #ifndef _InterpolateLinear_H_ michael@0: #define _InterpolateLinear_H_ michael@0: michael@0: #include "RateTransposer.h" michael@0: #include "STTypes.h" michael@0: michael@0: namespace soundtouch michael@0: { michael@0: michael@0: /// Linear transposer class that uses integer arithmetics michael@0: class InterpolateLinearInteger : public TransposerBase michael@0: { michael@0: protected: michael@0: int iFract; michael@0: int iRate; michael@0: michael@0: virtual void resetRegisters(); michael@0: michael@0: virtual int transposeMono(SAMPLETYPE *dest, michael@0: const SAMPLETYPE *src, michael@0: int &srcSamples); michael@0: virtual int transposeStereo(SAMPLETYPE *dest, michael@0: const SAMPLETYPE *src, michael@0: int &srcSamples); michael@0: virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples); michael@0: public: michael@0: InterpolateLinearInteger(); michael@0: michael@0: /// Sets new target rate. Normal rate = 1.0, smaller values represent slower michael@0: /// rate, larger faster rates. michael@0: virtual void setRate(float newRate); michael@0: }; michael@0: michael@0: michael@0: /// Linear transposer class that uses floating point arithmetics michael@0: class InterpolateLinearFloat : public TransposerBase michael@0: { michael@0: protected: michael@0: float fract; michael@0: michael@0: virtual void resetRegisters(); michael@0: michael@0: virtual int transposeMono(SAMPLETYPE *dest, michael@0: const SAMPLETYPE *src, michael@0: int &srcSamples); michael@0: virtual int transposeStereo(SAMPLETYPE *dest, michael@0: const SAMPLETYPE *src, michael@0: int &srcSamples); michael@0: virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples); michael@0: michael@0: public: michael@0: InterpolateLinearFloat(); michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif