libsidplayfp 2.3.1
OpAmp.h
1/*
2 * This file is part of libsidplayfp, a SID player engine.
3 *
4 * Copyright 2011-2015 Leandro Nini <drfiemost@users.sourceforge.net>
5 * Copyright 2007-2010 Antti Lankila
6 * Copyright 2004,2010 Dag Lem
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 OPAMP_H
24#define OPAMP_H
25
26#include <memory>
27
28#include "Spline.h"
29
30#include "sidcxx11.h"
31
32namespace reSIDfp
33{
34
68class OpAmp
69{
70private:
72 mutable double x;
73
74 const double Vddt;
75 const double vmin;
76 const double vmax;
77
78 std::unique_ptr<Spline> const opamp;
79
80public:
88 OpAmp(const Spline::Point opamp[], int opamplength, double Vddt) :
89 x(0.),
90 Vddt(Vddt),
91 vmin(opamp[0].x),
92 vmax(opamp[opamplength - 1].x),
93 opamp(new Spline(opamp, opamplength)) {}
94
95 void reset() const
96 {
97 x = vmin;
98 }
99
107 double solve(double n, double vi) const;
108};
109
110} // namespace reSIDfp
111
112#endif
Definition: OpAmp.h:69
double solve(double n, double vi) const
Definition: OpAmp.cpp:33
OpAmp(const Spline::Point opamp[], int opamplength, double Vddt)
Definition: OpAmp.h:88
Definition: Spline.h:39
Definition: Spline.h:42