sinesphere multiple projections working and arctan working
[SugarCubes.git] / _Internals.pde
index 79d12e5574bd631b284ca351ce3196036c0cc876..cdd4ba5ac64d755b4665fc4f5070e2b15b48fb72 100644 (file)
@@ -30,6 +30,7 @@ import ddf.minim.*;
 import ddf.minim.analysis.*;
 import processing.opengl.*;
 import rwmidi.*;
+import java.lang.reflect.*;
 
 final int VIEWPORT_WIDTH = 900;
 final int VIEWPORT_HEIGHT = 700;
@@ -39,8 +40,8 @@ final float TRAILER_WIDTH = 240;
 final float TRAILER_DEPTH = 97;
 final float TRAILER_HEIGHT = 33;
 
-final int MaxCubeHeight = 5;
-final int NumBackTowers = 11;
+final int MaxCubeHeight = 7;
+final int NumBackTowers = 18;
 
 int targetFramerate = 60;
 int startMillis, lastMillis;
@@ -49,6 +50,7 @@ int startMillis, lastMillis;
 GLucose glucose;
 HeronLX lx;
 LXPattern[] patterns;
+Effects effects;
 MappingTool mappingTool;
 PandaDriver[] pandaBoards;
 PresetManager presetManager;
@@ -70,6 +72,7 @@ UICrossfader uiCrossfader;
 UIMidi uiMidi;
 UIMapping uiMapping;
 UIDebugText uiDebugText;
+UISpeed uiSpeed;
 
 // Camera variables
 float eyeR, eyeA, eyeX, eyeY, eyeZ, midX, midY, midZ;
@@ -100,7 +103,19 @@ LXPattern[] _rightPatterns(GLucose glucose) {
   }
   return rightPatterns;
 }
-  
+
+LXEffect[] _effectsArray(Effects effects) {
+  List<LXEffect> effectList = new ArrayList<LXEffect>();
+  for (Field f : effects.getClass().getDeclaredFields()) {
+    try {
+      Object val = f.get(effects);
+      if (val instanceof LXEffect) {
+        effectList.add((LXEffect)val);
+      }
+    } catch (IllegalAccessException iax) {}
+  }
+  return effectList.toArray(new LXEffect[]{});
+} 
 
 void logTime(String evt) {
   int now = millis();
@@ -131,7 +146,7 @@ void setup() {
   logTime("Built patterns");
   glucose.setTransitions(transitions(glucose));
   logTime("Built transitions");
-  glucose.lx.addEffects(effects(glucose));
+  glucose.lx.addEffects(_effectsArray(effects = new Effects()));
   logTime("Built effects");
 
   // Preset manager
@@ -159,7 +174,7 @@ void setup() {
     new UIBlendMode(4, 332, 140, 86),
     new UIEffects(4, 422, 140, 144),
     new UITempo(4, 570, 140, 50),
-    new UISpeed(4, 624, 140, 50),
+    uiSpeed = new UISpeed(4, 624, 140, 50),
         
     new UIPatternDeck(lx.engine.getDeck(GLucose.RIGHT_DECK), "PATTERN B", width-144, 4, 140, 324),
     uiMidi = new UIMidi(midiEngine, width-144, 332, 140, 158),
@@ -208,9 +223,9 @@ void draw() {
   simulationColors = sendColors = glucose.getColors();
   String displayMode = uiCrossfader.getDisplayMode();
   if (displayMode == "A") {
-    simulationColors = lx.engine.getDeck(0).getColors();
+    simulationColors = lx.engine.getDeck(GLucose.LEFT_DECK).getColors();
   } else if (displayMode == "B") {
-    simulationColors = lx.engine.getDeck(1).getColors();
+    simulationColors = lx.engine.getDeck(GLucose.RIGHT_DECK).getColors();
   }
   if (debugMode) {
     debugUI.maskColors(simulationColors);
@@ -471,7 +486,7 @@ void keyPressed() {
       frameRate(++targetFramerate);
       break; 
     case 'b':
-      EFF_boom.trigger();
+      effects.boom.trigger();
       break;    
     case 'd':
       if (!midiEngine.isQwertyEnabled()) {