Permalink
Browse files

Made comm compatible with Dacwes again

Fixed some routines
  • Loading branch information...
1 parent bd14d2a commit 0a80936831ac58a45697b304d9fdc206b2b2f06a @potatono potatono committed May 25, 2012
Showing with 22 additions and 15 deletions.
  1. +1 −1 Bursts.pde
  2. +6 −1 FFT.pde
  3. +5 −4 Dacwes.pde → Sculpture.pde
  4. +10 −9 acw.pde
View
@@ -3,7 +3,7 @@ class Bursts extends Routine {
Burst[] bursts;
boolean burst_fill = false;
- void setup(PApplet parent, WiiController controller) {
+ void setup(PApplet parent) {
super.setup(parent);
bursts = new Burst[NUMBER_OF_BURSTS];
for (int i = 0; i<NUMBER_OF_BURSTS; i++) {
View
@@ -26,7 +26,12 @@ class FFTDemo extends Routine {
// //line(i, HEIGHT, i, HEIGHT - fft.getBand(i));
float barHeight = fft.getBand(i)*4;
for (float c = 0; c < barHeight; c++) {
- stroke(c/barHeight*255, 0, 255);
+ if (isRGB) {
+ stroke(c/barHeight*255, 0, 255);
+ }
+ else {
+ stroke(255-(c/barHeight*255));
+ }
point(i, HEIGHT - c);
}
}
@@ -28,7 +28,7 @@ import hypermedia.net.*;
*
**/
-public class Dacwes {
+public class Sculpture {
public static final int ADDRESSING_VERTICAL_NORMAL = 1;
public static final int ADDRESSING_VERTICAL_HALF = 2;
public static final int ADDRESSING_VERTICAL_FLIPFLOP = 3;
@@ -46,16 +46,17 @@ public class Dacwes {
byte buffer[];
int pixelsPerChannel;
- public Dacwes(PApplet parent, int w, int h) {
+ public Sculpture(PApplet parent, int w, int h, boolean isRGB) {
this.parent = parent;
this.udp = new UDP(parent);
this.address = "192.168.1.130";
this.port = 58082;
this.w = w;
this.h = h;
- int bufferSize = 3*(w*h)+1;
+ int bufferSize = (isRGB ? 3 : 1)*(w*h)+1;
buffer = new byte[bufferSize];
this.addressingMode = ADDRESSING_VERTICAL_NORMAL;
+ // TODO Detect this based on VERTICAL (h/2) vs. HORIZONTAL (w/2)
this.pixelsPerChannel = 8;
for (int i=0; i<bufferSize; i++) {
@@ -145,7 +146,7 @@ public class Dacwes {
for (int y=0; y<h; y++) {
for (int x=0; x<w; x++) {
r = int(brightness(image.pixels[y*w+x]));
- buffer[(getAddress(x,y)+1] = byte(r);
+ buffer[(getAddress(x,y)+1)] = byte(r);
//r = int(red(image.pixels[y*w+x]));
//g = int(green(image.pixels[y*w+x]));
View
19 acw.pde
@@ -18,19 +18,19 @@ int TYPICAL_MODE_TIME = 300;
Routine[] enabledRoutines = new Routine[] {
// new Greetz(),
- // new Bursts(),
+// new Bursts(),
// new FlashColors(), /* rainbow */
- new Flash(), /* seizure mode */
- // new Lines(), /* boring */
+// new Flash(), /* seizure mode */
+// new Lines(), /* boring */
// new OppositeLines(), /* boring */
// new Waves(), /* ? */
- new HorizonScan(),
+// new HorizonScan(),
// new RadialStars(),
// new NightSky(),
// new TargetScanner(),
- // new Waterfalls(),
+// new Waterfalls(),
// new RGBRoutine(),
- // new FFTDemo(),
+ new FFTDemo(),
// new FollowMouse()
};
@@ -46,23 +46,24 @@ int direction = 1;
int position = 0;
Routine currentRoutine = null;
-Dacwes dacwes;
+Sculpture dacwes;
PGraphics fadeLayer;
int fadeOutFrames = 0;
int fadeInFrames = 0;
WiiController controller;
+boolean isRGB = false;
void setup() {
// Had to enable OPENGL for some reason new fonts don't work in JAVA2D.
size(WIDTH,HEIGHT);
frameRate(FRAMERATE);
- dacwes = new Dacwes(this, WIDTH, HEIGHT);
+ dacwes = new Sculpture(this, WIDTH, HEIGHT, false);
dacwes.setAddress(hostname);
- dacwes.setAddressingMode(Dacwes.ADDRESSING_HORIZONTAL_NORMAL);
+ dacwes.setAddressingMode(Sculpture.ADDRESSING_VERTICAL_FLIPFLOP);
setMode(0);

0 comments on commit 0a80936

Please sign in to comment.