libsidplayfp 1.0.3
|
00001 /* 00002 * This file is part of libsidplayfp, a SID player engine. 00003 * 00004 * Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net> 00005 * Copyright 2007-2010 Antti Lankila 00006 * Copyright 2004 Dag Lem <resid@nimrod.no> 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef FILTER_H 00024 #define FILTER_H 00025 00026 namespace reSIDfp 00027 { 00028 00037 class Filter 00038 { 00039 private: 00043 bool enabled; 00044 00048 char filt; 00049 00050 protected: 00051 00055 double clockFrequency; 00056 00060 int fc; 00061 00065 int res; 00066 00070 int vol; 00071 00075 bool filt1, filt2, filt3, filtE; 00076 00080 bool voice3off; 00081 00085 bool hp, bp, lp; 00086 00087 protected: 00091 virtual void updatedCenterFrequency() = 0; 00092 00096 virtual void updatedResonance() = 0; 00097 00101 virtual void updatedMixing() = 0; 00102 00103 public: 00104 Filter() : 00105 enabled(true), 00106 filt(0), 00107 clockFrequency(0.), 00108 fc(0), 00109 res(0), 00110 vol(0), 00111 filt1(false), 00112 filt2(false), 00113 filt3(false), 00114 filtE(false), 00115 voice3off(false), 00116 hp(false), 00117 bp(false), 00118 lp(false) {} 00119 00120 virtual ~Filter() {} 00121 00130 virtual int clock(int v1, int v2, int v3) = 0; 00131 00137 void enable(bool enable); 00138 00139 void setClockFrequency(double clock); 00140 00144 void reset(); 00145 00151 void writeFC_LO(unsigned char fc_lo); 00152 00158 void writeFC_HI(unsigned char fc_hi); 00159 00165 void writeRES_FILT(unsigned char res_filt); 00166 00172 void writeMODE_VOL(unsigned char mode_vol); 00173 00174 virtual void input(int input) = 0; 00175 }; 00176 00177 } // namespace reSIDfp 00178 00179 #endif