1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libsoundtouch/src/InterpolateLinear.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +//////////////////////////////////////////////////////////////////////////////// 1.5 +/// 1.6 +/// Linear interpolation routine. 1.7 +/// 1.8 +/// Author : Copyright (c) Olli Parviainen 1.9 +/// Author e-mail : oparviai 'at' iki.fi 1.10 +/// SoundTouch WWW: http://www.surina.net/soundtouch 1.11 +/// 1.12 +//////////////////////////////////////////////////////////////////////////////// 1.13 +// 1.14 +// $Id: InterpolateLinear.h 179 2014-01-06 18:41:42Z oparviai $ 1.15 +// 1.16 +//////////////////////////////////////////////////////////////////////////////// 1.17 +// 1.18 +// License : 1.19 +// 1.20 +// SoundTouch audio processing library 1.21 +// Copyright (c) Olli Parviainen 1.22 +// 1.23 +// This library is free software; you can redistribute it and/or 1.24 +// modify it under the terms of the GNU Lesser General Public 1.25 +// License as published by the Free Software Foundation; either 1.26 +// version 2.1 of the License, or (at your option) any later version. 1.27 +// 1.28 +// This library is distributed in the hope that it will be useful, 1.29 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 1.30 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.31 +// Lesser General Public License for more details. 1.32 +// 1.33 +// You should have received a copy of the GNU Lesser General Public 1.34 +// License along with this library; if not, write to the Free Software 1.35 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1.36 +// 1.37 +//////////////////////////////////////////////////////////////////////////////// 1.38 + 1.39 +#ifndef _InterpolateLinear_H_ 1.40 +#define _InterpolateLinear_H_ 1.41 + 1.42 +#include "RateTransposer.h" 1.43 +#include "STTypes.h" 1.44 + 1.45 +namespace soundtouch 1.46 +{ 1.47 + 1.48 +/// Linear transposer class that uses integer arithmetics 1.49 +class InterpolateLinearInteger : public TransposerBase 1.50 +{ 1.51 +protected: 1.52 + int iFract; 1.53 + int iRate; 1.54 + 1.55 + virtual void resetRegisters(); 1.56 + 1.57 + virtual int transposeMono(SAMPLETYPE *dest, 1.58 + const SAMPLETYPE *src, 1.59 + int &srcSamples); 1.60 + virtual int transposeStereo(SAMPLETYPE *dest, 1.61 + const SAMPLETYPE *src, 1.62 + int &srcSamples); 1.63 + virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples); 1.64 +public: 1.65 + InterpolateLinearInteger(); 1.66 + 1.67 + /// Sets new target rate. Normal rate = 1.0, smaller values represent slower 1.68 + /// rate, larger faster rates. 1.69 + virtual void setRate(float newRate); 1.70 +}; 1.71 + 1.72 + 1.73 +/// Linear transposer class that uses floating point arithmetics 1.74 +class InterpolateLinearFloat : public TransposerBase 1.75 +{ 1.76 +protected: 1.77 + float fract; 1.78 + 1.79 + virtual void resetRegisters(); 1.80 + 1.81 + virtual int transposeMono(SAMPLETYPE *dest, 1.82 + const SAMPLETYPE *src, 1.83 + int &srcSamples); 1.84 + virtual int transposeStereo(SAMPLETYPE *dest, 1.85 + const SAMPLETYPE *src, 1.86 + int &srcSamples); 1.87 + virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples); 1.88 + 1.89 +public: 1.90 + InterpolateLinearFloat(); 1.91 +}; 1.92 + 1.93 +} 1.94 + 1.95 +#endif