libsidplayfp  2.0.2
SincResampler.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net>
5  * Copyright 2007-2010 Antti Lankila
6  * Copyright 2004 Dag Lem <resid@nimrod.no>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef SINCRESAMPLER_H
24 #define SINCRESAMPLER_H
25 
26 #include "Resampler.h"
27 
28 #include <string>
29 #include <map>
30 
31 #include "../array.h"
32 
33 #include "sidcxx11.h"
34 
35 namespace reSIDfp
36 {
37 
53 class SincResampler final : public Resampler
54 {
55 private:
57  static const int RINGSIZE = 2048;
58 
59 private:
61  matrix_t* firTable;
62 
63  int sampleIndex;
64 
66  int firRES;
67 
69  int firN;
70 
71  const int cyclesPerSample;
72 
73  int sampleOffset;
74 
75  int outputValue;
76 
77  short sample[RINGSIZE * 2];
78 
79 private:
80  int fir(int subcycle);
81 
82 public:
103  SincResampler(double clockFrequency, double samplingFrequency, double highestAccurateFrequency);
104 
105  bool input(int input) override;
106 
107  int output() const override { return outputValue; }
108 
109  void reset() override;
110 };
111 
112 } // namespace reSIDfp
113 
114 #endif
reSIDfp::Resampler
Definition: Resampler.h:33
reSIDfp::SincResampler::input
bool input(int input) override
Definition: SincResampler.cpp:243
reSIDfp::SincResampler
Definition: SincResampler.h:54
reSIDfp::SincResampler::SincResampler
SincResampler(double clockFrequency, double samplingFrequency, double highestAccurateFrequency)
Definition: SincResampler.cpp:147
matrix
Definition: array.h:43