2 * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND
5 * ///\\\ ///\\\ ///\\\ ///\\\
6 * \\\/// \\\/// \\\/// \\\///
9 * EXPERTS ONLY!! EXPERTS ONLY!!
11 * If you are an artist, you may ignore this file! It just sets
12 * up the framework to run the patterns. Should not need modification
13 * for general animation work.
17 import glucose.control.*;
18 import glucose.effect.*;
19 import glucose.model.*;
20 import glucose.pattern.*;
21 import glucose.transform.*;
22 import glucose.transition.*;
23 import heronarts.lx.*;
24 import heronarts.lx.control.*;
25 import heronarts.lx.effect.*;
26 import heronarts.lx.modulator.*;
27 import heronarts.lx.pattern.*;
28 import heronarts.lx.transition.*;
30 import ddf.minim.analysis.*;
31 import processing.opengl.*;
32 import java.lang.reflect.*;
35 final int VIEWPORT_WIDTH = 900;
36 final int VIEWPORT_HEIGHT = 700;
37 final int TARGET_FRAMERATE = 45;
39 int startMillis, lastMillis;
43 LXTransition[] transitions;
47 boolean debugMode = false;
50 startMillis = lastMillis = millis();
52 // Initialize the Processing graphics environment
53 size(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, OPENGL);
54 frameRate(TARGET_FRAMERATE);
56 // hint(ENABLE_OPENGL_4X_SMOOTH); // no discernable improvement?
57 logTime("Created viewport");
59 // Create the GLucose engine to run the cubes
60 glucose = new GLucose(this, new SCMapping());
62 lx.enableKeyboardTempo();
63 logTime("Built GLucose engine");
66 glucose.lx.setPatterns(patterns = patterns(glucose));
67 logTime("Built patterns");
68 glucose.lx.addEffects(effects = effects(glucose));
69 logTime("Built effects");
70 glucose.setTransitions(transitions = transitions(glucose));
71 logTime("Built transitions");
75 logTime("Built overlay UI");
78 for (MidiInputDevice d : RWMidi.getInputDevices()) {
81 SCMidiDevices.initializeStandardDevices(glucose);
82 logTime("Setup MIDI devices");
84 println("Total setup: " + (millis() - startMillis) + "ms");
87 void controllerChangeReceived(rwmidi.Controller cc) {
89 println("CC: " + cc.toString());
93 void noteOnReceived(Note note) {
95 println("Note On: " + note.toString());
99 void noteOffReceived(Note note) {
101 println("Note Off: " + note.toString());
105 void logTime(String evt) {
107 println(evt + ": " + (now - lastMillis) + "ms");
112 // The glucose engine deals with the core simulation here, we don't need
113 // to do anything specific. This method just needs to exist.
126 boolean knobsOn = true;
130 debugMode = !debugMode;
131 println("Debug output: " + (debugMode ? "ON" : "OFF"));