- }
- }
-}
-
-
-import netP5.*;
-import oscP5.*;
-
-
-
-abstract class OSCPattern extends SCPattern {
- public OSCPattern(GLucose glucose){super(glucose);}
- public abstract void oscEvent(OscMessage msg);
-}
-
-class Ball {
- public int lastSeen;
- public float x,y;
- public Ball(){
- x=y=lastSeen=0;
- }
-}
-
-class OSC_Balls extends OSCPattern {
- Ball[] balls;
- public OSC_Balls(GLucose glucose){
- super(glucose);
- balls = new Ball[20];
- for(int i=0; i<balls.length; i++) { balls[i] = new Ball(); }
- }
- void oscEvent(OscMessage msg){
- String pattern[] = split(msg.addrPattern(), "/");
- int ballnum = int(pattern[3]);
- balls[ballnum].lastSeen=millis();
- balls[ballnum].x = msg.get(0).floatValue();
- balls[ballnum].y = msg.get(1).floatValue();
- }
-
- void run(int deltaMs){
- for(Point p: model.points){ colors[p.index]=0; }
- for(int i=1; i<balls.length; i++){
- if(millis() - balls[i].lastSeen < 1000) {
- for(Point p: model.points){
- int x = int(balls[i].x * 255.0);
- int y = int(balls[i].y * 127.0);
- if(p.x < x+4 && p.x > x-4 && p.y < y+4 && p.y > y-4) { colors[p.index] = #FF0000; }
- }
- }
- }
- }
-}
-
-import processing.serial.*;
-
-
-/*class ScreenScrape extends SCPattern {
- PImage pret;
- ScreenShot ss;
- public ScreenScrape(GLucose glucose) {
- super(glucose);
- System.loadLibrary("ScreenShot");
- pret = new PImage(8, 128, ARGB);
- ss = new ScreenShot();
- }
- void run(int deltaMs){
- int x=(1366/2)+516;
- int y=768-516;
- int w=8;
- int h=128;
- pret.pixels = ss.getScreenShotJNI2(x, y, w, h);
- //for(int i=0; i<px.length; i++){ pret.pixels[i] = px[i]; }
- //println(pret.get(10,10));
- for(Point p: model.points){
- colors[p.index] = pret.get((int(p.x)/8)*8, 128-int(p.y));
- }
- }
-}*/
-
-List<LXParameter> gparams;
-
- class DualBlender extends SCEffect {
- int lastSeen;
- BasicParameter p1 = new BasicParameter("p1", 0);
- BasicParameter p2 = new BasicParameter("p2", 0);
- BasicParameter p3 = new BasicParameter("p3", 0);
- BasicParameter p4 = new BasicParameter("p4", 0);
- BasicParameter p5 = new BasicParameter("p5", 0);
- BasicParameter p6 = new BasicParameter("p6", 0);
- BasicParameter p7 = new BasicParameter("p7", 0);
- BasicParameter p8 = new BasicParameter("p8", 0);
- DualBlender(GLucose glucose){
- super(glucose);
- gparams = gplay.getParameters();
- addParameter(p1);
- addParameter(p2);
- addParameter(p3);
- addParameter(p4);
- addParameter(p5);
- addParameter(p6);
- addParameter(p7);
- addParameter(p8);
-
- lastSeen=millis();
- }
-
- void onParameterChanged(LXParameter p){
- if(p==p1) { gparams.get(0).setValue(p.getValuef()); }
- if(p==p2) { gparams.get(1).setValue(p.getValuef()); }
- if(p==p3) { gparams.get(2).setValue(p.getValuef()); }
- if(p==p4) { gparams.get(3).setValue(p.getValuef()); }
- if(p==p5) { gparams.get(4).setValue(p.getValuef()); }
- if(p==p6) { gparams.get(5).setValue(p.getValuef()); }
- if(p==p7) { gparams.get(6).setValue(p.getValuef()); }
- if(p==p8) { gparams.get(7).setValue(p.getValuef()); }
- }
-
- void doApply(int[] colors){
- if (enabled) {
- //gplay.onActive();
- gplay.go(millis()-lastSeen);
- lastSeen=millis();
- int[] pcolors = gplay.getColors();
- for(int i=0; i<colors.length; i++){
- colors[i]=blendColor(colors[i],pcolors[i], MULTIPLY);
- }
- } else {}//gplay.onInactive(); }
- }
-
+// }
+// }
+// }
+
+
+
+// abstract class OSCPattern extends SCPattern {
+// public OSCPattern(LX lx){super(lx);}
+// public abstract void oscEvent(OscMessage msg);
+// }
+
+// class Ball {
+// public int lastSeen;
+// public float x,y;
+// public Ball(){
+// x=y=lastSeen=0;
+// }
+// }
+
+// class OSC_Balls extends OSCPattern {
+// Ball[] balls;
+// public OSC_Balls(LX lx){
+// super(lx);
+// balls = new Ball[20];
+// for(int i=0; i<balls.length; i++) { balls[i] = new Ball(); }
+// }
+// void oscEvent(OscMessage msg){
+// String pattern[] = split(msg.addrPattern(), "/");
+// int ballnum = int(pattern[3]);
+// balls[ballnum].lastSeen=millis();
+// balls[ballnum].x = msg.get(0).floatValue();
+// balls[ballnum].y = msg.get(1).floatValue();
+// }