Filter.h
/*
* This file is part of libsidplayfp, a SID player engine.
*
* Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net>
* Copyright 2007-2010 Antti Lankila
* Copyright 2004 Dag Lem <resid@nimrod.no>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef FILTER_H
#define FILTER_H
namespace reSIDfp
{
class Filter
{
protected:
unsigned int fc;
unsigned char res;
unsigned char vol;
bool filt1, filt2, filt3, filtE;
bool voice3off;
bool hp, bp, lp;
private:
bool enabled;
unsigned char filt;
protected:
virtual void updatedCenterFrequency() = 0;
virtual void updatedResonance() = 0;
virtual void updatedMixing() = 0;
public:
Filter() :
fc(0),
res(0),
vol(0),
filt1(false),
filt2(false),
filt3(false),
filtE(false),
voice3off(false),
hp(false),
bp(false),
lp(false),
enabled(true),
filt(0) {}
virtual ~Filter() {}
virtual int clock(int v1, int v2, int v3) = 0;
void enable(bool enable);
void reset();
void writeFC_LO(unsigned char fc_lo);
void writeFC_HI(unsigned char fc_hi);
void writeRES_FILT(unsigned char res_filt);
void writeMODE_VOL(unsigned char mode_vol);
virtual void input(int input) = 0;
};
} // namespace reSIDfp
#endif
reSIDfp::Filter::updatedMixing
virtual void updatedMixing()=0
reSIDfp::Filter::hp
bool hp
Highpass, bandpass, and lowpass filter modes.
Definition: Filter.h:51
reSIDfp::Filter::vol
unsigned char vol
Current volume.
Definition: Filter.h:42
reSIDfp::Filter::filt1
bool filt1
Routing to filter or outside filter.
Definition: Filter.h:45
reSIDfp
Definition: Dac.cpp:25
reSIDfp::Filter::updatedCenterFrequency
virtual void updatedCenterFrequency()=0
reSIDfp::Filter::writeMODE_VOL
void writeMODE_VOL(unsigned char mode_vol)
Definition: Filter.cpp:80
reSIDfp::Filter::voice3off
bool voice3off
Switch voice 3 off.
Definition: Filter.h:48
reSIDfp::Filter::clock
virtual int clock(int v1, int v2, int v3)=0
reSIDfp::Filter::writeRES_FILT
void writeRES_FILT(unsigned char res_filt)
Definition: Filter.cpp:62
reSIDfp::Filter::res
unsigned char res
Filter resonance.
Definition: Filter.h:39
reSIDfp::Filter::reset
void reset()
Definition: Filter.cpp:42
reSIDfp::Filter::writeFC_HI
void writeFC_HI(unsigned char fc_hi)
Definition: Filter.cpp:56
reSIDfp::Filter::writeFC_LO
void writeFC_LO(unsigned char fc_lo)
Definition: Filter.cpp:50
reSIDfp::Filter::enable
void enable(bool enable)
Definition: Filter.cpp:28
reSIDfp::Filter
Definition: Filter.h:32
reSIDfp::Filter::fc
unsigned int fc
Filter cutoff frequency.
Definition: Filter.h:36
reSIDfp::Filter::updatedResonance
virtual void updatedResonance()=0