libsidplayfp
2.12.0
Main Page
Related Pages
Classes
Files
Examples
File List
src
builders
residfp-builder
residfp
Integrator8580.h
1
/*
2
* This file is part of libsidplayfp, a SID player engine.
3
*
4
* Copyright 2011-2023 Leandro Nini <drfiemost@users.sourceforge.net>
5
* Copyright 2007-2010 Antti Lankila
6
* Copyright 2004, 2010 Dag Lem <resid@nimrod.no>
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
*/
22
23
#ifndef INTEGRATOR8580_H
24
#define INTEGRATOR8580_H
25
26
#include "Integrator.h"
27
#include "FilterModelConfig8580.h"
28
29
#include <stdint.h>
30
#include <cassert>
31
32
#include "siddefs-fp.h"
33
34
namespace
reSIDfp
35
{
36
55
class
Integrator8580 :
public
Integrator
56
{
57
private
:
58
unsigned
short
nVgt;
59
unsigned
short
n_dac;
60
61
FilterModelConfig8580
& fmc;
62
63
public
:
64
Integrator8580(
FilterModelConfig8580
& fmc) :
65
fmc(fmc)
66
{
67
setV
(1.5);
68
}
69
73
void
setFc
(
double
wl)
74
{
75
// Normalized current factor, 1 cycle at 1MHz.
76
// Fit in 5 bits.
77
n_dac = fmc.getNormalizedCurrentFactor(wl);
78
}
79
83
void
setV
(
double
v)
84
{
85
// Gate voltage is controlled by the switched capacitor voltage divider
86
// Ua = Ue * v = 4.75v 1<v<2
87
assert(v > 1.0 && v < 2.0);
88
const
double
Vg = fmc.getVref() * v;
89
const
double
Vgt = Vg - fmc.getVth();
90
91
// Vg - Vth, normalized so that translated values can be subtracted:
92
// Vgt - x = (Vgt - t) - (x - t)
93
nVgt = fmc.getNormalizedValue(Vgt);
94
}
95
96
int
solve(
int
vi)
const override
;
97
};
98
99
}
// namespace reSIDfp
100
101
#endif
reSIDfp::FilterModelConfig8580
Definition
FilterModelConfig8580.h:41
reSIDfp::Integrator8580::setFc
void setFc(double wl)
Definition
Integrator8580.h:73
reSIDfp::Integrator8580::setV
void setV(double v)
Definition
Integrator8580.h:83
Generated on
for libsidplayfp by
1.14.0