media/libsoundtouch/src/InterpolateLinear.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:e152f8949ab1
1 ////////////////////////////////////////////////////////////////////////////////
2 ///
3 /// Linear interpolation routine.
4 ///
5 /// Author : Copyright (c) Olli Parviainen
6 /// Author e-mail : oparviai 'at' iki.fi
7 /// SoundTouch WWW: http://www.surina.net/soundtouch
8 ///
9 ////////////////////////////////////////////////////////////////////////////////
10 //
11 // $Id: InterpolateLinear.h 179 2014-01-06 18:41:42Z oparviai $
12 //
13 ////////////////////////////////////////////////////////////////////////////////
14 //
15 // License :
16 //
17 // SoundTouch audio processing library
18 // Copyright (c) Olli Parviainen
19 //
20 // This library is free software; you can redistribute it and/or
21 // modify it under the terms of the GNU Lesser General Public
22 // License as published by the Free Software Foundation; either
23 // version 2.1 of the License, or (at your option) any later version.
24 //
25 // This library is distributed in the hope that it will be useful,
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 // Lesser General Public License for more details.
29 //
30 // You should have received a copy of the GNU Lesser General Public
31 // License along with this library; if not, write to the Free Software
32 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35
36 #ifndef _InterpolateLinear_H_
37 #define _InterpolateLinear_H_
38
39 #include "RateTransposer.h"
40 #include "STTypes.h"
41
42 namespace soundtouch
43 {
44
45 /// Linear transposer class that uses integer arithmetics
46 class InterpolateLinearInteger : public TransposerBase
47 {
48 protected:
49 int iFract;
50 int iRate;
51
52 virtual void resetRegisters();
53
54 virtual int transposeMono(SAMPLETYPE *dest,
55 const SAMPLETYPE *src,
56 int &srcSamples);
57 virtual int transposeStereo(SAMPLETYPE *dest,
58 const SAMPLETYPE *src,
59 int &srcSamples);
60 virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples);
61 public:
62 InterpolateLinearInteger();
63
64 /// Sets new target rate. Normal rate = 1.0, smaller values represent slower
65 /// rate, larger faster rates.
66 virtual void setRate(float newRate);
67 };
68
69
70 /// Linear transposer class that uses floating point arithmetics
71 class InterpolateLinearFloat : public TransposerBase
72 {
73 protected:
74 float fract;
75
76 virtual void resetRegisters();
77
78 virtual int transposeMono(SAMPLETYPE *dest,
79 const SAMPLETYPE *src,
80 int &srcSamples);
81 virtual int transposeStereo(SAMPLETYPE *dest,
82 const SAMPLETYPE *src,
83 int &srcSamples);
84 virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples);
85
86 public:
87 InterpolateLinearFloat();
88 };
89
90 }
91
92 #endif

mercurial