libsidplayfp  1.0.1
WaveformCalculator.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 WAVEFORMCALCULATOR_h
24 #define WAVEFORMCALCULATOR_h
25 
26 #include <map>
27 
28 #include "siddefs-fp.h"
29 #include "array.h"
30 
31 
32 namespace reSIDfp
33 {
34 
35 typedef struct
36 {
37  float bias;
38  float pulsestrength;
39  float topbit;
40  float distance;
41  float stmix;
43 
50 {
51 private:
52  std::map<const CombinedWaveformConfig*, array<short> > CACHE;
53 
54  static const CombinedWaveformConfig config[2][4];
55 
63  short calculateCombinedWaveform(CombinedWaveformConfig config, int waveform, int accumulator) const;
64 
66 
67 public:
68  static WaveformCalculator* getInstance();
69 
76  array<short>* buildTable(ChipModel model);
77 };
78 
79 } // namespace reSIDfp
80 
81 #endif