From: bb3dan Date: Fri, 27 Sep 2013 17:09:47 +0000 (-0400) Subject: dpat fixes X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=32986078325e1348b0429cd58811fa1aa0ceb7c4;p=SugarCubes.git dpat fixes --- diff --git a/DanHorwitz.pde b/DanHorwitz.pde index 9610180..a8c0136 100755 --- a/DanHorwitz.pde +++ b/DanHorwitz.pde @@ -15,7 +15,7 @@ public class Pong extends DPat { addModulator(y = new SinLFO(cRad, mMax.y - cRad, 0)).trigger(); y.modulateDurationBy(dy); addModulator(z = new SinLFO(cRad, mMax.z - cRad, 0)).trigger(); z.modulateDurationBy(dz); pSize = addParam ("Size" , 0.4 ); - pChoose = addPick ("Animiation" , 0 , 3, new String[] {"Pong", "Ball", "Cone"} ); + pChoose = addPick ("Animiation" , 0, 2, new String[] {"Pong", "Ball", "Cone"} ); } void StartRun(double deltaMs) { cRad = mMax.x*pSize.Val()/6; } @@ -50,8 +50,7 @@ public class Noise extends DPat { int CurAnim, iSymm; int XSym=1,YSym=2,RadSym=3; - float zTime = random(10000), zTheta=0, zSin, zCos; - float rtime = 0, ttime = 0, transAdd=0; + float zTime , zTheta=0, zSin, zCos, rtime, ttime, transAdd; DParam pSpeed , pDensity, pRotZ; Pick pChoose, pSymm; int _ND = 4; @@ -61,11 +60,12 @@ public class Noise extends DPat super(glucose); pRotZ = addParam("RotZ" , .5 ); pSpeed = addParam("Fast", .55); pDensity= addParam("Dens" , .5); - pSymm = addPick("Symmetry" , 0, 4, new String[] {"None", "X", "Y", "Radial"} ); - pChoose = addPick("Animation", 1, 6, new String[] {"Drip", "Cloud", "Rain", "Fire", "Machine", "Spark"} ); + pSymm = addPick("Symmetry" , 0, 3, new String[] {"None", "X", "Y", "Radial"} ); + pChoose = addPick("Animation", 1, 5, new String[] {"Drip", "Cloud", "Rain", "Fire", "Machine", "Spark"} ); for (int i=0; i<_ND; i++) N[i] = new NDat(); } + void StartPattern() { zTime = random(500); zTheta=0; rtime = 0; ttime = 0; transAdd=0; } void StartRun(double deltaMs) { zTime += deltaMs*(pSpeed.Val()-.5)*.002 ; zTheta += deltaMs*(pRotZ .Val()-.5)*.01 ; @@ -150,10 +150,10 @@ public class Play extends DPat prvR = dstR; dstR = random(mCtr.y); } } int nBeats = 0; - DParam pAmp, pRad; + DParam pAmp, pRadius, pBounce; DParam pRotX, pRotY, pRotZ; - float t,amp; + float t,amp,rad,bnc; rAngle a1 = new rAngle(), a2 = new rAngle(), a3 = new rAngle(), a4 = new rAngle(); xyz cPrev = new xyz(), cRand = new xyz(), @@ -173,17 +173,25 @@ public class Play extends DPat pRotX = addParam("RotX", .5); pRotY = addParam("RotY", .5); pRotZ = addParam("RotZ", .5); - pAmp = addParam("Amp" , .2); - pRad = addParam("Rad" , .1 ); - pTempoMult = addPick ("TMult" , 0 , 6 , new String[] {"1x", "2x", "4x", "8x", "16x", "Rand" } ); - pTimePattern= addPick ("TPat" , 6 , 8 , new String[] {"Bounce", "Sin", "Roll", "Quant", "Accel", "Deccel", "Slide", "Rand"} ); pShape = addPick ("Shape" , 8 , 12 , new String[] {"Line", "Tap", "V", "RandV", "Pyramid", "Wings", "W2", "Clock", - "RSphere", "Sphere", "Cone", "Noise" } ); - pForm = addPick ("Form" , 0 , 3 , new String[] {"Bar", "Volume", "Fade"} ); + pRadius = addParam("Rad" , .1 ); + pBounce = addParam("Bnc" , .2 ); + pAmp = addParam("Amp" , .2 ); + pTempoMult = addPick ("TMult" , 0 , 5 , new String[] {"1x", "2x", "4x", "8x", "16x", "Rand" } ); + pTimePattern= addPick ("TPat" , 6 , 7 , new String[] {"Bounce", "Sin", "Roll", "Quant", "Accel", "Deccel", "Slide", "Rand"} ); pShape = addPick ("Shape" , 13, 15 , new String[] {"Line", "Tap", "V", "RandV", + "Pyramid", "Wings", "W2", "Clock", + "Triangle", "Quad", "Sphere", "Cone", + "Noise", "Wave", "?", "?"} ); + pForm = addPick ("Form" , 2 , 2 , new String[] {"Bar", "Volume", "Fade"} ); } + +float zTime = random(1000); void StartRun(double deltaMs) { + zTime += deltaMs*.001; zTime = zTime % 1000.; t = lx.tempo.rampf(); amp = pAmp.Val(); + rad = pRadius.getValuef(); + bnc = pBounce.getValuef(); Theta .set(pRotX.Val()*PI*2, pRotY.Val()*PI*2, pRotZ.Val()*PI*2); TSin .set(sin(Theta.x), sin(Theta.y), sin(Theta.z)); @@ -220,7 +228,6 @@ public class Play extends DPat case 6: t = .5*(1-cos(PI*t)); break; // slide } - cMid.set (cPrev); cMid.interpolate (t,cRand); cMidNorm.set (cMid); cMidNorm.setNorm(); @@ -235,46 +242,60 @@ public class Play extends DPat Pn.set(Px); Pn.setNorm(); float mp = min(Pn.x, Pn.z); - float yt = map(t,0,1,.5-amp/2,.5+amp/2); - float rad = pRad.getValuef(); + float yt = map(t,0,1,.5-bnc/2,.5+bnc/2); + float r; switch (pShape.Cur()) { case 0: V.set(Pn.x, yt , Pn.z); break; // bouncing line case 1: V.set(Pn.x, map(cos(PI*t * Pn.x),-1,1,0,1) , Pn.z); break; // top tap - case 2: V.set(Pn.x, amp*map(Pn.x<.5?Pn.x:1-Pn.x,0,.5 ,0,t-.5)+.5, Pn.z); break; // V shape + case 2: V.set(Pn.x, bnc*map(Pn.x<.5?Pn.x:1-Pn.x,0,.5 ,0,t-.5)+.5, Pn.z); break; // V shape case 3: V.set(Pn.x, Pn.x < cMidNorm.x ? map(Pn.x,0,cMidNorm.x, .5,yt) : map(Pn.x,cMidNorm.x,1, yt,.5), Pn.z); break; // Random V shape case 4: V.set(Pn.x, .5*(Pn.x < cMidNorm.x ? map(Pn.x,0,cMidNorm.x, .5,yt) : map(Pn.x,cMidNorm.x,1, yt,.5)) + .5*(Pn.z < cMidNorm.z ? map(Pn.z,0,cMidNorm.z, .5,yt) : - map(Pn.z,cMidNorm.z,1, yt,.5)), Pn.z); break; // Random Pyramid shape + map(Pn.z,cMidNorm.z,1, yt,.5)), Pn.z); break; // Random Pyramid shape - case 5: V.set(Pn.x, amp*map((Pn.x-.5)*(Pn.x-.5),0,.25,0,t-.5)+.5, Pn.z); break; // wings - case 6: V.set(Pn.x, amp*map((mp -.5)*(mp -.5),0,.25,0,t-.5)+.5, Pn.z); break; // wings + case 5: V.set(Pn.x, bnc*map((Pn.x-.5)*(Pn.x-.5),0,.25,0,t-.5)+.5, Pn.z); break; // wings + case 6: V.set(Pn.x, bnc*map((mp -.5)*(mp -.5),0,.25,0,t-.5)+.5, Pn.z); break; // wings + + case 7: return color(0,0, min( distToSeg(Px.x, Px.y, a1.getX(70),a1.getY(70), mCtr.x, mCtr.y), distToSeg(Px.x, Px.y, a2.getX(40),a2.getY(40), mCtr.x, mCtr.y)) .5?1:0)); // cone + case 11: return color(0,0,c1c(1 - CalcCone(Px,cMid,mCtr) * 0.02 > .5?1:0)); // cone - case 11: return color(100 + noise(Pn.x,Pn.y,Pn.z + (NoiseMove+50000)/1000.)*200, + case 12: return color(100 + noise(Pn.x,Pn.y,Pn.z + (NoiseMove+50000)/1000.)*200, 85,c1c(Pn.y < noise(Pn.x + NoiseMove/2000.,Pn.z)*(1+amp)-amp/2.-.1 ? 1 : 0)); // noise + case 13: V.set(Pn.x, map( + sin( zTime*3.7 + Pn.x*2.0*PI) + + sin( zTime*4.2 + Pn.x*1.7*PI) + + sin( -zTime*4.7 + Pn.x*2.1*PI) + + sin( -zTime*5.2 + Pn.x*1.5*PI) + ,-2,2,.2,.8), Pn.z); break; + + default: return color(0,0,0); } diff --git a/DanUtil.pde b/DanUtil.pde index 7b0c17d..f6b3a81 100644 --- a/DanUtil.pde +++ b/DanUtil.pde @@ -28,9 +28,9 @@ public class Pick { StartRow, EndRow ; String tag , Desc[] ; - Pick (String label, int _Def, int _Max, int nStart, String d[]) { - NumPicks = _Max; Default = _Def; - StartRow = nStart; EndRow = StartRow + int((NumPicks-1) / NumApcCols); + Pick (String label, int _Def, int _Num, int nStart, String d[]) { + NumPicks = _Num; Default = _Def; + StartRow = nStart; EndRow = StartRow + floor((NumPicks-1) / NumApcCols); tag = label; Desc = d; reset(); } @@ -115,7 +115,7 @@ public class DGlobals { DPat CurPat = null; float Sliders[] = new float [] {1,0,0,0,0,0,0,0}; - String SliderText[] = new String[] {"Level", "SpinHue", "Spark", "Wiggle", "Trails", "??", "??", "??"}; + String SliderText[] = new String[] {"Level", "SpinHue", "Spark", "Xwave", "Ywave", "Trails", "??", "??", "??"}; void SetNoteOn (int row, int col, int clr){ if (APCOut != null) APCOut.sendNoteOn (col, row, clr); } void SetNoteOff (int row, int col, int clr){ if (APCOut != null) APCOut.sendNoteOff (col, row, clr); } @@ -128,8 +128,9 @@ public class DGlobals { float _Dim () { return Sliders[0]; } float _SpinHue () { return Sliders[1]; } float _Spark () { return Sliders[2]; } - float _Wiggle () { return Sliders[3]; } - float _Trails () { return Sliders[4]; } + float _XWave () { return Sliders[3]; } + float _YWave () { return Sliders[4]; } + float _Trails () { return Sliders[5]; } void Init () { if (bInit) return; bInit=true; @@ -153,7 +154,7 @@ public class DGlobals { String Text1="", Text2=""; for (int i=0; i 0) { - float tRamp = (lx.tempo.rampf() % (1./pow(2,int((1-fQuant) * 4)))); + float tRamp = (lx.tempo.rampf() % (1./pow(2,floor((1-fQuant) * 4)))); float f = LastQuant; LastQuant = tRamp; if (tRamp > f) return; } @@ -273,12 +281,22 @@ public class DPat extends SCPattern LastJog = tRamp; } - for (Point p : model.points) { nPoint++; + // precalculate this stuff + float yWv = DG._YWave(), xWv = DG._XWave(), sprk = DG._Spark(); + if (yWv > 0) for (int i=0; i 0) for (int i=0; i 0) P.y += DG._Spark () * (noise(P.x,P.y+NoiseMove/30 ,P.z)*mMax.y - mMax.y/2.); - if (DG._Wiggle() > 0) P.y += DG._Wiggle() * (noise(P.x/(mMax.x*.3)-NoiseMove/1500.) - .5) * (mMax.y/2.); + if (sprk > 0) { P.y += sprk*randctr(50); P.x += sprk*randctr(50); P.z += sprk*randctr(50); } + if (yWv > 0) P.y += interpWv(p.x-modmin.x, yWaveNz); + if (xWv > 0) P.x += interpWv(p.y-modmin.y, xWaveNz); + if (pJog.b) P.add(xyzJog); + color cNew, cOld = colors[p.index]; { tP.set(P); cNew = CalcPoint(tP); } diff --git a/SugarCubes.pde b/SugarCubes.pde index 42817a6..656d7c4 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -108,16 +108,16 @@ LXPattern[] patterns(GLucose glucose) { LXTransition[] transitions(GLucose glucose) { return new LXTransition[] { new DissolveTransition(lx), + new AddTransition(glucose), new MultiplyTransition(glucose), - new ScreenTransition(glucose), - new BurnTransition(glucose), - new DodgeTransition(glucose), new OverlayTransition(glucose), - new AddTransition(glucose), - new SubtractTransition(glucose), - new SoftLightTransition(glucose), + new DodgeTransition(glucose), new SwipeTransition(glucose), new FadeTransition(lx), +// new SubtractTransition(glucose), // similar to multiply - dh +// new BurnTransition(glucose), // similar to multiply - dh +// new ScreenTransition(glucose), // same as add -dh +// new SoftLightTransition(glucose), // same as overlay -dh }; }