libsidplayfp 2.3.1
Filter.h
1/*
2 * This file is part of libsidplayfp, a SID player engine.
3 *
4 * Copyright 2011-2017 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 FILTER_H
24#define FILTER_H
25
26namespace reSIDfp
27{
28
32class Filter
33{
34protected:
36 unsigned short* currentGain;
37
39 unsigned short* currentMixer;
40
42 unsigned short* currentSummer;
43
45 unsigned short* currentResonance;
46
48 int Vhp;
49
51 int Vbp;
52
54 int Vlp;
55
57 int ve;
58
60 unsigned int fc;
61
63 bool filt1, filt2, filt3, filtE;
64
67
69 bool hp, bp, lp;
70
72 unsigned char vol;
73
74private:
76 bool enabled;
77
79 unsigned char filt;
80
81protected:
85 virtual void updatedCenterFrequency() = 0;
86
90 virtual void updateResonance(unsigned char res) = 0;
91
95 virtual void updatedMixing() = 0;
96
97public:
98 Filter() :
99 currentGain(nullptr),
100 currentMixer(nullptr),
101 currentSummer(nullptr),
102 currentResonance(nullptr),
103 Vhp(0),
104 Vbp(0),
105 Vlp(0),
106 ve(0),
107 fc(0),
108 filt1(false),
109 filt2(false),
110 filt3(false),
111 filtE(false),
112 voice3off(false),
113 hp(false),
114 bp(false),
115 lp(false),
116 vol(0),
117 enabled(true),
118 filt(0) {}
119
120 virtual ~Filter() {}
121
130 virtual unsigned short clock(int v1, int v2, int v3) = 0;
131
137 void enable(bool enable);
138
142 void reset();
143
149 void writeFC_LO(unsigned char fc_lo);
150
156 void writeFC_HI(unsigned char fc_hi);
157
163 void writeRES_FILT(unsigned char res_filt);
164
170 void writeMODE_VOL(unsigned char mode_vol);
171
172 virtual void input(int input) = 0;
173};
174
175} // namespace reSIDfp
176
177#endif
Definition: Filter.h:33
virtual void updatedMixing()=0
virtual unsigned short clock(int v1, int v2, int v3)=0
bool hp
Highpass, bandpass, and lowpass filter modes.
Definition: Filter.h:69
unsigned short * currentGain
Current volume amplifier setting.
Definition: Filter.h:36
int Vbp
Filter bandpass state.
Definition: Filter.h:51
unsigned short * currentSummer
Filter input summer setting.
Definition: Filter.h:42
void writeFC_LO(unsigned char fc_lo)
Definition: Filter.cpp:50
void writeRES_FILT(unsigned char res_filt)
Definition: Filter.cpp:62
bool voice3off
Switch voice 3 off.
Definition: Filter.h:66
unsigned short * currentMixer
Current filter/voice mixer setting.
Definition: Filter.h:39
int ve
Filter external input.
Definition: Filter.h:57
void writeFC_HI(unsigned char fc_hi)
Definition: Filter.cpp:56
int Vhp
Filter highpass state.
Definition: Filter.h:48
virtual void updateResonance(unsigned char res)=0
unsigned short * currentResonance
Filter resonance value.
Definition: Filter.h:45
bool filt1
Routing to filter or outside filter.
Definition: Filter.h:63
virtual void updatedCenterFrequency()=0
unsigned char vol
Current volume.
Definition: Filter.h:72
int Vlp
Filter lowpass state.
Definition: Filter.h:54
void enable(bool enable)
Definition: Filter.cpp:28
void reset()
Definition: Filter.cpp:42
void writeMODE_VOL(unsigned char mode_vol)
Definition: Filter.cpp:79
unsigned int fc
Filter cutoff frequency.
Definition: Filter.h:60