X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=DanUtil.pde;h=4ce685ad68f0d63e56d08e1a366378f80700e63f;hb=b30f14fdacdcccafe123e00f20a4d6df46e6995c;hp=9ae6f1994e01cfdc4298ad8c2ca8b0d872d77ff9;hpb=d5ce8c1c3c9b6146a5e5b10e90beec7a4539584a;p=SugarCubes.git diff --git a/DanUtil.pde b/DanUtil.pde index 9ae6f19..4ce685a 100644 --- a/DanUtil.pde +++ b/DanUtil.pde @@ -113,10 +113,12 @@ public class DGlobals { MidiOutput APCOut = null; MidiInput APCIn = null, OxygenIn = null; DPat CurPat = null; + int KeyPressed = -1; + boolean bSustain = false; float Sliders[] = new float [] {1,0,0,0,0,0,0,0}; - String SliderText[] = new String[] {"Level", "SpinHue", "Spark", "Xwave", "Ywave", "Trails", "??", "??", "??"}; + String SliderText[] = new String[] {"Level", "SpinHue", "Spark", "Xwave", "Ywave", "Trails", "Quant", "??", "??"}; 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); } @@ -126,12 +128,13 @@ public class DGlobals { Pick GetPick (int i) { return (Pick) CurPat.picks .get(i); } DParam GetParam(int i) { return (DParam) CurPat.params.get(i); } - float _Dim () { return Sliders[0]; } + float _Level () { return Sliders[0]; } float _SpinHue () { return Sliders[1]; } float _Spark () { return Sliders[2]; } float _XWave () { return Sliders[3]; } float _YWave () { return Sliders[4]; } float _Trails () { return Sliders[5]; } + float _Quantize () { return Sliders[6]; } void Init () { if (bInit) return; bInit=true; @@ -142,6 +145,7 @@ public class DGlobals { boolean isFocused () { return CurPat != null && CurPat == midiEngine.getFocusedDeck().getActivePattern(); } void Deactivate (DPat p) { if (p != CurPat) return; uiDebugText.setText(""); CurPat = null; } void Activate (DPat p) { + bSustain = false; CurPat = p; while (lx.tempo.bpm() > 40) lx.tempo.setBpm(lx.tempo.bpm()/2); for (int i=0; i 0) { float tRamp = (lx.tempo.rampf() % (1./pow(2,floor((1-fQuant) * 4)))); float f = LastQuant; LastQuant = tRamp; if (tRamp > f) return; @@ -293,6 +316,7 @@ public class DPat extends SCPattern for (Point p : model.points) { nPoint++; P.set(p); P.subtract(modmin); + P.subtract(pTrans); 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); @@ -306,14 +330,18 @@ public class DPat extends SCPattern if (pRsym.b) { tP.set(mMax.x-P.x,mMax.y-P.y,mMax.z-P.z); cNew = blendColor(cNew, CalcPoint(tP), ADD); } if (pXdup.b) { tP.set((P.x+mMax.x*.5)%mMax.x,P.y,P.z); cNew = blendColor(cNew, CalcPoint(tP), ADD); } + float s = saturation(cNew) + 100*(fSaturate*2-1); float b = brightness(cNew)/100.; if (pSharp.Val()>0) b = b < .5 ? pow(b,fSharp) : 1-pow(1-b,fSharp); if (DG._Trails()>0 && fQuant == 0) b = max(b, (float) (brightness(cOld)/100. - (1-DG._Trails()) * deltaMs/200.)); + if (DG.bSustain == true) b = max(b, (float) (brightness(cOld)/100.)); + + if (pInvert.b) { b = 1-b; s = 1-s; } colors[p.index] = color( (hue(cNew) + zSpinHue) % 360, - saturation(cNew) + 100*(fSaturate*2-1), - 100 * b * DG._Dim() + s, + 100 * b * DG._Level() ); // colors[p.index] = color(0,0, p.fx >= modmin.x && p.fy >= modmin.y && p.fz >= modmin.z &&