CLAM-Development  1.4.0
ControlScaler.cxx
Go to the documentation of this file.
1 #include "ControlScaler.hxx"
2 #include "ProcessingFactory.hxx"
3 
4 namespace CLAM
5 {
6 namespace Hidden
7 {
8  static const char * metadata[] = {
9  "key", "ControlScaler",
10  "category", "Controls",
11  "description", "ControlScaler",
12  0
13  };
14  static FactoryRegistrator<ProcessingFactory, ControlScaler> reg = metadata;
15 }
16 
17 void ControlScalerConfig::DefaultInit()
18 {
19  AddAll();
20  UpdateData();
21  SetAmount( 1.0 );
22 }
23 
25  : mInControl( "Control In", this , &ControlScaler::InControlCallback )
26  , mGainControl( "Gain Amount", this , &ControlScaler::InControlCallback )
27  , mOutControl( "Control Out", this )
28 {
29  Configure( mConfig );
30 }
31 
33  : mInControl( "Control In", this , &ControlScaler::InControlCallback )
34  , mGainControl( "Gain Amount", this , &ControlScaler::InControlCallback )
35  , mOutControl( "Control Out", this )
36 {
37  Configure( cfg );
38 }
39 
41 {
42  CopyAsConcreteConfig( mConfig, cfg );
43  mGainControl.DoControl(mConfig.GetAmount());
44  return true;
45 }
46 void ControlScaler::InControlCallback(const TControlData & value)
47 {
48  TControlData in = mInControl.GetLastValue();
49  TControlData gain = mGainControl.GetLastValue();
50  mOutControl.SendControl(in * gain);
51 }
53 {
54  return true;
55 }
56 }
57