Filter.h
/*
* This file is part of libsidplayfp, a SID player engine.
*
* Copyright 2011-2017 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 short* currentGain;
unsigned short* currentMixer;
unsigned short* currentSummer;
unsigned short* currentResonance;
int Vhp;
int Vbp;
int Vlp;
int ve;
unsigned int fc;
bool filt1, filt2, filt3, filtE;
bool voice3off;
bool hp, bp, lp;
unsigned char vol;
private:
bool enabled;
unsigned char filt;
protected:
virtual void updatedCenterFrequency() = 0;
virtual void updateResonance(unsigned char res) = 0;
virtual void updatedMixing() = 0;
public:
Filter() :
currentGain(nullptr),
currentMixer(nullptr),
currentSummer(nullptr),
currentResonance(nullptr),
Vhp(0),
Vbp(0),
Vlp(0),
ve(0),
fc(0),
filt1(false),
filt2(false),
filt3(false),
filtE(false),
voice3off(false),
hp(false),
bp(false),
lp(false),
vol(0),
enabled(true),
filt(0) {}
virtual ~Filter() {}
virtual unsigned short 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
Definition Filter.h:33
reSIDfp::Filter::updatedMixing
virtual void updatedMixing()=0
reSIDfp::Filter::clock
virtual unsigned short clock(int v1, int v2, int v3)=0
reSIDfp::Filter::hp
bool hp
Highpass, bandpass, and lowpass filter modes.
Definition Filter.h:69
reSIDfp::Filter::currentGain
unsigned short * currentGain
Current volume amplifier setting.
Definition Filter.h:36
reSIDfp::Filter::Vbp
int Vbp
Filter bandpass state.
Definition Filter.h:51
reSIDfp::Filter::currentSummer
unsigned short * currentSummer
Filter input summer setting.
Definition Filter.h:42
reSIDfp::Filter::writeFC_LO
void writeFC_LO(unsigned char fc_lo)
Definition Filter.cpp:50
reSIDfp::Filter::writeRES_FILT
void writeRES_FILT(unsigned char res_filt)
Definition Filter.cpp:62
reSIDfp::Filter::voice3off
bool voice3off
Switch voice 3 off.
Definition Filter.h:66
reSIDfp::Filter::currentMixer
unsigned short * currentMixer
Current filter/voice mixer setting.
Definition Filter.h:39
reSIDfp::Filter::ve
int ve
Filter external input.
Definition Filter.h:57
reSIDfp::Filter::writeFC_HI
void writeFC_HI(unsigned char fc_hi)
Definition Filter.cpp:56
reSIDfp::Filter::Vhp
int Vhp
Filter highpass state.
Definition Filter.h:48
reSIDfp::Filter::updateResonance
virtual void updateResonance(unsigned char res)=0
reSIDfp::Filter::currentResonance
unsigned short * currentResonance
Filter resonance value.
Definition Filter.h:45
reSIDfp::Filter::filt1
bool filt1
Routing to filter or outside filter.
Definition Filter.h:63
reSIDfp::Filter::updatedCenterFrequency
virtual void updatedCenterFrequency()=0
reSIDfp::Filter::vol
unsigned char vol
Current volume.
Definition Filter.h:72
reSIDfp::Filter::Vlp
int Vlp
Filter lowpass state.
Definition Filter.h:54
reSIDfp::Filter::enable
void enable(bool enable)
Definition Filter.cpp:28
reSIDfp::Filter::reset
void reset()
Definition Filter.cpp:42
reSIDfp::Filter::writeMODE_VOL
void writeMODE_VOL(unsigned char mode_vol)
Definition Filter.cpp:79
reSIDfp::Filter::fc
unsigned int fc
Filter cutoff frequency.
Definition Filter.h:60