redo with new anti-GLucose
[SugarCubes.git] / DanHorwitz.pde
index 01904013009f04332910bbd9f9081c6f10e92ca0..cdec36b6b1d160b44e8e3aeeda1a1d1c62a76621 100644 (file)
@@ -5,8 +5,8 @@ public class Pong extends DPat {
        Pick    pChoose;
        PVector v = new PVector(), vMir =  new PVector();
 
-       Pong(GLucose glucose) {
-               super(glucose);
+       Pong(LX lx) {
+               super(lx);
                cRad = mMax.x/10;
                addModulator(dx = new SinLFO(6000,  500, 30000  )).trigger();
                addModulator(dy = new SinLFO(3000,  500, 22472  )).trigger();
@@ -57,8 +57,8 @@ public class Noise extends DPat
        int                             _ND = 4;
        NDat                    N[] = new NDat[_ND];
 
-       Noise(GLucose glucose) {
-               super(glucose);
+       Noise(LX lx) {
+               super(lx);
                pSpeed          = addParam("Fast"       , .55);
                pDensity        = addParam("Dens"        , .5);
                pSharp          = addParam("Shrp"        ,  0);
@@ -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);
@@ -157,13 +157,14 @@ public class Play extends DPat
                                                                        prvR    = dstR;         dstR    = random(mCtr.y);                                                                       }
        }
 
-       int             nBeats  =       0;
        BasicParameter  pAmp, pRadius, pBounce;
+       Pick                    pTimePattern, pTempoMult, pShape;
 
-       float   t,amp,rad,bnc;
-       float   zTheta=0;
        ArrayList<rWave> waves = new ArrayList<rWave>(10);
 
+       int             nBeats  =       0;
+       float   t,amp,rad,bnc,zTheta=0;
+
        rAngle  a1              = new rAngle(), a2                      = new rAngle(),
                        a3              = new rAngle(), a4                      = new rAngle();
        PVector cPrev   = new PVector(), cRand          = new PVector(),
@@ -173,10 +174,9 @@ public class Play extends DPat
                        Pn              = new PVector();
        float   LastBeat=3, LastMeasure=3;
        int             curRandTempo = 1, curRandTPat = 1;
-       Pick    pTimePattern, pTempoMult, pShape;
 
-       Play(GLucose glucose) {
-               super(glucose);
+       Play(LX lx) {
+               super(lx);
            pRadius             = addParam("Rad"        , .1    );
                pBounce         = addParam("Bnc"        , .2    );
            pAmp                = addParam("Amp"        , .2    );
@@ -206,6 +206,7 @@ public class Play extends DPat
                }
        }
 
+       void onReset()  { zTheta=0; super.onReset(); }
        void onActive() { 
                zTheta=0; 
                while (lx.tempo.bpm() > 40) lx.tempo.setBpm(lx.tempo.bpm()/2);
@@ -354,15 +355,7 @@ public class Play extends DPat
        }
 }
 //----------------------------------------------------------------------------------------------------------------------------------
-// 0 - TLB, L (b), BLB, B (l)          // Fwd , Down, Back, Up
-// 4 - TLF, F (l), BLF, L (f)          // Fwd , Down, Back, Up
-// 8 - TRF, R (f), BRF, F (r)          // Back, Down, Fwd , Up
-// 12- TRB, B (r), BRB, R (b)          // Back, Down, Fwd , Up
-// 1->7, 15->9
-
-int randDir() { return round(random(1))*2-1; }
-//----------------------------------------------------------------------------------------------------------------------------------
-boolean dDebug = true;
+boolean dDebug = false;
 class dCursor {
        dVertex vCur, vNext, vDest;
        float   destSpeed;
@@ -410,7 +403,7 @@ class dCursor {
                evalTurn(vCur.t2);                      evalTurn(vCur.t3);
        }
 
-       Point   p1, p2; int i2;
+       LXPoint         p1, p2; int i2;
 
        int draw(int nAmount, SCPattern pat) {
                int nFrom       = (pos    ) >> 12;
@@ -459,21 +452,22 @@ class Worms extends SCPattern {
                                                                new PVector(randX(), random(2)<1 ? model.yMin:model.yMax, zMidLat)      ;
        }
 
-       Worms(GLucose glucose) {
-               super(glucose); 
+       Worms(LX lx) {
+               super(lx); 
            addModulator(moveChase).start();
            addParameter(pBeat);    addParameter(pSpeed);
            addParameter(pBlur);    addParameter(pWorms);
            addParameter(pEQ);      addParameter(pConfusion);
                addParameter(pSpawn);   addParameter(pColor);
 
-           middle = new PVector(model.cx, model.cy, 71);
+           middle = new PVector(1.5*model.cx, 1.5*model.cy, 71);
                if (lattice == null) lattice = new dLattice();
                for (int i=0; i<numCursors; i++) { dCursor c = new dCursor(); reset(c); cur.add(c); }
                onParameterChanged(pEQ); setNewDest();
        }
 
        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));