RCKit
Linear.h
1 // Linear.h
2 //
3 // Setter class that implements linear transform of its input value
4 /// \author Mike McCauley (mikem@airspayce.com)
5 ///
6 // Copyright (C) 2010 Mike McCauley
7 // $Id: Linear.h,v 1.2 2018/09/17 23:09:57 mikem Exp mikem $
8 
9 #ifndef Linear_h
10 #define Linear_h
11 
12 #include "Setter.h"
13 
14 /////////////////////////////////////////////////////////////////////
15 /// \class Linear Linear.h <Linear.h>
16 /// \brief Setter class that implements linear transform of its input value
17 ///
18 /// Linear implements a y = mx + x linear transform of the input value.
19 /// The resulting output value is sent to the next Setter (the target) in the chain.
20 ///
21 class Linear : public Setter
22 {
23 public:
24  /// Constructor.
25  /// Output will be calculated according to out = (in * gain) + offset
26  Linear(float gain, int offset);
27 
28  /// Input the value to be transformed
29  /// \param[in] value The input value
30  virtual void input(int value);
31 
32 protected:
33 
34 private:
35 
36  /// Offset added to the output value
37  int _offset;
38 
39  /// Gain multiplied by the input value
40  float _gain;
41 };
42 
43 #endif
Setter::input
virtual void input(int value)
This is where incoming values are set.
Definition: Setter.cpp:26
Linear::Linear
Linear(float gain, int offset)
Definition: Linear.cpp:12
Linear::input
virtual void input(int value)
Definition: Linear.cpp:20
Linear
Setter class that implements linear transform of its input value.
Definition: Linear.h:21
Setter
Virtual base class for classes that receive a value, maybe transform it and then do something with it...
Definition: Setter.h:25