libsidplayfp  2.12.0
OpAmp.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2024 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 <vector>
27 
28 #include "Spline.h"
29 
30 #include "sidcxx11.h"
31 
32 namespace reSIDfp
33 {
34 
70 class OpAmp
71 {
72 private:
74  mutable double x = 0.;
75 
76  const double Vddt;
77  const double vmin;
78  const double vmax;
79 
80  Spline opamp;
81 
82 public:
91  OpAmp(const std::vector<Spline::Point> &opamp_voltages, double Vddt,
92  double vmin, double vmax
93  ) :
94  Vddt(Vddt),
95  vmin(vmin),
96  vmax(vmax),
97  opamp(opamp_voltages) {}
98 
102  void reset() const
103  {
104  x = vmin;
105  }
106 
114  double solve(double n, double vi) const;
115 };
116 
117 } // namespace reSIDfp
118 
119 #endif
Definition: OpAmp.h:71
double solve(double n, double vi) const
Definition: OpAmp.cpp:33
void reset() const
Definition: OpAmp.h:102
OpAmp(const std::vector< Spline::Point > &opamp_voltages, double Vddt, double vmin, double vmax)
Definition: OpAmp.h:91
Definition: Spline.h:39