From: bb3dan Date: Sat, 19 Oct 2013 21:20:35 +0000 (-0700) Subject: updated dpat X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=596f331f49e47b2164af07e7c5a113f44e5d2a26;p=SugarCubes.git updated dpat --- diff --git a/DanHorwitz.pde b/DanHorwitz.pde index acf8594..741ff46 100644 --- a/DanHorwitz.pde +++ b/DanHorwitz.pde @@ -51,7 +51,7 @@ public class Noise extends DPat { int CurAnim, iSymm; int XSym=1,YSym=2,RadSym=3; - float zTime , zTheta=0, zSin, zCos, rtime, ttime, transAdd; + float zTime , zTheta=0, zSin, zCos, rtime, ttime; DParam pSpeed , pDensity, pSharp; Pick pChoose, pSymm; int _ND = 4; @@ -67,14 +67,13 @@ public class Noise extends DPat for (int i=0; i<_ND; i++) N[i] = new NDat(); } - void onActive() { zTime = random(500); zTheta=0; rtime = 0; ttime = 0; transAdd=0; } + void onActive() { zTime = random(500); zTheta=0; rtime = 0; ttime = 0; } void StartRun(double deltaMs) { zTime += deltaMs*(pSpeed.Val()-.5)*.002 ; zTheta += deltaMs*(pSpin .Val()-.5)*.01 ; rtime += deltaMs; iSymm = pSymm.Cur(); - transAdd = 1*(1 - constrain(rtime - ttime,0,1000)/1000); zSin = sin(zTheta); zCos = cos(zTheta); @@ -110,7 +109,7 @@ public class Noise extends DPat color CalcPoint(xyz P) { color c = 0; - P.RotateZ(mCtr, zSin, zCos); + P.rotateZ(mCtr, zSin, zCos); if (CurAnim == 6 || CurAnim == 7) { P.setNorm(); @@ -128,12 +127,11 @@ public class Noise extends DPat float zx = zTime * n.speed * n.sinAngle, zy = zTime * n.speed * n.cosAngle; - float b = (iSymm==RadSym ? noise(zTime*n.speed+n.xoff-Dist(P,mCtr)/n.xz) + float b = (iSymm==RadSym ? noise(zTime*n.speed+n.xoff-P.distance(mCtr)/n.xz) : noise(P.x/n.xz+zx+n.xoff,P.y/n.yz+zy+n.yoff,P.z/n.zz+n.zoff)) *1.8; b += n.den/100 -.4 + pDensity.Val() -1; - b += transAdd; c = blendColor(c,lx.hsb(lxh()+n.hue,100,c1c(b)),ADD); } return c; @@ -285,9 +283,9 @@ public class Play extends DPat } color CalcPoint(xyz Px) { - if (Theta.x != 0) Px.RotateX(mCtr, TSin.x, TCos.x); - if (Theta.y != 0) Px.RotateY(mCtr, TSin.y, TCos.y); - if (Theta.z != 0) Px.RotateZ(mCtr, TSin.z, TCos.z); + if (Theta.x != 0) Px.rotateX(mCtr, TSin.x, TCos.x); + if (Theta.y != 0) Px.rotateY(mCtr, TSin.y, TCos.y); + if (Theta.z != 0) Px.rotateZ(mCtr, TSin.z, TCos.z); Pn.set(Px); Pn.setNorm(); diff --git a/DanUtil.pde b/DanUtil.pde index 85f49fd..4861f47 100644 --- a/DanUtil.pde +++ b/DanUtil.pde @@ -1,6 +1,6 @@ //---------------------------------------------------------------------------------------------------------------------------------- xyz mMax, mCtr, mHalf; -int NumApcRows = 5, NumApcCols = 8; +int NumApcRows=4, NumApcCols=8; boolean btwn (int a,int b,int c) { return a >= b && a <= c; } boolean btwn (double a,double b,double c) { return a >= b && a <= c; } @@ -23,10 +23,11 @@ float distToSeg(float x, float y, float x1, float y1, float x2, float y2) { public class Pick { - int NumPicks, Default , CurRow , CurCol , + int NumPicks, Default , + CurRow , CurCol , StartRow, EndRow ; String tag , Desc[] ; - + Pick (String label, int _Def, int _Num, int nStart, String d[]) { NumPicks = _Num; Default = _Def; StartRow = nStart; EndRow = StartRow + floor((NumPicks-1) / NumApcCols); @@ -84,19 +85,19 @@ public class xyz { float x,y,z; // extends pVector; eliminate half of the functi void subtract(xyz b) {x -= b.x; y -= b.y; z -= b.z; } void scale (float b) {x *= b ; y *= b ; z *= b ; } - void RotateZ (xyz o, float nSin, float nCos) { + void rotateZ (xyz o, float nSin, float nCos) { float nX = nCos*(x-o.x) - nSin*(y-o.y) + o.x; float nY = nSin*(x-o.x) + nCos*(y-o.y) + o.y; x = nX; y = nY; } - void RotateX (xyz o, float nSin, float nCos) { + void rotateX (xyz o, float nSin, float nCos) { float nY = nCos*(y-o.y) - nSin*(z-o.z) + o.y; float nZ = nSin*(y-o.y) + nCos*(z-o.z) + o.z; y = nY; z = nZ; } - void RotateY (xyz o, float nSin, float nCos) { + void rotateY (xyz o, float nSin, float nCos) { float nZ = nCos*(z-o.z) - nSin*(x-o.x) + o.z; float nX = nSin*(z-o.z) + nCos*(x-o.x) + o.x; z = nZ; x = nX; @@ -109,55 +110,11 @@ public class xyz { float x,y,z; // extends pVector; eliminate half of the functi //---------------------------------------------------------------------------------------------------------------------------------- public class DPat extends SCPattern { - MidiOutput APCOut = null; - - boolean noteOff(Note note) { if (!isFocused()) return false; - int row = note.getPitch(), col = note.getChannel(); - for (int i=0; i picks = new ArrayList (); ArrayList bools = new ArrayList (); ArrayList params = new ArrayList(); + MidiOutput APCOut; int nMaxRow = 53; float LastQuant = -1, LastJog = -1; float[] xWaveNz, yWaveNz; @@ -167,10 +124,9 @@ public class DPat extends SCPattern float NoiseMove = random(10000); DParam pSpark, pWave, pRotX, pRotY, pRotZ, pSpin, pTransX, pTransY; - DBool pXsym, pYsym, pRsym, pXdup, pXtrip, pJog, pGrey; + float lxh () { return lx.getBaseHuef(); } - float Dist (xyz a, xyz b) { return dist(a.x,a.y,a.z,b.x,b.y,b.z); } int c1c (float a) { return round(100*constrain(a,0,1)); } float interpWv(float i, float[] vals) { return interp(i-floor(i), vals[floor(i)], vals[ceil(i)]); } @@ -187,13 +143,35 @@ public class DPat extends SCPattern params.add(P); return P; } - Pick addPick(String name, int def, int _max, String[] desc) { + Pick addPick(String name, int def, int _max, String[] desc) { Pick P = new Pick(name, def, _max+1, nMaxRow, desc); nMaxRow = P.EndRow + 1; picks.add(P); return P; } + boolean noteOff(Note note) { + int row = note.getPitch(), col = note.getChannel(); + for (int i=0; i 100) return; + + if (this == midiEngine.getFocusedDeck().getActivePattern()) { + String Text1="", Text2=""; + for (int i=0; i