boolean noteOff(Note note) {
int row = note.getPitch(), col = note.getChannel();
- for (int i=0; i<bools.size(); i++) if (bools.get(i).set(row, col, false)) return true;
+ for (int i=0; i<bools.size(); i++) if (bools.get(i).set(row, col, false)) { presetManager.dirty(this); return true; }
updateLights(); return false;
}
boolean noteOn(Note note) {
int row = note.getPitch(), col = note.getChannel();
- for (int i=0; i<picks.size(); i++) if (picks.get(i).set(row, col)) return true;
- for (int i=0; i<bools.size(); i++) if (bools.get(i).set(row, col, true)) return true;
+ for (int i=0; i<picks.size(); i++) if (picks.get(i).set(row, col)) { presetManager.dirty(this); return true; }
+ for (int i=0; i<bools.size(); i++) if (bools.get(i).set(row, col, true)) { presetManager.dirty(this); return true; }
if (row == 84 && col==0) { onReset(); return true; }
println("row: " + row + " col: " + col); return false;
}
for (int i=0; i<params.size(); i++) params.get(i).reset();
for (int i=0; i<bools .size(); i++) bools.get(i).reset();
for (int i=0; i<picks .size(); i++) picks.get(i).reset();
+ presetManager.dirty(this);
updateLights();
}
if (focusedPattern instanceof DPat) {
((DPat)focusedPattern).updateLights();
} else {
+ for (int j = 0; j < 8; ++j) {
+ output.sendNoteOn(j, 48, 0);
+ }
for (int row = 0; row < 7; ++row) {
for (int col = 0; col < 8; ++col) {
setGridState(row, col, 0);
listeners.add(listener);
}
+ public void dirty(LXPattern pattern) {
+ if (loadedPattern == pattern) {
+ onPresetDirty();
+ }
+ }
+
public void select(int index) {
presets[index].select();
}
for (LXParameter p : pattern.getParameters()) {
parameters.put(p.getLabel(), p.getValuef());
}
+ if (pattern instanceof DPat) {
+ DPat dpattern = (DPat) pattern;
+ for (DBool bool : dpattern.bools) {
+ parameters.put(bool.tag, bool.b ? 1.f : 0.f);
+ }
+ for (Pick pick : dpattern.picks) {
+ parameters.put(pick.tag, pick.CurRow + pick.CurCol/100.f);
+ }
+ }
manager.write();
}
p.setValue(parameters.get(pLabel));
}
}
+ if (pattern instanceof DPat) {
+ DPat dpattern = (DPat) pattern;
+ for (DBool bool : dpattern.bools) {
+ if (bool.tag.equals(pLabel)) {
+ bool.set(bool.row, bool.col, parameters.get(pLabel) > 0);
+ }
+ }
+ for (Pick pick : dpattern.picks) {
+ if (pick.tag.equals(pLabel)) {
+ float f = parameters.get(pLabel);
+ pick.set((int) floor(f), (int) round((f%1)*100.));
+ }
+ }
+ }
}
deck.goPattern(pattern);
+ if (pattern instanceof DPat) {
+ ((DPat)pattern).updateLights();
+ }
manager.onPresetLoaded(this, pattern);
break;
}