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
32 // //listener = new OscP5(this,7022);
34 // //boolean[] noteState = new boolean[16];
36 // //void controllerChangeReceived(rwmidi.Controller cc) {
37 // // if (debugMode) {
38 // // println("CC: " + cc.toString());
40 // // if(cc.getCC()==1){
41 // // for(int i=0; i<16; i++){
42 // // if(noteState[i] && i<8) { LXParameter p = glucose.getPattern().getParameters().get(i); p.setValue(cc.getValue()/127.0); }
43 // // else if(noteState[i] && i<12) { LXParameter p = glucose.getSelectedTransition().getParameters().get(i-8); p.setValue(cc.getValue()/127.0); }
44 // // else if(noteState[i] && i<16) { LXParameter p = glucose.getSelectedEffect().getParameters().get(i-12); p.setValue(cc.getValue()/127.0); }
49 // //void noteOnReceived(Note note) {
50 // // if (debugMode) {
51 // // println("Note On: " + note.toString());
53 // // int pitch = note.getPitch();
54 // // if(pitch>=36 && pitch <36+16){
55 // // noteState[pitch-36]=true;
59 // //void noteOffReceived(Note note) {
60 // // if (debugMode) {
61 // // println("Note Off: " + note.toString());
63 // // int pitch = note.getPitch();
64 // // if(pitch>=36 && pitch <36+16){
65 // // noteState[pitch-36]=false;
69 // //void oscEvent(OscMessage theOscMessage) {
70 // // println(theOscMessage);
71 // // LXPattern currentPattern = lx.getPattern();
72 // // if (currentPattern instanceof OSCPattern) {
73 // // ((OSCPattern)currentPattern).oscEvent(theOscMessage);
79 // class ObjectMuckerEffect extends LXEffect {
80 // ObjectMuckerEffect(LX lx) {
83 // public void apply(int[] colors){
84 // /*for(Strip s: model.strips){
85 // for(int i=0; i<s.points.size(); i++){
86 // int index = s.points.get(i).index;
87 // color c = colors[index];
88 // colors[index] = lx.hsb((i*22.5), saturation(c), brightness(c));
94 // class BlendFrames extends LXEffect {
99 // BlendFrames(LX lx) {
104 // frames = new int[maxfbuf][];
105 // for(int i=0; i<maxfbuf; i++){
106 // frames[i] = new int[model.points.size()];
109 // public void apply(int[] colors) {
110 // if(fcount<maxfbuf){
111 // for(int i=0; i<colors.length; i++){
112 // frames[(maxfbuf-1)-fcount][i]=colors[i];
117 // for(int i=maxfbuf-1; i>0; i--){
118 // frames[i] = frames[i-1];
120 // frames[0] = new int[model.points.size()];
122 // for(int i=0; i<colors.length; i++){
125 // for(int j=0; j<blendfactor; j++){
126 // if(j==0) { frames[0][i] = colors[i]; }
127 // r += ((frames[j][i] >> 16) & 0xFF);
128 // g += ((frames[j][i] >> 8) & 0xFF);
129 // b += ((frames[j][i] >> 0) & 0xFF);
135 // colors[i] = (0xFF << 24) | (r << 16) | (g << 8) | b;
145 // abstract class OSCPattern extends SCPattern {
146 // public OSCPattern(LX lx){super(lx);}
147 // public abstract void oscEvent(OscMessage msg);
151 // public int lastSeen;
158 // class OSC_Balls extends OSCPattern {
160 // public OSC_Balls(LX lx){
162 // balls = new Ball[20];
163 // for(int i=0; i<balls.length; i++) { balls[i] = new Ball(); }
165 // void oscEvent(OscMessage msg){
166 // String pattern[] = split(msg.addrPattern(), "/");
167 // int ballnum = int(pattern[3]);
168 // balls[ballnum].lastSeen=millis();
169 // balls[ballnum].x = msg.get(0).floatValue();
170 // balls[ballnum].y = msg.get(1).floatValue();
173 // void run(double deltaMs){
174 // for(LXPoint p: model.points){ colors[p.index]=0; }
175 // for(int i=1; i<balls.length; i++){
176 // if(millis() - balls[i].lastSeen < 1000) {
177 // for(LXPoint p: model.points){
178 // int x = int(balls[i].x * 255.0);
179 // int y = int(balls[i].y * 127.0);
180 // if(p.x < x+4 && p.x > x-4 && p.y < y+4 && p.y > y-4) { colors[p.index] = #FF0000; }
187 // import processing.serial.*;
190 // /*class ScreenScrape extends SCPattern {
193 // public ScreenScrape(LX lx) {
195 // System.loadLibrary("ScreenShot");
196 // pret = new PImage(8, 128, ARGB);
197 // ss = new ScreenShot();
199 // void run(double deltaMs){
200 // int x=(1366/2)+516;
204 // pret.pixels = ss.getScreenShotJNI2(x, y, w, h);
205 // //for(int i=0; i<px.length; i++){ pret.pixels[i] = px[i]; }
206 // //println(pret.get(10,10));
207 // for(LXPoint p: model.points){
208 // colors[p.index] = pret.get((int(p.x)/8)*8, 128-int(p.y));