double dflt;
DParam (String label, double value) { super(label,value); dflt=value; }
void set (double value) { super.setValue(value); }
- void reset () { super.setValue(dflt); }
float Val () { return getValuef(); }
}
//----------------------------------------------------------------------------------------------------------------------------------
logTime("Built GLucose engine");
// Set the patterns
- Engine engine = lx.engine;
+ LXEngine engine = lx.engine;
engine.setPatterns(patterns = _leftPatterns(glucose));
engine.addDeck(_rightPatterns(glucose));
logTime("Built patterns");
// Build overlay UI
debugUI = new DebugUI(pandaMappings);
overlays = new UIContext[] {
- uiPatternA = new UIPatternDeck(lx.engine.getDeck(0), "PATTERN A", 4, 4, 140, 324),
+ uiPatternA = new UIPatternDeck(lx.engine.getDeck(GLucose.LEFT_DECK), "PATTERN A", 4, 4, 140, 324),
new UIBlendMode(4, 332, 140, 86),
new UIEffects(4, 422, 140, 144),
new UITempo(4, 570, 140, 50),
new UISpeed(4, 624, 140, 50),
- new UIPatternDeck(lx.engine.getDeck(1), "PATTERN B", width-144, 4, 140, 324),
+ new UIPatternDeck(lx.engine.getDeck(GLucose.RIGHT_DECK), "PATTERN B", width-144, 4, 140, 324),
uiMidi = new UIMidi(midiEngine, width-144, 332, 140, 158),
new UIOutput(width-144, 494, 140, 106),
return this.midiControllers;
}
- public Engine.Deck getFocusedDeck() {
+ public LXDeck getFocusedDeck() {
return lx.engine.getDeck(activeDeckIndex);
}
private boolean shiftOn = false;
private LXEffect releaseEffect = null;
- final private Engine.Deck targetDeck;
+ final private LXDeck targetDeck;
APC40MidiInput(MidiEngine midiEngine, MidiInputDevice d) {
this(midiEngine, d, -1);
targetDeck = (deckIndex < 0) ? null : lx.engine.getDecks().get(deckIndex);
}
- protected Engine.Deck getTargetDeck() {
+ protected LXDeck getTargetDeck() {
return (targetDeck != null) ? targetDeck : midiEngine.getFocusedDeck();
}
// Crossfader
case 15:
- lx.engine.getDeck(1).getCrossfader().setValue(value);
+ lx.engine.getDeck(GLucose.RIGHT_DECK).getFader().setValue(value);
break;
}
private final MidiOutput output;
private LXPattern focusedPattern = null;
private LXEffect focusedEffect = null;
- private final Engine.Deck targetDeck;
+ private final LXDeck targetDeck;
APC40MidiOutput(MidiEngine midiEngine, MidiOutputDevice device) {
this(midiEngine, device, -1);
resetEffectParameters();
}
});
- Engine.Listener deckListener = new Engine.AbstractListener() {
- public void patternDidChange(Engine.Deck deck, LXPattern pattern) {
+ LXDeck.Listener deckListener = new LXDeck.AbstractListener() {
+ public void patternDidChange(LXDeck deck, LXPattern pattern) {
resetPatternParameters();
}
};
- for (Engine.Deck d : lx.engine.getDecks()) {
+ for (LXDeck d : lx.engine.getDecks()) {
if (targetDeck == null || d == targetDeck) {
d.addListener(deckListener);
}
}
presetManager.addListener(new PresetListener() {
- public void onPresetLoaded(Engine.Deck deck, Preset preset) {
+ public void onPresetLoaded(LXDeck deck, Preset preset) {
if (deck == getTargetDeck()) {
for (int i = 0; i < 8; ++i) {
output.sendNoteOn(i, 52, (preset.index == i) ? 1 : 0);
}
}
}
- public void onPresetDirty(Engine.Deck deck, Preset preset) {
+ public void onPresetDirty(LXDeck deck, Preset preset) {
if (deck == getTargetDeck()) {
output.sendNoteOn(preset.index, 52, 2);
}
}
- public void onPresetStored(Engine.Deck deck, Preset preset) {
+ public void onPresetStored(LXDeck deck, Preset preset) {
if (deck == getTargetDeck()) {
onPresetLoaded(deck, preset);
}
}
private void setDPatternOutputs() {
- for (Engine.Deck deck : lx.engine.getDecks()) {
+ for (LXDeck deck : lx.engine.getDecks()) {
if (targetDeck == null || deck == targetDeck) {
for (LXPattern pattern : deck.getPatterns()) {
if (pattern instanceof DPat) {
}
}
- protected Engine.Deck getTargetDeck() {
+ protected LXDeck getTargetDeck() {
if (targetDeck != null) {
return targetDeck;
}
interface PresetListener {
- public void onPresetLoaded(Engine.Deck deck, Preset preset);
- public void onPresetDirty(Engine.Deck deck, Preset preset);
- public void onPresetStored(Engine.Deck deck, Preset preset);
+ public void onPresetLoaded(LXDeck deck, Preset preset);
+ public void onPresetDirty(LXDeck deck, Preset preset);
+ public void onPresetStored(LXDeck deck, Preset preset);
public void onPresetUnloaded();
}
}
}
}
- for (Engine.Deck deck : lx.engine.getDecks()) {
- deck.addListener(new Engine.AbstractListener() {
- public void patternDidChange(Engine.Deck deck, LXPattern pattern) {
+ for (LXDeck deck : lx.engine.getDecks()) {
+ deck.addListener(new LXDeck.AbstractListener() {
+ public void patternDidChange(LXDeck deck, LXPattern pattern) {
if (pattern != loadedPattern) {
onPresetDirty(deck);
}
listeners.add(listener);
}
- public Engine.Deck deckForPattern(LXPattern pattern) {
- for (Engine.Deck deck : lx.engine.getDecks()) {
+ public LXDeck deckForPattern(LXPattern pattern) {
+ for (LXDeck deck : lx.engine.getDecks()) {
for (LXPattern p : deck.getPatterns()) {
if (p == pattern) {
return deck;
onPresetDirty(deckForPattern(pattern));
}
- public void select(Engine.Deck deck, int index) {
+ public void select(LXDeck deck, int index) {
presets[index].select(deck);
}
- public void store(Engine.Deck deck, int index) {
+ public void store(LXDeck deck, int index) {
presets[index].store(midiEngine.getFocusedPattern());
for (PresetListener listener : listeners) {
listener.onPresetStored(deck, presets[index]);
select(deck, index);
}
- public void onPresetLoaded(Engine.Deck deck, Preset preset, LXPattern pattern) {
+ public void onPresetLoaded(LXDeck deck, Preset preset, LXPattern pattern) {
if (loadedPattern != pattern) {
if (loadedPattern != null) {
for (LXParameter p : loadedPattern.getParameters()) {
}
}
- private void onPresetDirty(Engine.Deck deck) {
+ private void onPresetDirty(LXDeck deck) {
if (loadedPreset != null) {
for (PresetListener listener : listeners) {
listener.onPresetDirty(deck, loadedPreset);
manager.write();
}
- public void select(Engine.Deck deck) {
+ public void select(LXDeck deck) {
for (LXPattern pattern : deck.getPatterns()) {
if (pattern.getClass().getName().equals(className)) {
for (String pLabel : parameters.keySet()) {
class UIPatternDeck extends UIWindow {
- Engine.Deck deck;
+ LXDeck deck;
- public UIPatternDeck(Engine.Deck deck, String label, float x, float y, float w, float h) {
+ public UIPatternDeck(LXDeck deck, String label, float x, float y, float w, float h) {
super(label, x, y, w, h);
this.deck = deck;
int yp = titleHeight;
parameterKnobs[ki].addToContainer(this);
}
- Engine.Listener lxListener = new Engine.AbstractListener() {
- public void patternWillChange(Engine.Deck deck, LXPattern pattern, LXPattern nextPattern) {
+ LXDeck.Listener lxListener = new LXDeck.AbstractListener() {
+ public void patternWillChange(LXDeck deck, LXPattern pattern, LXPattern nextPattern) {
patternList.redraw();
}
- public void patternDidChange(Engine.Deck deck, LXPattern pattern) {
+ public void patternDidChange(LXDeck deck, LXPattern pattern) {
patternList.redraw();
int pi = 0;
for (LXParameter parameter : pattern.getParameters()) {
final UIScrollList tList;
(tList = new UIScrollList(1, titleHeight, w-2, 60)).setItems(items).addToContainer(this);
- lx.engine.getDeck(1).addListener(new Engine.AbstractListener() {
- public void blendTransitionDidChange(Engine.Deck deck, LXTransition transition) {
+ lx.engine.getDeck(GLucose.RIGHT_DECK).addListener(new LXDeck.AbstractListener() {
+ public void faderTransitionDidChange(LXDeck deck, LXTransition transition) {
tList.redraw();
}
});
public UICrossfader(float x, float y, float w, float h) {
super("CROSSFADER", x, y, w, h);
- new UIParameterSlider(4, titleHeight, w-9, 32).setParameter(lx.engine.getDeck(1).getCrossfader()).addToContainer(this);
+ new UIParameterSlider(4, titleHeight, w-9, 32).setParameter(lx.engine.getDeck(GLucose.RIGHT_DECK).getFader()).addToContainer(this);
(displayMode = new UIToggleSet(4, titleHeight + 36, w-9, 20)).setOptions(new String[] { "A", "COMP", "B" }).setValue("COMP").addToContainer(this);
}
return logMode.isActive();
}
- public Engine.Deck getFocusedDeck() {
- return lx.engine.getDeck(deckMode.getValue() == "A" ? 0 : 1);
+ public LXDeck getFocusedDeck() {
+ return lx.engine.getDeck(deckMode.getValue() == "A" ? GLucose.LEFT_DECK : GLucose.RIGHT_DECK);
}
}