00001 #include "ControlScaler.hxx" 00002 #include "ProcessingFactory.hxx" 00003 00004 namespace CLAM 00005 { 00006 namespace Hidden 00007 { 00008 static const char * metadata[] = { 00009 "key", "ControlScaler", 00010 "category", "Controls", 00011 "description", "ControlScaler", 00012 0 00013 }; 00014 static FactoryRegistrator<ProcessingFactory, ControlScaler> reg = metadata; 00015 } 00016 00017 void ControlScalerConfig::DefaultInit() 00018 { 00019 AddAll(); 00020 UpdateData(); 00021 SetAmount( 1.0 ); 00022 } 00023 00024 ControlScaler::ControlScaler() 00025 : mInControl( "Control In", this ) 00026 , mGainControl( "Gain Amount", this ) 00027 , mOutControl( "Control Out", this ) 00028 { 00029 Configure( mConfig ); 00030 } 00031 00032 ControlScaler::ControlScaler( const ControlScalerConfig& cfg ) 00033 : mInControl( "Control In", this ) 00034 , mGainControl( "Gain Amount", this ) 00035 , mOutControl( "Control Out", this ) 00036 { 00037 Configure( cfg ); 00038 } 00039 00040 bool ControlScaler::ConcreteConfigure( const ProcessingConfig& cfg ) 00041 { 00042 CopyAsConcreteConfig( mConfig, cfg ); 00043 mGainControl.DoControl(mConfig.GetAmount()); 00044 return true; 00045 } 00046 00047 bool ControlScaler::Do() 00048 { 00049 TControlData in = mInControl.GetLastValue(); 00050 TControlData gain = mGainControl.GetLastValue(); 00051 return mOutControl.SendControl(in * gain); 00052 } 00053 } 00054