}
// Handles to globally triggerable effects
-BoomEffect EFF_boom;
-FlashEffect EFF_flash;
-ColorFuckerEffect EFF_colorFucker;
-BlurEffect EFF_blur;
-QuantizeEffect EFF_quantize;
-
-LXEffect[] effects(GLucose glucose) {
- return new LXEffect[] {
- EFF_flash = new FlashEffect(lx),
- EFF_boom = new BoomEffect(glucose),
- (EFF_blur = new BlurEffect(glucose)).enable(),
- (EFF_quantize = new QuantizeEffect(glucose)).enable(),
- (EFF_colorFucker = new ColorFuckerEffect(glucose)).enable(),
- };
+class Effects {
+ FlashEffect flash = new FlashEffect(lx);
+ BoomEffect boom = new BoomEffect(glucose);
+ BlurEffect blur = new BlurEffect(glucose);
+ QuantizeEffect quantize = new QuantizeEffect(glucose);
+ ColorFuckerEffect colorFucker = new ColorFuckerEffect(glucose);
+
+ Effects() {
+ blur.enable();
+ quantize.enable();
+ colorFucker.enable();
+ }
}
+
import ddf.minim.analysis.*;
import processing.opengl.*;
import rwmidi.*;
+import java.lang.reflect.*;
final int VIEWPORT_WIDTH = 900;
final int VIEWPORT_HEIGHT = 700;
GLucose glucose;
HeronLX lx;
LXPattern[] patterns;
+Effects effects;
MappingTool mappingTool;
PandaDriver[] pandaBoards;
PresetManager presetManager;
}
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();
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
frameRate(++targetFramerate);
break;
case 'b':
- EFF_boom.trigger();
+ effects.boom.trigger();
break;
case 'd':
if (!midiEngine.isQwertyEnabled()) {
case 7:
switch (channel) {
case 0:
- EFF_colorFucker.hueShift.setValue(value);
+ effects.colorFucker.hueShift.setValue(value);
return true;
case 1:
- EFF_colorFucker.desat.setValue(value);
+ effects.colorFucker.desat.setValue(value);
return true;
case 2:
- EFF_colorFucker.sharp.setValue(value);
+ effects.colorFucker.sharp.setValue(value);
return true;
case 3:
- EFF_blur.amount.setValue(value);
+ effects.blur.amount.setValue(value);
return true;
case 4:
- EFF_quantize.amount.setValue(value);
+ effects.quantize.amount.setValue(value);
return true;
}
break;
// Master bright
case 14:
- EFF_colorFucker.level.setValue(value);
+ effects.colorFucker.level.setValue(value);
return true;
// Crossfader
case 49: // SOLO/CUE
switch (nChan) {
case 4:
- EFF_colorFucker.mono.setValue(1);
+ effects.colorFucker.mono.setValue(1);
return true;
case 5:
- EFF_colorFucker.invert.setValue(1);
+ effects.colorFucker.invert.setValue(1);
return true;
case 6:
lx.cycleBaseHue(60000);
break;
case 82: // scene 1
- EFF_boom.trigger();
+ effects.boom.trigger();
return true;
case 83: // scene 2
- EFF_flash.trigger();
+ effects.flash.trigger();
return true;
case 90:
case 49: // SOLO/CUE
switch (nChan) {
case 4:
- EFF_colorFucker.mono.setValue(0);
+ effects.colorFucker.mono.setValue(0);
return true;
case 5:
- EFF_colorFucker.invert.setValue(0);
+ effects.colorFucker.invert.setValue(0);
return true;
case 6:
lx.setBaseHue(lx.getBaseHue());