Make DanUtil have a spin() function so close-to-center knob doesn't spin
authorMark Slee <mcslee@Mark-Slees-MacBook-Pro.local>
Thu, 24 Oct 2013 16:51:16 +0000 (09:51 -0700)
committerMark Slee <mcslee@Mark-Slees-MacBook-Pro.local>
Thu, 24 Oct 2013 16:51:16 +0000 (09:51 -0700)
DanHorwitz.pde
DanUtil.pde

index 841a2ff9a0980faa7d5b9f588d77fe2e2d0f510e..6c958e1f04e41d47afbed30100b1919a564a1515 100644 (file)
@@ -71,7 +71,7 @@ public class Noise extends DPat
 
        void StartRun(double deltaMs) {
                zTime   += deltaMs*(val(pSpeed)-.5)*.002        ;
-               zTheta  += deltaMs*(val(pSpin )-.5)*.01 ;
+               zTheta  += deltaMs*(spin()-.5)*.01      ;
                rtime   += deltaMs;
                iSymm    = pSymm.Cur();
                zSin    = sin(zTheta);
@@ -467,6 +467,7 @@ class Worms extends SCPattern {
        }
 
        void onParameterChanged(LXParameter parameter) {
+               super.onParameterChanged(parameter);
                nConfusion = 1-pConfusion.getValuef();
                for (int i=0; i<numCursors; i++) {
                        if (parameter==pSpawn) reset(cur.get(i));
index d340ed1f54dd2cad2c11aa0a12f17bc5980fefb2..c7c8e706d82c49dc1aac97c34d5a6ae0dea245d4 100644 (file)
@@ -155,6 +155,16 @@ public class DPat extends SCPattern
                //println (model.xMax + " " + model.yMax + " " +  model.zMax);
          //for (MidiOutputDevice o: RWMidi.getOutputDevices()) { if (o.toString().contains("APC")) { APCOut = o.createOutput(); break;}}
        }
+
+       float spin() {
+         float raw = val(pSpin);
+         if (raw <= 0.45) {
+           return raw + 0.05;
+         } else if (raw >= 0.55) {
+           return raw - 0.05;
+    }
+    return 0.5;
+       }
        
        void setAPCOutput(MidiOutput output) {
          APCOut = output;