/**
+ * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND
+ *
+ * //\\ //\\ //\\ //\\
+ * ///\\\ ///\\\ ///\\\ ///\\\
+ * \\\/// \\\/// \\\/// \\\///
+ * \\// \\// \\// \\//
+ *
+ * EXPERTS ONLY!! EXPERTS ONLY!!
+ *
* If you are an artist, you may ignore this file! It just sets
* up the framework to run the patterns. Should not need modification
* for general animation work.
import ddf.minim.*;
import ddf.minim.analysis.*;
import processing.opengl.*;
-import java.lang.reflect.*;
import rwmidi.*;
final int VIEWPORT_WIDTH = 900;
LXTransition[] transitions;
LXEffect[] effects;
OverlayUI ui;
+PandaDriver pandaFront;
+PandaDriver pandaRear;
+
+boolean pandaBoardsEnabled = false;
void setup() {
startMillis = lastMillis = millis();
logTime("Created viewport");
// Create the GLucose engine to run the cubes
- glucose = new GLucose(this);
+ glucose = new GLucose(this, new SCMapping());
lx = glucose.lx;
logTime("Built GLucose engine");
logTime("Built effects");
transitions = transitions(glucose);
logTime("Built transitions");
+
+ // Build output driver
+ int[][] frontChannels = glucose.mapping.buildFrontChannelList();
+ int[][] rearChannels = glucose.mapping.buildRearChannelList();
+ int[][] flippedRGB = glucose.mapping.buildFlippedRGBList();
+ pandaFront = new PandaDriver(new NetAddress("192.168.1.28", 9001), glucose.model, frontChannels, flippedRGB);
+ pandaRear = new PandaDriver(new NetAddress("192.168.1.29", 9001), glucose.model, rearChannels, flippedRGB);
+ logTime("Build PandaDriver");
// Build overlay UI
ui = new OverlayUI();
logTime("Built overlay UI");
-
+
// MIDI devices
SCMidiDevices.initializeStandardDevices(glucose, ui.patternKnobs, ui.transitionKnobs, ui.effectKnobs);
logTime("Setup MIDI devices");
println("Total setup: " + (millis() - startMillis) + "ms");
+ println("Hit the 'p' key to toggle Panda Board output");
}
void logTime(String evt) {
void draw() {
// The glucose engine deals with the core simulation here, we don't need
// to do anything specific. This method just needs to exist.
+
+ // TODO(mcslee): move into GLucose engine
+ if (pandaBoardsEnabled) {
+ color[] colors = glucose.getColors();
+ pandaFront.send(colors);
+ pandaRear.send(colors);
+ }
}
void drawUI() {
boolean knobsOn = true;
void keyPressed() {
switch (key) {
+ case 'p':
+ pandaBoardsEnabled = !pandaBoardsEnabled;
+ println("PandaBoard Output: " + (pandaBoardsEnabled ? "ON" : "OFF"));
+ break;
case 'u':
uiOn = !uiOn;
break;