New LX UI
[SugarCubes.git] / DanKaminsky.pde
CommitLineData
0d347a74 1// class GenericController {
2// GenericController(){}
3// public void RotateKnob(int type, int num, float val){
4// LXParameter p = null;
5// if(type==0) {
6// p = getPattern().getParameters().get(num);
7// if(p!=null) { p.setValue(val); }
8// }
9// if(type==1) {
10// p = lx.engine.getDeck(RIGHT_DECK).getFaderTransition().getParameters().get(num);
11// if(p!=null) { p.setValue(val); }
12// }
13// if(type==2) {
14// p = getSelectedEffect().getParameters().get(num);
15// if(p!=null) { p.setValue(val); }
16// }
17// }
18// }
19
20// class MidiController extends GenericController {
21// MidiController() {
22// super();
23// }
24// }
25// //PApplet xparent; // be sure to set
26
27
28
3194ee6b 29
0d347a74 30// OscP5 listener;
31// // Setup OSC
32// //listener = new OscP5(this,7022);
33
34// //boolean[] noteState = new boolean[16];
35// //
36// //void controllerChangeReceived(rwmidi.Controller cc) {
37// // if (debugMode) {
38// // println("CC: " + cc.toString());
39// // }
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); }
45// // }
46// // }
47// //}
48// //
49// //void noteOnReceived(Note note) {
50// // if (debugMode) {
51// // println("Note On: " + note.toString());
52// // }
53// // int pitch = note.getPitch();
54// // if(pitch>=36 && pitch <36+16){
55// // noteState[pitch-36]=true;
56// // }
57// //}
58// //
59// //void noteOffReceived(Note note) {
60// // if (debugMode) {
61// // println("Note Off: " + note.toString());
62// // }
63// // int pitch = note.getPitch();
64// // if(pitch>=36 && pitch <36+16){
65// // noteState[pitch-36]=false;
66// // }
67// //}
68// //
69// //void oscEvent(OscMessage theOscMessage) {
70// // println(theOscMessage);
71// // LXPattern currentPattern = lx.getPattern();
72// // if (currentPattern instanceof OSCPattern) {
73// // ((OSCPattern)currentPattern).oscEvent(theOscMessage);
74// // }
75// //}
76// //
77
78
79// class ObjectMuckerEffect extends LXEffect {
80// ObjectMuckerEffect(LX lx) {
81// super(lx);
82// }
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));
89// }
90// }*/
91// }
92// }
93
94// class BlendFrames extends LXEffect {
95// int fcount;
96// int frames[][];
97// int maxfbuf;
98// int blendfactor;
99// BlendFrames(LX lx) {
100// super(lx);
101// maxfbuf = 30;
102// blendfactor=30;
103// fcount=0;
104// frames = new int[maxfbuf][];
105// for(int i=0; i<maxfbuf; i++){
106// frames[i] = new int[model.points.size()];
107// }
108// }
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];
113// }
114// fcount++;
115// return;
116// } else {
117// for(int i=maxfbuf-1; i>0; i--){
118// frames[i] = frames[i-1];
119// }
120// frames[0] = new int[model.points.size()];
e28f168c 121
0d347a74 122// for(int i=0; i<colors.length; i++){
123// int r,g,b;
124// r=g=b=0;
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);
130// }
131// r/=blendfactor;
132// g/=blendfactor;
133// b/=blendfactor;
134// colorMode(ARGB);
135// colors[i] = (0xFF << 24) | (r << 16) | (g << 8) | b;
136// colorMode(HSB);
137// }
e28f168c 138
0d347a74 139// }
140// }
141// }
142
143
144
145// abstract class OSCPattern extends SCPattern {
146// public OSCPattern(LX lx){super(lx);}
147// public abstract void oscEvent(OscMessage msg);
148// }
149
150// class Ball {
151// public int lastSeen;
152// public float x,y;
153// public Ball(){
154// x=y=lastSeen=0;
155// }
156// }
157
158// class OSC_Balls extends OSCPattern {
159// Ball[] balls;
160// public OSC_Balls(LX lx){
161// super(lx);
162// balls = new Ball[20];
163// for(int i=0; i<balls.length; i++) { balls[i] = new Ball(); }
164// }
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();
171// }
e28f168c 172
0d347a74 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; }
181// }
182// }
183// }
184// }
185// }
186
187// import processing.serial.*;
188
189
190// /*class ScreenScrape extends SCPattern {
191// PImage pret;
192// ScreenShot ss;
193// public ScreenScrape(LX lx) {
194// super(lx);
195// System.loadLibrary("ScreenShot");
196// pret = new PImage(8, 128, ARGB);
197// ss = new ScreenShot();
198// }
199// void run(double deltaMs){
200// int x=(1366/2)+516;
201// int y=768-516;
202// int w=8;
203// int h=128;
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));
209// }
210// }
211// }*/
e28f168c 212