//public grid
final Sphery[] spherys;
- SineSphere(GLucose glucose)
+ SineSphere(LX lx)
{
- super(glucose);
+ super(lx);
println("modelrad " + modelrad);
sinespin = new LXProjection(model);
sinespin2 = new LXProjection(model);
private SinLFO bg = new SinLFO(180, 220, 3000);
-CubeCurl(GLucose glucose){
-super(glucose);
+CubeCurl(LX lx){
+super(lx);
addModulator(curl).trigger();
addModulator(bg).trigger();
this.CH = Cube.EDGE_HEIGHT;
BasicParameter SatT = new BasicParameter("Sat", .5);
BasicParameter BriT = new BasicParameter("Bright", .5);
-HueTestHSB(GLucose glucose) {
- super(glucose);
+HueTestHSB(LX lx) {
+ super(lx);
addParameter(HueT);
addParameter(SatT);
addParameter(BriT);
return true;
}
- public AKPong(GLucose glucose)
+ public AKPong(LX lx)
{
- super(glucose);
+ super(lx);
addParameter(speed);
addParameter(leftKnob);
addParameter(rightKnob);
class AKInvader extends SCPattern
{
private final SawLFO h = new SawLFO(0, 1, 5000);
- public AKInvader(GLucose glucose)
+ public AKInvader(LX lx)
{
- super(glucose);
+ super(lx);
addModulator(h).trigger();
}
}
}
- public AKTetris(GLucose glucose)
+ public AKTetris(LX lx)
{
- super(glucose);
+ super(lx);
}
public boolean noteOn(Note note)
}
}
- public AKMatrix(GLucose glucose)
+ public AKMatrix(LX lx)
{
- super(glucose);
+ super(lx);
// for (Tower t : model.towers)
{
Tower t = model.towers.get(0);
private final float Y = model.yMax / 2;
private final float Z = model.zMax / 2;
- public AKEgg(GLucose glucose)
+ public AKEgg(LX lx)
{
- super(glucose);
+ super(lx);
addModulator(xRadius).trigger();
addModulator(yRadius).trigger();
addModulator(zRadius).trigger();
private Cube cube;
private int sec;
- public AKCubes(GLucose glucose)
+ public AKCubes(LX lx)
{
- super(glucose);
+ super(lx);
cube = model.cubes.get((int) random(model.cubes.size()));
sec = 0;
}
class AKSpiral extends SCPattern
{
private int ms;
- public AKSpiral(GLucose glucose)
+ public AKSpiral(LX lx)
{
- super(glucose);
+ super(lx);
ms = 0;
}
}
}
- public AKSpace(GLucose glucose)
+ public AKSpace(LX lx)
{
- super(glucose);
+ super(lx);
stars = new LinkedList<Star>();
for (int i = 0; i < 50; ++i)
stars.add(new Star());
BasicParameter hueParameter = new BasicParameter("HUE", 1.0);
SinLFO direction = new SinLFO(0, 10, 3000);
- public TelevisionStatic(GLucose glucose) {
- super(glucose);
+ public TelevisionStatic(LX lx) {
+ super(lx);
addModulator(direction).trigger();
addParameter(brightParameter);
addParameter(saturationParameter);
SinLFO colorMod = new SinLFO(0, 360, 5000);
SinLFO brightMod = new SinLFO(0, model.zMax, 2000);
- public AbstractPainting(GLucose glucose) {
- super(glucose);
+ public AbstractPainting(LX lx) {
+ super(lx);
addModulator(colorMod).trigger();
addModulator(brightMod).trigger();
float rad = 0;
int direction = 1;
- Spirality(GLucose glucose) {
- super(glucose);
+ Spirality(LX lx) {
+ super(lx);
addParameter(r);
for (LXPoint p : model.points) {
colors[p.index] = lx.hsb(0, 0, 0);
float ym2 = model.yMin+cubeWidth;
float zm2 = model.zMin+cubeWidth;
- XYZPixel(GLucose glucose) {
- super(glucose);
+ XYZPixel(LX lx) {
+ super(lx);
//myP = new LXPoint(20,20,20);
}
float minIS;
- MultipleCubes(GLucose glucose) {
- super(glucose);
+ MultipleCubes(LX lx) {
+ super(lx);
minIS = 200;
}
ArrayList<BasicParameter> towerParams;
int towerSize;
int colorSpan;
- TowerParams(GLucose glucose) {
- super(glucose);
+ TowerParams(LX lx) {
+ super(lx);
towerParams = new ArrayList<BasicParameter>();
addParameter(hueoff);
int towerrange = model.towers.size();
int counter=0;
- Sandbox(GLucose glucose) {
- super(glucose);
+ Sandbox(LX lx) {
+ super(lx);
println("points "+pointrange);
println("strips "+striprange);
println("faces "+facerange);
class GranimTestPattern extends GranimPattern
{
- GranimTestPattern(GLucose glucose)
+ GranimTestPattern(LX lx)
{
- super(glucose);
+ super(lx);
addGraphic("myReds",new RedsGraphic(100));
int[] dots = {0,128,0,128,0,128,0,128,0,128,0,128};
addGraphic("myOtherColors",new ColorDotsGraphic(dots));
class GranimTestPattern2 extends GranimPattern
{
- GranimTestPattern2(GLucose glucose)
+ GranimTestPattern2(LX lx)
{
- super(glucose);
+ super(lx);
/*for(int i = 0;i < 100; i++)
{
Graphic g = addGraphic("myReds_"+i,new RedsGraphic(Math.round(Math.random() * 100)));
BasicParameter zd;
BasicParameter mode;
- DriveableCrossSections(GLucose glucose) {
- super(glucose);
+ DriveableCrossSections(LX lx) {
+ super(lx);
}
public void addParams()
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();
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);
float LastBeat=3, LastMeasure=3;
int curRandTempo = 1, curRandTPat = 1;
- Play(GLucose glucose) {
- super(glucose);
+ Play(LX lx) {
+ super(lx);
pRadius = addParam("Rad" , .1 );
pBounce = addParam("Bnc" , .2 );
pAmp = addParam("Amp" , .2 );
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);
public void RotateKnob(int type, int num, float val){
LXParameter p = null;
if(type==0) {
- p = glucose.getPattern().getParameters().get(num);
+ p = getPattern().getParameters().get(num);
if(p!=null) { p.setValue(val); }
}
if(type==1) {
abstract class OSCPattern extends SCPattern {
- public OSCPattern(GLucose glucose){super(glucose);}
+ public OSCPattern(LX lx){super(lx);}
public abstract void oscEvent(OscMessage msg);
}
class OSC_Balls extends OSCPattern {
Ball[] balls;
- public OSC_Balls(GLucose glucose){
- super(glucose);
+ public OSC_Balls(LX lx){
+ super(lx);
balls = new Ball[20];
for(int i=0; i<balls.length; i++) { balls[i] = new Ball(); }
}
/*class ScreenScrape extends SCPattern {
PImage pret;
ScreenShot ss;
- public ScreenScrape(GLucose glucose) {
- super(glucose);
+ public ScreenScrape(LX lx) {
+ super(lx);
System.loadLibrary("ScreenShot");
pret = new PImage(8, 128, ARGB);
ss = new ScreenShot();
updateLights();
}
- DPat(GLucose glucose) {
- super(glucose);
+ DPat(LX lx) {
+ super(lx);
pSpark = addParam("Sprk", 0);
pWave = addParam("Wave", 0);
{
HashMap<String,Graphic> displayList;
- GranimPattern(GLucose glucose)
+ GranimPattern(LX lx)
{
- super(glucose);
+ super(lx);
displayList = new HashMap<String,Graphic>();
}
private final BasicParameter bP = new BasicParameter("b", 0);
private final BasicParameter gP = new BasicParameter("g", 0);
- Gimbal(GLucose glucose) {
- super(glucose);
+ Gimbal(LX lx) {
+ super(lx);
projection = new LXProjection(model);
addParameter(beatsPerRevolutionParam);
addParameter(hueDeltaParam);
_P size;
*/
- Zebra(GLucose glucose) {
- super(glucose);
+ Zebra(LX lx) {
+ super(lx);
projection = new LXProjection(model);
addModulator(angleM).trigger();
final BasicParameter hueScale = new BasicParameter("HUE", 0.3);
- public Swim(GLucose glucose) {
- super(glucose);
+ public Swim(LX lx) {
+ super(lx);
projection = new LXProjection(model);
addParameter(hueScale);
addParameter(crazyParam);
private final float centerX, centerY, centerZ, modelHeight, modelWidth, modelDepth;
SinLFO heightMod = new SinLFO(0.8, 1.9, 17298);
- public Balance(GLucose glucose) {
- super(glucose);
+ public Balance(LX lx) {
+ super(lx);
projection = new LXProjection(model);
private List<FaceFlash> flashes;
private int faceNum = 0;
- public JackieSquares(GLucose glucose) {
- super(glucose);
+ public JackieSquares(LX lx) {
+ super(lx);
addParameter(rateParameter);
addParameter(attackParameter);
addParameter(decayParameter);
private List<StripFlash> flashes;
private int stripNum = 0;
- public JackieLines(GLucose glucose) {
- super(glucose);
+ public JackieLines(LX lx) {
+ super(lx);
addParameter(rateParameter);
addParameter(attackParameter);
addParameter(decayParameter);
private List<PointFlash> flashes;
private int pointNum = 0;
- public JackieDots(GLucose glucose) {
- super(glucose);
+ public JackieDots(LX lx) {
+ super(lx);
addParameter(rateParameter);
addParameter(attackParameter);
addParameter(decayParameter);
// Hold the new lives
private List<Boolean> new_lives;
- public L8onLife(GLucose glucose) {
- super(glucose);
+ public L8onLife(LX lx) {
+ super(lx);
//Print debug info about the cubes.
//outputCubeInfo();
// Hold the new lives
private List<Boolean> new_states;
- public L8onAutomata(GLucose glucose) {
- super(glucose);
+ public L8onAutomata(LX lx) {
+ super(lx);
//Print debug info about the cubes.
//outputCubeInfo();
// Hold the new lives
private List<Boolean> new_lives;
- public L8onStripLife(GLucose glucose) {
- super(glucose);
+ public L8onStripLife(LX lx) {
+ super(lx);
//Print debug info about the strips.
//outputStripInfo();
private final BasicParameter sat = new BasicParameter("SAT", 0.5);
private GraphicEQ eq;
- Cathedrals(GLucose glucose) {
- super(glucose);
+ Cathedrals(LX lx) {
+ super(lx);
addParameter(xpos);
addParameter(wid);
addParameter(arms);
private final BasicParameter wave = new BasicParameter("WAVE", 0);
- MidiMusic(GLucose glucose) {
- super(glucose);
+ MidiMusic(LX lx) {
+ super(lx);
addParameter(lightSize);
addParameter(wave);
addModulator(sparkle).setValue(1);
private BasicParameter sz = new BasicParameter("SIZE", 0.5);
private BasicParameter beatAmount = new BasicParameter("BEAT", 0);
- Pulley(GLucose glucose) {
- super(glucose);
+ Pulley(LX lx) {
+ super(lx);
for (int i = 0; i < NUM_DIVISIONS; ++i) {
addModulator(gravity[i] = new Accelerator(0, 0, 0));
addModulator(delays[i] = new Click(0));
LinearEnvelope dbValue = new LinearEnvelope(0, 0, 10);
- ViolinWave(GLucose glucose) {
- super(glucose);
+ ViolinWave(LX lx) {
+ super(lx);
addParameter(level);
addParameter(edge);
addParameter(range);
final BasicParameter flr = new BasicParameter("FLR", 0);
final BasicParameter blobSize = new BasicParameter("SIZE", 0.5);
- BouncyBalls(GLucose glucose) {
- super(glucose);
+ BouncyBalls(LX lx) {
+ super(lx);
for (int i = 0; i < balls.length; ++i) {
balls[i] = new BouncyBall(i);
}
BasicParameter sizeParameter = new BasicParameter("SIZE", 0.5);
- public SpaceTime(GLucose glucose) {
- super(glucose);
+ public SpaceTime(LX lx) {
+ super(lx);
addModulator(pos).trigger();
addModulator(rate).trigger();
SinLFO fY = new SinLFO(model.yMin, model.yMax, 11000);
SinLFO hOffX = new SinLFO(model.xMin, model.xMax, 13000);
- public Swarm(GLucose glucose) {
- super(glucose);
+ public Swarm(LX lx) {
+ super(lx);
addModulator(offset).trigger();
addModulator(rate).trigger();
private final BasicParameter clr = new BasicParameter("CLR", 0.5);
- public BassPod(GLucose glucose) {
- super(glucose);
+ public BassPod(LX lx) {
+ super(lx);
addParameter(clr);
}
private final BasicParameter clr = new BasicParameter("CLR", 0.5);
private final BasicParameter blockiness = new BasicParameter("BLK", 0.5);
- public CubeEQ(GLucose glucose) {
- super(glucose);
+ public CubeEQ(LX lx) {
+ super(lx);
}
void onActive() {
final BasicParameter release = new BasicParameter("REL", 0.5);
final BasicParameter level = new BasicParameter("AMB", 0.6);
- PianoKeyPattern(GLucose glucose) {
- super(glucose);
+ PianoKeyPattern(LX lx) {
+ super(lx);
addParameter(attack);
addParameter(release);
final BasicParameter zl = new BasicParameter("ZLEV", 0.5);
- CrossSections(GLucose glucose) {
- super(glucose);
+ CrossSections(LX lx) {
+ super(lx);
addModulator(x).trigger();
addModulator(y).trigger();
addModulator(z).trigger();
final SinLFO s;
final TriangleLFO hs;
- public Blinders(GLucose glucose) {
- super(glucose);
+ public Blinders(LX lx) {
+ super(lx);
m = new SinLFO[12];
for (int i = 0; i < m.length; ++i) {
addModulator(m[i] = new SinLFO(0.5, 120, (120000. / (3+i)))).trigger();
TriangleLFO h = new TriangleLFO(0, 240, 19000);
SinLFO c = new SinLFO(-.2, .8, 31000);
- Psychedelia(GLucose glucose) {
- super(glucose);
+ Psychedelia(LX lx) {
+ super(lx);
addModulator(m).trigger();
addModulator(s).trigger();
addModulator(h).trigger();
final Plane[] planes;
final int NUM_PLANES = 3;
- AskewPlanes(GLucose glucose) {
- super(glucose);
+ AskewPlanes(LX lx) {
+ super(lx);
planes = new Plane[NUM_PLANES];
for (int i = 0; i < planes.length; ++i) {
planes[i] = new Plane(i);
final SinLFO c = new SinLFO(-1.4, 1.4, 5700);
final SinLFO d = new SinLFO(-10, 10, 9500);
- ShiftingPlane(GLucose glucose) {
- super(glucose);
+ ShiftingPlane(LX lx) {
+ super(lx);
addModulator(a).trigger();
addModulator(b).trigger();
addModulator(c).trigger();
private int index = 0;
private GraphicEQ eq = null;
- public Traktor(GLucose glucose) {
- super(glucose);
+ public Traktor(LX lx) {
+ super(lx);
for (int i = 0; i < FRAME_WIDTH; ++i) {
bass[i] = 0;
treble[i] = 0;
abstract class SamPattern extends SCPattern {
- public SamPattern(GLucose glucose) {
- super(glucose);
+ public SamPattern(LX lx) {
+ super(lx);
setEligible(false);
}
}
class JazzRainbow extends SamPattern {
- public JazzRainbow(GLucose glucose) {
- super(glucose);
+ public JazzRainbow(LX lx) {
+ super(lx);
}
private static final float tMin = -200;
private static final float tMax = 200;
- public HelixPattern(GLucose glucose) {
- super(glucose);
+ public HelixPattern(LX lx) {
+ super(lx);
addParameter(helix1On);
addParameter(helix2On);
* your name. Implement your classes there, and add them to the list below.
*/
-LXPattern[] patterns(GLucose glucose) {
+LXPattern[] patterns(LX lx) {
return new LXPattern[] {
- new SineSphere(glucose),
- //new CubeCurl(glucose),
+ new SineSphere(lx),
+ //new CubeCurl(lx),
// Slee
- // new Cathedrals(glucose),
- new Swarm(glucose),
- new MidiMusic(glucose),
- new Pulley(glucose),
+ // new Cathedrals(lx),
+ new Swarm(lx),
+ new MidiMusic(lx),
+ new Pulley(lx),
- new ViolinWave(glucose),
- new BouncyBalls(glucose),
- new SpaceTime(glucose),
- new ShiftingPlane(glucose),
- new AskewPlanes(glucose),
- new Blinders(glucose),
- new CrossSections(glucose),
- new Psychedelia(glucose),
+ new ViolinWave(lx),
+ new BouncyBalls(lx),
+ new SpaceTime(lx),
+ new ShiftingPlane(lx),
+ new AskewPlanes(lx),
+ new Blinders(lx),
+ new CrossSections(lx),
+ new Psychedelia(lx),
- new MultipleCubes(glucose),
+ new MultipleCubes(lx),
- new Traktor(glucose).setEligible(false),
- new BassPod(glucose).setEligible(false),
- new CubeEQ(glucose).setEligible(false),
- new PianoKeyPattern(glucose).setEligible(false),
+ new Traktor(lx).setEligible(false),
+ new BassPod(lx).setEligible(false),
+ new CubeEQ(lx).setEligible(false),
+ new PianoKeyPattern(lx).setEligible(false),
// AntonK
- new AKPong(glucose),
+ new AKPong(lx),
// DanH
- new Noise(glucose),
- new Play (glucose),
- new Pong (glucose),
- new Worms(glucose),
+ new Noise(lx),
+ new Play (lx),
+ new Pong (lx),
+ new Worms(lx),
// JR
- new Gimbal(glucose),
+ new Gimbal(lx),
// Alex G
// Tim
- new TimMetronome(glucose),
- new TimPlanes(glucose),
- new TimPinwheels(glucose),
- new TimRaindrops(glucose),
- new TimCubes(glucose),
- // new TimTrace(glucose),
- new TimSpheres(glucose),
+ new TimMetronome(lx),
+ new TimPlanes(lx),
+ new TimPinwheels(lx),
+ new TimRaindrops(lx),
+ new TimCubes(lx),
+ // new TimTrace(lx),
+ new TimSpheres(lx),
// Jackie
- new JackieSquares(glucose),
- new JackieLines(glucose),
- new JackieDots(glucose),
+ new JackieSquares(lx),
+ new JackieLines(lx),
+ new JackieDots(lx),
// L8on
- new L8onAutomata(glucose),
- new L8onLife(glucose),
- new L8onStripLife(glucose),
+ new L8onAutomata(lx),
+ new L8onLife(lx),
+ new L8onStripLife(lx),
// Vincent
- new VSTowers(glucose),
+ new VSTowers(lx),
// Toby
- new GlitchPlasma(glucose),
- new FireEffect(glucose).setEligible(false),
- new StripBounce(glucose),
- new SoundRain(glucose).setEligible(false),
- new SoundSpikes(glucose).setEligible(false),
- new FaceSync(glucose),
+ new GlitchPlasma(lx),
+ new FireEffect(lx).setEligible(false),
+ new StripBounce(lx),
+ new SoundRain(lx).setEligible(false),
+ new SoundSpikes(lx).setEligible(false),
+ new FaceSync(lx),
// Jack
- new Swim(glucose),
- new Balance(glucose),
+ new Swim(lx),
+ new Balance(lx),
// Ben
- // new Sandbox(glucose),
- new TowerParams(glucose),
- new DriveableCrossSections(glucose),
- new GranimTestPattern2(glucose),
+ // new Sandbox(lx),
+ new TowerParams(lx),
+ new DriveableCrossSections(lx),
+ new GranimTestPattern2(lx),
// Shaheen
- // new HelixPattern(glucose).setEligible(false),
+ // new HelixPattern(lx).setEligible(false),
// Sam
- new JazzRainbow(glucose),
+ new JazzRainbow(lx),
// Arjun
- new TelevisionStatic(glucose),
- new AbstractPainting(glucose),
- new Spirality(glucose),
+ new TelevisionStatic(lx),
+ new AbstractPainting(lx),
+ new Spirality(lx),
// Basic test patterns for reference, not art
- new TestCubePattern(glucose),
- new TestTowerPattern(glucose),
- new TestProjectionPattern(glucose),
- new TestStripPattern(glucose),
- // new TestHuePattern(glucose),
- // new TestXPattern(glucose),
- // new TestYPattern(glucose),
- // new TestZPattern(glucose),
+ new TestCubePattern(lx),
+ new TestTowerPattern(lx),
+ new TestProjectionPattern(lx),
+ new TestStripPattern(lx),
+ // new TestHuePattern(lx),
+ // new TestXPattern(lx),
+ // new TestYPattern(lx),
+ // new TestZPattern(lx),
};
}
-LXTransition[] transitions(GLucose glucose) {
+LXTransition[] transitions(LX lx) {
return new LXTransition[] {
new DissolveTransition(lx),
new AddTransition(lx),
new DodgeTransition(lx),
new SwipeTransition(lx),
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
};
}
class BlankPattern extends SCPattern {
- BlankPattern(GLucose glucose) {
- super(glucose);
+ BlankPattern(LX lx) {
+ super(lx);
}
public void run(double deltaMs) {
}
abstract class TestPattern extends SCPattern {
- public TestPattern(GLucose glucose) {
- super(glucose);
+ public TestPattern(LX lx) {
+ super(lx);
setEligible(false);
}
}
SinLFO d = new SinLFO(4, 40, 4000);
- public TestStripPattern(GLucose glucose) {
- super(glucose);
+ public TestStripPattern(LX lx) {
+ super(lx);
addModulator(d).trigger();
}
* All pixels are full-on the same color.
*/
class TestHuePattern extends TestPattern {
- public TestHuePattern(GLucose glucose) {
- super(glucose);
+ public TestHuePattern(LX lx) {
+ super(lx);
}
public void run(double deltaMs) {
*/
class TestXPattern extends TestPattern {
private final SinLFO xPos = new SinLFO(0, model.xMax, 4000);
- public TestXPattern(GLucose glucose) {
- super(glucose);
+ public TestXPattern(LX lx) {
+ super(lx);
addModulator(xPos).trigger();
}
public void run(double deltaMs) {
*/
class TestYPattern extends TestPattern {
private final SinLFO yPos = new SinLFO(0, model.yMax, 4000);
- public TestYPattern(GLucose glucose) {
- super(glucose);
+ public TestYPattern(LX lx) {
+ super(lx);
addModulator(yPos).trigger();
}
public void run(double deltaMs) {
*/
class TestZPattern extends TestPattern {
private final SinLFO zPos = new SinLFO(0, model.zMax, 4000);
- public TestZPattern(GLucose glucose) {
- super(glucose);
+ public TestZPattern(LX lx) {
+ super(lx);
addModulator(zPos).trigger();
}
public void run(double deltaMs) {
class TestTowerPattern extends TestPattern {
private final SawLFO towerIndex = new SawLFO(0, model.towers.size(), 1000*model.towers.size());
- public TestTowerPattern(GLucose glucose) {
- super(glucose);
+ public TestTowerPattern(LX lx) {
+ super(lx);
addModulator(towerIndex).trigger();
}
private final SawLFO angle = new SawLFO(0, TWO_PI, 9000);
private final SinLFO yPos = new SinLFO(-20, 40, 5000);
- public TestProjectionPattern(GLucose glucose) {
- super(glucose);
+ public TestProjectionPattern(LX lx) {
+ super(lx);
projection = new LXProjection(model);
addModulator(angle).trigger();
addModulator(yPos).trigger();
private SawLFO index = new SawLFO(0, Cube.POINTS_PER_CUBE, Cube.POINTS_PER_CUBE*60);
- TestCubePattern(GLucose glucose) {
- super(glucose);
+ TestCubePattern(LX lx) {
+ super(lx);
addModulator(index).start();
}
private final int numChannels;
- MappingTool(GLucose glucose) {
- super(glucose);
+ MappingTool(LX lx) {
+ super(lx);
// TODO(mcslee): port channels to grizzly
numChannels = 1;
setChannel();
private final Sphere[] spheres;
- public TimSpheres(GLucose glucose) {
- super(glucose);
+ public TimSpheres(LX lx) {
+ super(lx);
addParameter(hueParameter);
addParameter(periodParameter);
addModulator(lfo).trigger();
private float msPerRaindrop = 40;
private List<Raindrop> raindrops;
- public TimRaindrops(GLucose glucose) {
- super(glucose);
+ public TimRaindrops(LX lx) {
+ super(lx);
raindrops = new LinkedList<Raindrop>();
}
private float leftoverMs = 0;
private List<CubeFlash> flashes;
- public TimCubes(GLucose glucose) {
- super(glucose);
+ public TimCubes(LX lx) {
+ super(lx);
addParameter(rateParameter);
addParameter(attackParameter);
addParameter(decayParameter);
}
}
- TimPlanes(GLucose glucose) {
- super(glucose);
+ TimPlanes(LX lx) {
+ super(lx);
centerX = (model.xMin + model.xMax) / 2;
centerY = (model.yMin + model.yMax) / 2;
centerZ = (model.zMin + model.zMax) / 2;
private final List<Pinwheel> pinwheels;
private final float[] values;
- TimPinwheels(GLucose glucose) {
- super(glucose);
+ TimPinwheels(LX lx) {
+ super(lx);
addParameter(horizSpreadParameter);
// addParameter(vertSpreadParameter);
List<MovingPoint> movingPoints;
- TimTrace(GLucose glucose) {
- super(glucose);
+ TimTrace(LX lx) {
+ super(lx);
extraMs = 0;
private float[] values;
private float[] hues;
- TimMetronome(GLucose glucose) {
- super(glucose);
+ TimMetronome(LX lx) {
+ super(lx);
addParameter(clickyParameter);
addParameter(derezParameter);
addParameter(driftParameter);
BasicParameter speedParameter = new BasicParameter("SPEED", 0.1);
BasicParameter glitchParameter = new BasicParameter("GLITCH", 0.0);
- public GlitchPlasma(GLucose glucose) {
- super(glucose);
+ public GlitchPlasma(LX lx) {
+ super(lx);
addParameter(saturationParameter);
addParameter(speedParameter);
addParameter(glitchParameter);
private int ym;
BasicParameter decayParameter = new BasicParameter("DECAY", 0.3);
- public FireEffect(GLucose glucose) {
- super(glucose);
+ public FireEffect(LX lx) {
+ super(lx);
xm = int(model.xMax);
ym = int(model.yMax);
SinLFO[] sat = new SinLFO[numOsc];
float[] colorOffset = new float[numOsc];
- public StripBounce(GLucose glucose) {
- super(glucose);
+ public StripBounce(LX lx) {
+ super(lx);
for (int i=0;i<numOsc;i++) {
fX[i] = new SinLFO(0, model.xMax, random(2000,20000));
fY[i] = new SinLFO(0, model.yMax, random(2000,20000));
SinLFO col1 = new SinLFO(0, model.xMax, 5000);
BasicParameter gainParameter = new BasicParameter("GAIN", 0.5);
- public SoundRain(GLucose glucose) {
- super(glucose);
+ public SoundRain(LX lx) {
+ super(lx);
addModulator(pos).trigger();
addModulator(col1).trigger();
addParameter(gainParameter);
SinLFO col1 = new SinLFO(0, model.xMax, 5000);
SinLFO col2 = new SinLFO(0, model.xMax, 4000);
- public FaceSync(GLucose glucose) {
- super(glucose);
+ public FaceSync(LX lx) {
+ super(lx);
addModulator(xosc).trigger();
addModulator(zosc).trigger();
zosc.setValue(0);
BasicParameter gainParameter = new BasicParameter("GAIN", 0.5);
SawLFO pos = new SawLFO(0, model.xMax, 8000);
- public SoundSpikes(GLucose glucose) {
- super(glucose);
+ public SoundSpikes(LX lx) {
+ super(lx);
addParameter(gainParameter);
addModulator(pos).trigger();
}
}
}
- public VSTowers(GLucose glucose) {
- super(glucose);
+ public VSTowers(LX lx) {
+ super(lx);
addParameter(saturationParameter);
addParameter(attackParameter);
addParameter(decayParameter);
* Engine construction and initialization.
*/
-LXTransition _transition(GLucose glucose) {
- return new DissolveTransition(glucose.lx).setDuration(1000);
+LXTransition _transition(LX lx) {
+ return new DissolveTransition(lx).setDuration(1000);
}
-LXPattern[] _leftPatterns(GLucose glucose) {
- LXPattern[] patterns = patterns(glucose);
+LXPattern[] _leftPatterns(LX lx) {
+ LXPattern[] patterns = patterns(lx);
for (LXPattern p : patterns) {
- p.setTransition(_transition(glucose));
+ p.setTransition(_transition(lx));
}
return patterns;
}
-LXPattern[] _rightPatterns(GLucose glucose) {
- LXPattern[] patterns = _leftPatterns(glucose);
+LXPattern[] _rightPatterns(LX lx) {
+ LXPattern[] patterns = _leftPatterns(lx);
LXPattern[] rightPatterns = new LXPattern[patterns.length+1];
int i = 0;
- rightPatterns[i++] = new BlankPattern(glucose).setTransition(_transition(glucose));
+ rightPatterns[i++] = new BlankPattern(lx).setTransition(_transition(lx));
for (LXPattern p : patterns) {
rightPatterns[i++] = p;
}
// Set the patterns
LXEngine engine = lx.engine;
- engine.setPatterns(patterns = _leftPatterns(glucose));
- engine.addDeck(_rightPatterns(glucose));
+ engine.setPatterns(patterns = _leftPatterns(lx));
+ engine.addDeck(_rightPatterns(lx));
logTime("Built patterns");
- glucose.setTransitions(transitions(glucose));
+ glucose.setTransitions(transitions(lx));
logTime("Built transitions");
glucose.lx.addEffects(_effectsArray(effects = new Effects()));
logTime("Built effects");
logTime("Built Grizzly Outputs");
// Mapping tools
- mappingTool = new MappingTool(glucose);
+ mappingTool = new MappingTool(lx);
// Build overlay UI
UILayer[] layers = new UILayer[] {
println("Hit the 'o' key to toggle live output");
}
+public SCPattern getPattern() {
+ return (SCPattern) lx.getPattern();
+}
+
+/**
+ * Subclass of LXPattern specific to sugar cubes. These patterns
+ * get access to the glucose state and geometry, and have some
+ * little helpers for interacting with the model.
+ */
+public static abstract class SCPattern extends LXPattern {
+
+ protected SCPattern(LX lx) {
+ super(lx);
+ }
+
+ /**
+ * Reset this pattern to its default state.
+ */
+ public final void reset() {
+ for (LXParameter parameter : getParameters()) {
+ parameter.reset();
+ }
+ onReset();
+ }
+
+ /**
+ * Subclasses may override to add additional reset functionality.
+ */
+ protected /*abstract*/ void onReset() {}
+
+ /**
+ * Invoked by the engine when a grid controller button press occurs
+ *
+ * @param row Row index on the gird
+ * @param col Column index on the grid
+ * @return True if the event was consumed, false otherwise
+ */
+ public boolean gridPressed(int row, int col) {
+ return false;
+ }
+
+ /**
+ * Invoked by the engine when a grid controller button release occurs
+ *
+ * @param row Row index on the gird
+ * @param col Column index on the grid
+ * @return True if the event was consumed, false otherwise
+ */
+ public boolean gridReleased(int row, int col) {
+ return false;
+ }
+
+ /**
+ * Invoked by engine when this pattern is focused an a midi note is received.
+ *
+ * @param note
+ * @return True if the pattern has consumed this note, false if the top-level
+ * may handle it
+ */
+ public boolean noteOn(rwmidi.Note note) {
+ return false;
+ }
+
+ /**
+ * Invoked by engine when this pattern is focused an a midi note off is received.
+ *
+ * @param note
+ * @return True if the pattern has consumed this note, false if the top-level
+ * may handle it
+ */
+ public boolean noteOff(rwmidi.Note note) {
+ return false;
+ }
+
+ /**
+ * Invoked by engine when this pattern is focused an a controller is received
+ *
+ * @param note
+ * @return True if the pattern has consumed this controller, false if the top-level
+ * may handle it
+ */
+ public boolean controllerChange(rwmidi.Controller controller) {
+ return false;
+ }
+}
+
long simulationNanos = 0;
/**