X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=blobdiff_plain;f=Internals.pde;h=3c1c603f18ba7d3c4d33e67be8eb471a06714776;hp=b593f3ef07b9c4aa7db088430348d3da9c653ae7;hb=e0b9d8726c661f54f47340449037ac7f6b410de6;hpb=7d60f6f6ea82fd5c9794524ce11d40e7d6c00bf7 diff --git a/Internals.pde b/Internals.pde index b593f3e..3c1c603 100644 --- a/Internals.pde +++ b/Internals.pde @@ -29,6 +29,7 @@ import ddf.minim.analysis.*; import processing.opengl.*; import rwmidi.*; import java.lang.reflect.*; +import java.net.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -56,7 +57,7 @@ Effects effects; LXEffect[] effectsArr; DiscreteParameter selectedEffect; MappingTool mappingTool; -GrizzlyOutput[] grizzlies; +IPOutput[] outputs = {}; PresetManager presetManager; MidiEngine midiEngine; @@ -64,6 +65,7 @@ MidiEngine midiEngine; boolean mappingMode = false; boolean debugMode = false; boolean simulationOn = true; +boolean structureOn = false; boolean diagnosticsOn = false; LXPattern restoreToPattern = null; PImage logo; @@ -134,7 +136,6 @@ void setup() { size(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, OPENGL); frameRate(targetFramerate); noSmooth(); - // hint(ENABLE_OPENGL_4X_SMOOTH); // no discernable improvement? logTime("Created viewport"); // Create the model @@ -171,16 +172,15 @@ void setup() { logTime("Setup MIDI devices"); // Build output driver - grizzlies = new GrizzlyOutput[]{}; try { - grizzlies = buildGrizzlies(); - for (LXOutput output : grizzlies) { + outputs = buildOutputs(); + for (LXOutput output : outputs) { lx.addOutput(output); } } catch (Exception x) { x.printStackTrace(); } - logTime("Built Grizzly Outputs"); + logTime("Built Grizzly + Panda Outputs"); // Mapping tool mappingTool = new MappingTool(lx); @@ -203,7 +203,7 @@ void setup() { // Right controls new UIPatternDeck(lx.ui, lx.engine.getDeck(RIGHT_DECK), "PATTERN B", width-144, 4, 140, 324), uiMidi = new UIMidi(midiEngine, width-144, 332, 140, 158), - new UIOutput(grizzlies, width-144, 494, 140, 106), + new UIOutput(outputs, width-144, 494, 140, 106), // Crossfader uiCrossfader = new UICrossfader(width/2-90, height-90, 180, 86), @@ -224,6 +224,9 @@ void setup() { println("Total setup: " + (millis() - startMillis) + "ms"); println("Hit the 'o' key to toggle live output"); + + lx.engine.framesPerSecond.setValue(60); + lx.engine.setThreaded(true); } public SCPattern getPattern() { @@ -360,7 +363,7 @@ void drawDiagnostics(long drawNanos, long simulationNanos, long uiNanos, long ga noStroke(); int xp = x; float hv = 0; - for (long val : new long[] {lx.timer.drawNanos, simulationNanos, uiNanos, gammaNanos, lx.timer.outputNanos }) { + for (long val : new long[] {lx.timer.drawNanos, simulationNanos, uiNanos, gammaNanos, lx.engine.timer.outputNanos }) { fill(lx.hsb(hv % 360, 100, 80)); rect(xp, y, val * ws, h-1); hv += 140; @@ -500,7 +503,7 @@ void keyPressed() { break; case 'o': case 'p': - for (LXOutput output : grizzlies) { + for (LXOutput output : outputs) { output.enabled.toggle(); } break; @@ -514,6 +517,11 @@ void keyPressed() { simulationOn = !simulationOn; } break; + case 'S': + if (!midiEngine.isQwertyEnabled()) { + structureOn = !structureOn; + } + break; } }