20 #ifndef RESID_EXTFILT_H
21 #define RESID_EXTFILT_H
23 #include "resid-config.h"
46 void enable_filter(
bool enable);
49 void clock(cycle_count delta_t,
short Vi);
77 #if RESID_INLINING || defined(RESID_EXTFILT_CC)
83 void ExternalFilter::clock(
short Vi)
86 if (unlikely(!enabled)) {
98 int dVlp = w0lp_1_s7*int((
unsigned(Vi) << 11) -
unsigned(Vlp)) >> 7;
99 int dVhp = w0hp_1_s17*(Vlp - Vhp) >> 17;
108 void ExternalFilter::clock(cycle_count delta_t,
short Vi)
111 if (unlikely(!enabled)) {
120 cycle_count delta_t_flt = 8;
123 if (unlikely(delta_t < delta_t_flt)) {
124 delta_t_flt = delta_t;
132 int dVlp = (w0lp_1_s7*delta_t_flt >> 3)*((Vi << 11) - Vlp) >> 4;
133 int dVhp = (w0hp_1_s17*delta_t_flt >> 3)*(Vlp - Vhp) >> 14;
137 delta_t -= delta_t_flt;
146 short ExternalFilter::output()
149 const int half = 1 << 15;
150 int Vo = (Vlp - Vhp) >> 11;
154 else if (Vo < -half) {
160 #endif // RESID_INLINING || defined(RESID_EXTFILT_CC)
164 #endif // not RESID_EXTFILT_H