libsidplayfp 1.8.8
Filter.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 FILTER_H
24#define FILTER_H
25
26namespace reSIDfp
27{
28
32class Filter
33{
34protected:
36 unsigned int fc;
37
39 unsigned char res;
40
42 unsigned char vol;
43
45 bool filt1, filt2, filt3, filtE;
46
49
51 bool hp, bp, lp;
52
53private:
55 bool enabled;
56
58 unsigned char filt;
59
60protected:
64 virtual void updatedCenterFrequency() = 0;
65
69 virtual void updatedResonance() = 0;
70
74 virtual void updatedMixing() = 0;
75
76public:
77 Filter() :
78 fc(0),
79 res(0),
80 vol(0),
81 filt1(false),
82 filt2(false),
83 filt3(false),
84 filtE(false),
85 voice3off(false),
86 hp(false),
87 bp(false),
88 lp(false),
89 enabled(true),
90 filt(0) {}
91
92 virtual ~Filter() {}
93
102 virtual int clock(int v1, int v2, int v3) = 0;
103
109 void enable(bool enable);
110
114 void reset();
115
121 void writeFC_LO(unsigned char fc_lo);
122
128 void writeFC_HI(unsigned char fc_hi);
129
135 void writeRES_FILT(unsigned char res_filt);
136
142 void writeMODE_VOL(unsigned char mode_vol);
143
144 virtual void input(int input) = 0;
145};
146
147} // namespace reSIDfp
148
149#endif
Definition: Filter.h:33
virtual void updatedMixing()=0
bool hp
Highpass, bandpass, and lowpass filter modes.
Definition: Filter.h:51
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:48
void writeFC_HI(unsigned char fc_hi)
Definition: Filter.cpp:56
virtual void updatedResonance()=0
bool filt1
Routing to filter or outside filter.
Definition: Filter.h:45
virtual void updatedCenterFrequency()=0
unsigned char vol
Current volume.
Definition: Filter.h:42
unsigned char res
Filter resonance.
Definition: Filter.h:39
void enable(bool enable)
Definition: Filter.cpp:28
void reset()
Definition: Filter.cpp:42
void writeMODE_VOL(unsigned char mode_vol)
Definition: Filter.cpp:80
virtual int clock(int v1, int v2, int v3)=0
unsigned int fc
Filter cutoff frequency.
Definition: Filter.h:36