libsidplayfp  2.4.0
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 #include <vector>
28 
29 #include "Spline.h"
30 
31 #include "sidcxx11.h"
32 
33 namespace reSIDfp
34 {
35 
69 class OpAmp
70 {
71 private:
73  mutable double x;
74 
75  const double Vddt;
76  const double vmin;
77  const double vmax;
78 
79  std::unique_ptr<Spline> const opamp;
80 
81 public:
89  OpAmp(const std::vector<Spline::Point> &opamp, double Vddt) :
90  x(0.),
91  Vddt(Vddt),
92  vmin(opamp.front().x),
93  vmax(opamp.back().x),
94  opamp(new Spline(opamp)) {}
95 
96  void reset() const
97  {
98  x = vmin;
99  }
100 
108  double solve(double n, double vi) const;
109 };
110 
111 } // namespace reSIDfp
112 
113 #endif
Definition: OpAmp.h:70
OpAmp(const std::vector< Spline::Point > &opamp, double Vddt)
Definition: OpAmp.h:89
double solve(double n, double vi) const
Definition: OpAmp.cpp:33
Definition: Spline.h:39