libsidplayfp  2.12.0
SincResampler.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2024 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 "../array.h"
29 
30 namespace reSIDfp
31 {
32 
48 class SincResampler final : public Resampler
49 {
50 private:
52  static constexpr int RINGSIZE = 2048;
53 
54 private:
56  matrix_t* firTable;
57 
58  int sampleIndex = 0;
59 
61  int firRES;
62 
64  int firN;
65 
66  const int cyclesPerSample;
67 
68  int sampleOffset = 0;
69 
70  int outputValue = 0;
71 
72  int sample[RINGSIZE * 2];
73 
74 private:
75  int fir(int subcycle);
76 
77 public:
95  double clockFrequency,
96  double samplingFrequency,
97  double highestAccurateFrequency);
98  ~SincResampler() override;
99 
100  bool input(int input) override;
101 
102  int output() const override { return outputValue; }
103 
104  void reset() override;
105 };
106 
107 } // namespace reSIDfp
108 
109 #endif
Definition: Resampler.h:40
Definition: SincResampler.h:49
bool input(int input) override
Definition: SincResampler.cpp:353
SincResampler(double clockFrequency, double samplingFrequency, double highestAccurateFrequency)
Definition: SincResampler.cpp:258