X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=_Internals.pde;h=f809e9389bc9159b838c128e51a7fb960393e98a;hb=207911097b63d6a40af8f006973e74bf4d052c31;hp=79d12e5574bd631b284ca351ce3196036c0cc876;hpb=2b068dd5d83e070da10318a9ab4017a7ce86d2ca;p=SugarCubes.git diff --git a/_Internals.pde b/_Internals.pde index 79d12e5..f809e93 100644 --- a/_Internals.pde +++ b/_Internals.pde @@ -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; @@ -49,6 +50,7 @@ int startMillis, lastMillis; GLucose glucose; HeronLX lx; LXPattern[] patterns; +Effects effects; MappingTool mappingTool; PandaDriver[] pandaBoards; PresetManager presetManager; @@ -100,7 +102,19 @@ LXPattern[] _rightPatterns(GLucose glucose) { } return rightPatterns; } - + +LXEffect[] _effectsArray(Effects effects) { + List effectList = new ArrayList(); + 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 +145,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 @@ -208,9 +222,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 +485,7 @@ void keyPressed() { frameRate(++targetFramerate); break; case 'b': - EFF_boom.trigger(); + effects.boom.trigger(); break; case 'd': if (!midiEngine.isQwertyEnabled()) {