1 // class GenericController {
2 // GenericController(){}
3 // public void RotateKnob(int type, int num, float val){
4 // LXParameter p = null;
6 // p = getPattern().getParameters().get(num);
7 // if(p!=null) { p.setValue(val); }
10 // p = lx.engine.getDeck(RIGHT_DECK).getFaderTransition().getParameters().get(num);
11 // if(p!=null) { p.setValue(val); }
14 // p = getSelectedEffect().getParameters().get(num);
15 // if(p!=null) { p.setValue(val); }
20 // class MidiController extends GenericController {
25 // //PApplet xparent; // be sure to set
31 // //listener = new OscP5(this,7022);
33 // //boolean[] noteState = new boolean[16];
35 // //void controllerChangeReceived(rwmidi.Controller cc) {
36 // // if (debugMode) {
37 // // println("CC: " + cc.toString());
39 // // if(cc.getCC()==1){
40 // // for(int i=0; i<16; i++){
41 // // if(noteState[i] && i<8) { LXParameter p = glucose.getPattern().getParameters().get(i); p.setValue(cc.getValue()/127.0); }
42 // // else if(noteState[i] && i<12) { LXParameter p = glucose.getSelectedTransition().getParameters().get(i-8); p.setValue(cc.getValue()/127.0); }
43 // // else if(noteState[i] && i<16) { LXParameter p = glucose.getSelectedEffect().getParameters().get(i-12); p.setValue(cc.getValue()/127.0); }
48 // //void noteOnReceived(Note note) {
49 // // if (debugMode) {
50 // // println("Note On: " + note.toString());
52 // // int pitch = note.getPitch();
53 // // if(pitch>=36 && pitch <36+16){
54 // // noteState[pitch-36]=true;
58 // //void noteOffReceived(Note note) {
59 // // if (debugMode) {
60 // // println("Note Off: " + note.toString());
62 // // int pitch = note.getPitch();
63 // // if(pitch>=36 && pitch <36+16){
64 // // noteState[pitch-36]=false;
68 // //void oscEvent(OscMessage theOscMessage) {
69 // // println(theOscMessage);
70 // // LXPattern currentPattern = lx.getPattern();
71 // // if (currentPattern instanceof OSCPattern) {
72 // // ((OSCPattern)currentPattern).oscEvent(theOscMessage);
78 // class ObjectMuckerEffect extends LXEffect {
79 // ObjectMuckerEffect(LX lx) {
82 // public void apply(int[] colors){
83 // /*for(Strip s: model.strips){
84 // for(int i=0; i<s.points.size(); i++){
85 // int index = s.points.get(i).index;
86 // color c = colors[index];
87 // colors[index] = lx.hsb((i*22.5), saturation(c), brightness(c));
93 // class BlendFrames extends LXEffect {
98 // BlendFrames(LX lx) {
103 // frames = new int[maxfbuf][];
104 // for(int i=0; i<maxfbuf; i++){
105 // frames[i] = new int[model.points.size()];
108 // public void apply(int[] colors) {
109 // if(fcount<maxfbuf){
110 // for(int i=0; i<colors.length; i++){
111 // frames[(maxfbuf-1)-fcount][i]=colors[i];
116 // for(int i=maxfbuf-1; i>0; i--){
117 // frames[i] = frames[i-1];
119 // frames[0] = new int[model.points.size()];
121 // for(int i=0; i<colors.length; i++){
124 // for(int j=0; j<blendfactor; j++){
125 // if(j==0) { frames[0][i] = colors[i]; }
126 // r += ((frames[j][i] >> 16) & 0xFF);
127 // g += ((frames[j][i] >> 8) & 0xFF);
128 // b += ((frames[j][i] >> 0) & 0xFF);
134 // colors[i] = (0xFF << 24) | (r << 16) | (g << 8) | b;
144 // abstract class OSCPattern extends SCPattern {
145 // public OSCPattern(LX lx){super(lx);}
146 // public abstract void oscEvent(OscMessage msg);
150 // public int lastSeen;
157 // class OSC_Balls extends OSCPattern {
159 // public OSC_Balls(LX lx){
161 // balls = new Ball[20];
162 // for(int i=0; i<balls.length; i++) { balls[i] = new Ball(); }
164 // void oscEvent(OscMessage msg){
165 // String pattern[] = split(msg.addrPattern(), "/");
166 // int ballnum = int(pattern[3]);
167 // balls[ballnum].lastSeen=millis();
168 // balls[ballnum].x = msg.get(0).floatValue();
169 // balls[ballnum].y = msg.get(1).floatValue();
172 // void run(double deltaMs){
173 // for(LXPoint p: model.points){ colors[p.index]=0; }
174 // for(int i=1; i<balls.length; i++){
175 // if(millis() - balls[i].lastSeen < 1000) {
176 // for(LXPoint p: model.points){
177 // int x = int(balls[i].x * 255.0);
178 // int y = int(balls[i].y * 127.0);
179 // if(p.x < x+4 && p.x > x-4 && p.y < y+4 && p.y > y-4) { colors[p.index] = #FF0000; }
186 // import processing.serial.*;
189 // /*class ScreenScrape extends SCPattern {
192 // public ScreenScrape(LX lx) {
194 // System.loadLibrary("ScreenShot");
195 // pret = new PImage(8, 128, ARGB);
196 // ss = new ScreenShot();
198 // void run(double deltaMs){
199 // int x=(1366/2)+516;
203 // pret.pixels = ss.getScreenShotJNI2(x, y, w, h);
204 // //for(int i=0; i<px.length; i++){ pret.pixels[i] = px[i]; }
205 // //println(pret.get(10,10));
206 // for(LXPoint p: model.points){
207 // colors[p.index] = pret.get((int(p.x)/8)*8, 128-int(p.y));