Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added color pickers.

  • Loading branch information...
commit 7231d7875633ae2d7b05572655e8b8afb7fbcc2b 1 parent 4670ee1
Johan authored
View
24 dmxcontrol/controlui.pde
@@ -3,6 +3,9 @@ ControlP5 controlP5;
Range[] thresholdRanges = new Range[group_num];
+ColorPicker peakCP;
+ColorPicker normalCP;
+
void setupControlInterface() {
controlP5 = new ControlP5(this);
@@ -44,6 +47,26 @@ void setupControlInterface() {
controlP5.end();
}
+
+ ControlGroup peakOut = controlP5.addGroup("Peak Output", 10, 80);
+ controlP5.begin(0,10);
+
+ peakCP = controlP5.addColorPicker("peak color",0,10,255,20);
+ peakCP.setGroup(peakOut);
+
+ controlP5.end();
+
+ ControlGroup normalOut = controlP5.addGroup("Normal Output", 10, 170);
+ controlP5.begin(0,10);
+
+ normalCP = controlP5.addColorPicker("normal color",0,10,255,20);
+ normalCP.setGroup(normalOut);
+
+ controlP5.end();
+
+
+
+
}
void controlEvent(ControlEvent theEvent) {
@@ -92,7 +115,6 @@ void controlEvent(ControlEvent theEvent) {
}
uiThresholdForceUpdate = false;
-
}
}
View
23 dmxcontrol/dmxcontrol.pde
@@ -19,6 +19,9 @@ Minim minim;
AudioInput in;
FFT fft;
+int[] peakColor = new int[3];
+int[] normalColor = new int[3];
+
import processing.serial.*; // Import Serial library to talk to Arduino
import processing.opengl.*; // Import OpenGL to draw a gradient window
@@ -160,15 +163,29 @@ void draw() {
rect(i*w + width/2, height-100, i*w + w + width/2, height - 100 - lightValues[i]);
}
+ //normalColor = normalCP.getColorValue();
+
+
+
for(int i = 0; i < group_num; i++)
- {
+ {
+ int cc = 1;
+ float intensity = 1;
+
if (lightValues[i]/255*100 > 90) {
- setColor(255 - int(lightValues[i]), 0, int(lightValues[i]), i);
+
+ intensity = alpha(peakCP.getColorValue()) / 255 * lightValues[i];
+ cc = peakCP.getColorValue();
+
} else if (lightValues[i]/255*100 < 1) {
} else {
- setColor(int(lightValues[i]), 0, 0, i);
+
+ intensity = alpha(normalCP.getColorValue()) / 255 * lightValues[i];
+ cc = normalCP.getColorValue();
+
}
+ setColor(red(cc), green(cc), blue(cc), i, intensity);
}
View
7 dmxcontrol/dmxutils.pde
@@ -4,9 +4,10 @@ void setDmxChannel(int channel, int value) {
myPort.write( str(channel) + "c" + str(value) + "w" );
}
-void setColor(int r, int g, int b, int lampGroup) {
- int rgb[] = {r, g, b};
+void setColor(float r, float g, float b, int lampGroup, float intensity) {
+ float rgb[] = {r, g, b};
for (int i = 0; i < 3; i++) {
- setDmxChannel(lampGroups[lampGroup] + i, rgb[i]);
+ rgb[i] = rgb[i]/255*intensity;
+ setDmxChannel(lampGroups[lampGroup] + i, int(rgb[i]));
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.