From: Mark Slee Date: Wed, 26 Feb 2014 02:01:08 +0000 (-0800) Subject: Remove transition management from glucose X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=commitdiff_plain;h=3f16fd027656eaca0ed62f9c90c4da56385bb3bf Remove transition management from glucose --- diff --git a/DanKaminsky.pde b/DanKaminsky.pde index c94b573..88fd543 100644 --- a/DanKaminsky.pde +++ b/DanKaminsky.pde @@ -7,7 +7,7 @@ class GenericController { if(p!=null) { p.setValue(val); } } if(type==1) { - p = glucose.getSelectedTransition().getParameters().get(num); + p = lx.engine.getDeck(RIGHT_DECK).getFaderTransition().getParameters().get(num); if(p!=null) { p.setValue(val); } } if(type==2) { diff --git a/_Internals.pde b/_Internals.pde index 100607a..0ee146d 100644 --- a/_Internals.pde +++ b/_Internals.pde @@ -34,13 +34,16 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -final int VIEWPORT_WIDTH = 900; -final int VIEWPORT_HEIGHT = 700; +static final int VIEWPORT_WIDTH = 900; +static final int VIEWPORT_HEIGHT = 700; + +static final int LEFT_DECK = 0; +static final int RIGHT_DECK = 1; // The trailer is measured from the outside of the black metal (but not including the higher welded part on the front) -final float TRAILER_WIDTH = 192; -final float TRAILER_DEPTH = 192; -final float TRAILER_HEIGHT = 33; +static final float TRAILER_WIDTH = 192; +static final float TRAILER_DEPTH = 192; +static final float TRAILER_HEIGHT = 33; int targetFramerate = 60; int startMillis, lastMillis; @@ -50,6 +53,8 @@ GLucose glucose; LX lx; Model model; LXPattern[] patterns; +LXTransition[] transitions; +DiscreteParameter activeTransition; Effects effects; MappingTool mappingTool; GrizzlyOutput[] grizzlies; @@ -140,8 +145,19 @@ void setup() { engine.setPatterns(patterns = _leftPatterns(lx)); engine.addDeck(_rightPatterns(lx)); logTime("Built patterns"); - glucose.setTransitions(transitions(lx)); + + // Transitions + transitions = transitions(lx); + activeTransition = new DiscreteParameter("TRANSITION", transitions.length); + activeTransition.addListener(new LXParameterListener() { + public void onParameterChanged(LXParameter parameter) { + lx.engine.getDeck(RIGHT_DECK).setFaderTransition(transitions[activeTransition.getValuei()]); + } + }); + lx.engine.getDeck(RIGHT_DECK).setFaderTransition(transitions[activeTransition.getValuei()]); logTime("Built transitions"); + + // Effects glucose.lx.addEffects(_effectsArray(effects = new Effects())); logTime("Built effects"); diff --git a/_UIImplementation.pde b/_UIImplementation.pde index 3f0c630..1257f6f 100644 --- a/_UIImplementation.pde +++ b/_UIImplementation.pde @@ -15,8 +15,9 @@ class UIBlendMode extends UIWindow { public UIBlendMode(float x, float y, float w, float h) { super(lx.ui, "BLEND MODE", x, y, w, h); List items = new ArrayList(); - for (LXTransition t : glucose.getTransitions()) { - items.add(new TransitionScrollItem(t)); + int i = 0; + for (LXTransition t : transitions) { + items.add(new TransitionScrollItem(t, i++)); } final UIScrollList tList; (tList = new UIScrollList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 60)).setItems(items).addToContainer(this); @@ -30,11 +31,13 @@ class UIBlendMode extends UIWindow { class TransitionScrollItem extends UIScrollList.AbstractItem { private final LXTransition transition; - private String label; + private final int index; + private final String label; - TransitionScrollItem(LXTransition transition) { + TransitionScrollItem(LXTransition transition, int index) { this.transition = transition; - label = className(transition, "Transition"); + this.index = index; + this.label = className(transition, "Transition"); } public String getLabel() { @@ -42,7 +45,7 @@ class UIBlendMode extends UIWindow { } public boolean isSelected() { - return transition == glucose.getSelectedTransition(); + return index == activeTransition.getValuei(); } public boolean isPending() { @@ -50,7 +53,7 @@ class UIBlendMode extends UIWindow { } public void onMousePressed() { - glucose.setSelectedTransition(transition); + activeTransition.setValue(this.index); } } diff --git a/code/GLucose.jar b/code/GLucose.jar index 1920a31..e1b6aa6 100755 Binary files a/code/GLucose.jar and b/code/GLucose.jar differ diff --git a/code/HeronLX.jar b/code/HeronLX.jar index d57c4d4..7c388a7 100755 Binary files a/code/HeronLX.jar and b/code/HeronLX.jar differ