tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

InterpolateLinear.h (2908B)


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