libsidplayfp 2.8.0
OpAmp.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
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#include <vector>
28
29#include "Spline.h"
30
31#include "sidcxx11.h"
32
33namespace reSIDfp
34{
35
71class OpAmp
72{
73private:
75 mutable double x;
76
77 const double Vddt;
78 const double vmin;
79 const double vmax;
80
81 std::unique_ptr<Spline> const opamp;
82
83public:
92 OpAmp(const std::vector<Spline::Point> &opamp, double Vddt,
93 double vmin, double vmax
94 ) :
95 x(0.),
96 Vddt(Vddt),
97 vmin(vmin),
98 vmax(vmax),
99 opamp(new Spline(opamp)) {}
100
104 void reset() const
105 {
106 x = vmin;
107 }
108
116 double solve(double n, double vi) const;
117};
118
119} // namespace reSIDfp
120
121#endif
Definition OpAmp.h:72
double solve(double n, double vi) const
Definition OpAmp.cpp:33
void reset() const
Definition OpAmp.h:104
OpAmp(const std::vector< Spline::Point > &opamp, double Vddt, double vmin, double vmax)
Definition OpAmp.h:92
Definition Spline.h:39