X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=_Internals.pde;h=46c39390dcf93ac1dfe29deaee243eba0c36efa5;hb=cc9fcf4be00a99376a2083ddfbcf589f94ee6785;hp=a103f13ace4630df806fb6b3f67dcc26f7686926;hpb=1ecdb44ad45fb86834e9dfcadce6cbff751ad484;p=SugarCubes.git diff --git a/_Internals.pde b/_Internals.pde index a103f13..46c3939 100644 --- a/_Internals.pde +++ b/_Internals.pde @@ -44,6 +44,8 @@ LXTransition[] transitions; LXEffect[] effects; OverlayUI ui; +boolean debugMode = false; + void setup() { startMillis = lastMillis = millis(); @@ -57,6 +59,7 @@ void setup() { // Create the GLucose engine to run the cubes glucose = new GLucose(this, new SCMapping()); lx = glucose.lx; + lx.enableKeyboardTempo(); logTime("Built GLucose engine"); // Set the patterns @@ -64,7 +67,7 @@ void setup() { logTime("Built patterns"); glucose.lx.addEffects(effects = effects(glucose)); logTime("Built effects"); - transitions = transitions(glucose); + glucose.setTransitions(transitions = transitions(glucose)); logTime("Built transitions"); // Build overlay UI @@ -72,12 +75,33 @@ void setup() { logTime("Built overlay UI"); // MIDI devices - SCMidiDevices.initializeStandardDevices(glucose, ui.patternKnobs, ui.transitionKnobs, ui.effectKnobs); + for (MidiInputDevice d : RWMidi.getInputDevices()) { + d.createInput(this); + } + SCMidiDevices.initializeStandardDevices(glucose); logTime("Setup MIDI devices"); println("Total setup: " + (millis() - startMillis) + "ms"); } +void controllerChangeReceived(rwmidi.Controller cc) { + if (debugMode) { + println("CC: " + cc.toString()); + } +} + +void noteOnReceived(Note note) { + if (debugMode) { + println("Note On: " + note.toString()); + } +} + +void noteOffReceived(Note note) { + if (debugMode) { + println("Note Off: " + note.toString()); + } +} + void logTime(String evt) { int now = millis(); println(evt + ": " + (now - lastMillis) + "ms"); @@ -102,12 +126,13 @@ boolean uiOn = true; boolean knobsOn = true; void keyPressed() { switch (key) { + case 'd': + debugMode = !debugMode; + println("Debug output: " + (debugMode ? "ON" : "OFF")); + break; case 'u': uiOn = !uiOn; break; - case 'k': - knobsOn = !knobsOn; - break; } }