Pandaboard support for new 15-cubes in tandem with Grizzly
[SugarCubes.git] / Internals.pde
index 31f8ffcb4b90c27c750f3c59ff5efed0350b00f2..3c1c603f18ba7d3c4d33e67be8eb471a06714776 100644 (file)
@@ -29,6 +29,7 @@ import ddf.minim.analysis.*;
 import processing.opengl.*;
 import rwmidi.*;
 import java.lang.reflect.*;
+import java.net.*;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -56,7 +57,7 @@ Effects effects;
 LXEffect[] effectsArr;
 DiscreteParameter selectedEffect;
 MappingTool mappingTool;
-GrizzlyOutput[] grizzlies;
+IPOutput[] outputs = {};
 PresetManager presetManager;
 MidiEngine midiEngine;
 
@@ -64,6 +65,7 @@ MidiEngine midiEngine;
 boolean mappingMode = false;
 boolean debugMode = false;
 boolean simulationOn = true;
+boolean structureOn = false;
 boolean diagnosticsOn = false;
 LXPattern restoreToPattern = null;
 PImage logo;
@@ -170,16 +172,15 @@ void setup() {
   logTime("Setup MIDI devices");
 
   // Build output driver
-  grizzlies = new GrizzlyOutput[]{};
   try {
-    grizzlies = buildGrizzlies();
-    for (LXOutput output : grizzlies) {
+    outputs = buildOutputs();
+    for (LXOutput output : outputs) {
       lx.addOutput(output);
     }
   } catch (Exception x) {
     x.printStackTrace();
   }
-  logTime("Built Grizzly Outputs");
+  logTime("Built Grizzly + Panda Outputs");
 
   // Mapping tool
   mappingTool = new MappingTool(lx);
@@ -202,7 +203,7 @@ void setup() {
     // Right controls
     new UIPatternDeck(lx.ui, lx.engine.getDeck(RIGHT_DECK), "PATTERN B", width-144, 4, 140, 324),
     uiMidi = new UIMidi(midiEngine, width-144, 332, 140, 158),
-    new UIOutput(grizzlies, width-144, 494, 140, 106),
+    new UIOutput(outputs, width-144, 494, 140, 106),
     
     // Crossfader
     uiCrossfader = new UICrossfader(width/2-90, height-90, 180, 86),
@@ -224,7 +225,7 @@ void setup() {
   println("Total setup: " + (millis() - startMillis) + "ms");
   println("Hit the 'o' key to toggle live output");
   
-  lx.engine.framesPerSecond.setValue(120);
+  lx.engine.framesPerSecond.setValue(60);
   lx.engine.setThreaded(true);
 }
 
@@ -502,7 +503,7 @@ void keyPressed() {
       break;
     case 'o':
     case 'p':
-      for (LXOutput output : grizzlies) {
+      for (LXOutput output : outputs) {
         output.enabled.toggle();
       }
       break;
@@ -516,6 +517,11 @@ void keyPressed() {
         simulationOn = !simulationOn;
       }
       break;
+    case 'S':
+      if (!midiEngine.isQwertyEnabled()) {
+        structureOn = !structureOn;
+      }
+      break;
   }
 }