Basic knob driving
[SugarCubes.git] / MarkSlee.pde
index 7b1b86bae1af50c5ec8409f89a9506e4bd6493ff..f955f97bd32474d7997ae50da122b729c73fa607 100644 (file)
@@ -365,6 +365,11 @@ class CrossSections extends SCPattern {
     addModulator(x).trigger();
     addModulator(y).trigger();
     addModulator(z).trigger();
+    addParams();
+  }
+  
+  public void addParams()
+  {
     addParameter(xr);
     addParameter(yr);
     addParameter(zr);    
@@ -375,8 +380,8 @@ class CrossSections extends SCPattern {
     addParameter(yw);    
     addParameter(zw);
   }
-  
-  void onParameterChanged(LXParameter p) {
+
+  public void onParameterChanged(LXParameter p) {
     if (p == xr) {
       x.setDuration(10000 - 8800*p.getValuef());
     } else if (p == yr) {
@@ -386,10 +391,19 @@ class CrossSections extends SCPattern {
     }
   }
 
+  float xv;
+  float yv;
+  float zv;  
+
+  public void updateXYZVals()
+  {
+    xv = x.getValuef();
+    yv = y.getValuef();
+    zv = z.getValuef(); 
+  }
+
   public void run(int deltaMs) {
-    float xv = x.getValuef();
-    float yv = y.getValuef();
-    float zv = z.getValuef();    
+    updateXYZVals();   
     float xlv = 100*xl.getValuef();
     float ylv = 100*yl.getValuef();
     float zlv = 100*zl.getValuef();