libsidplayfp  1.8.7
OpAmp.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2014 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 "Spline.h"
27 
28 namespace reSIDfp
29 {
30 
64 class OpAmp
65 {
66 private:
67  static const double EPSILON;
68 
70  double x;
71 
72  const double kVddt, vmin, vmax;
73 
74  Spline* opamp;
75 
76 public:
84  OpAmp(const Spline::Point opamp[], int opamplength, double kVddt) :
85  x(0.),
86  kVddt(kVddt),
87  vmin(opamp[0].x),
88  vmax(opamp[opamplength - 1].x),
89  opamp(new Spline(opamp, opamplength)) {}
90 
91  ~OpAmp() { delete opamp; }
92 
93  void reset()
94  {
95  x = vmin;
96  }
97 
105  double solve(double n, double vi);
106 };
107 
108 } // namespace reSIDfp
109 
110 #endif
Definition: Spline.h:34
Definition: Dac.cpp:25
Definition: Spline.h:37
OpAmp(const Spline::Point opamp[], int opamplength, double kVddt)
Definition: OpAmp.h:84
double solve(double n, double vi)
Definition: OpAmp.cpp:33
Definition: OpAmp.h:64