ExternalFilter.h
/*
* This file is part of libsidplayfp, a SID player engine.
*
* Copyright 2011-2025 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 EXTERNALFILTER_H
#define EXTERNALFILTER_H
#include "siddefs-fp.h"
namespace reSIDfp
{
class ExternalFilter
{
private:
int Vlp;
int Vhp;
int w0lp_1_s7 = 0;
int w0hp_1_s17 = 0;
public:
int clock(int input);
ExternalFilter();
void setClockFrequency(double frequency);
void reset();
};
} // namespace reSIDfp
#if RESID_INLINING || defined(EXTERNALFILTER_CPP)
namespace reSIDfp
{
RESID_INLINE
int ExternalFilter::clock(int input)
{
const int Vi = input << 11;
const int dVlp = (w0lp_1_s7 * (Vi - Vlp) >> 7);
const int dVhp = (w0hp_1_s17 * (Vlp - Vhp) >> 17);
Vlp += dVlp;
Vhp += dVhp;
return (Vlp - Vhp) >> 11;
}
} // namespace reSIDfp
#endif
#endif
reSIDfp::ExternalFilter::clock
int clock(int input)
Definition ExternalFilter.h:113
reSIDfp::ExternalFilter::reset
void reset()
Definition ExternalFilter.cpp:59
reSIDfp::ExternalFilter::setClockFrequency
void setClockFrequency(double frequency)
Definition ExternalFilter.cpp:46
reSIDfp::ExternalFilter::ExternalFilter
ExternalFilter()
Definition ExternalFilter.cpp:41