Hi all,

The following patch updates the ControlScaler processing component with a 
variable gain control input.  If left unconnected, the new input takes the 
configured or default amount, so existing networks that use this component 
will continue to function normally.

Cheers,

Zach
Index: CLAM/src/Processing/Controls/ControlScaler.cxx
===================================================================
--- CLAM/src/Processing/Controls/ControlScaler.cxx	(revision 9948)
+++ CLAM/src/Processing/Controls/ControlScaler.cxx	(working copy)
@@ -19,6 +19,7 @@
 
 	ControlScaler::ControlScaler()
 		: mInControl( "Control In", this ),
+		mGainControl( "Gain Amount", this ),
 		mOutControl( "Control Out", this )
 	{
 		Configure( mConfig );	
@@ -26,6 +27,7 @@
 
 	ControlScaler::ControlScaler( const ControlScalerConfig& cfg ) 
 	:	mInControl( "Control In", this ),
+		mGainControl( "Gain Amount", this ),
 		mOutControl( "Control Out", this )
 	{ 
 		Configure( cfg );
@@ -33,13 +35,15 @@
 
 	bool ControlScaler::ConcreteConfigure( const ProcessingConfig& cfg )
 	{
-			CopyAsConcreteConfig( mConfig, cfg );
-			return true; 		
+		CopyAsConcreteConfig( mConfig, cfg );
+		mGainControl.DoControl(mConfig.GetAmount());
+		return true; 		
 	}
 
 	bool ControlScaler::Do()
 	{
-		return mOutControl.SendControl( mInControl.GetLastValue() * mConfig.GetAmount() );		
+		float in = mInControl.GetLastValue();
+		float gain = mGainControl.GetLastValue();
+		return mOutControl.SendControl(in * gain);
 	}
-	
 }
Index: CLAM/src/Processing/Controls/ControlScaler.hxx
===================================================================
--- CLAM/src/Processing/Controls/ControlScaler.hxx	(revision 9948)
+++ CLAM/src/Processing/Controls/ControlScaler.hxx	(working copy)
@@ -45,6 +45,7 @@
 {
 	ControlScalerConfig mConfig;
 	InControl mInControl;
+	InControl mGainControl;
 	OutControl mOutControl;
 
 	public:
_______________________________________________
Clam-devel mailing list
Clam-devel@llistes.projectes.lafarga.org
https://llistes.projectes.lafarga.org/cgi-bin/mailman/listinfo/clam-devel

Reply via email to