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();
}
//println (model.xMin + " " + model.yMin + " " + model.zMin);
//println (model.xMax + " " + model.yMax + " " + model.zMax);
- for (MidiOutputDevice o: RWMidi.getOutputDevices()) { if (o.toString().contains("APC")) { APCOut = o.createOutput(); break;}}
+ //for (MidiOutputDevice o: RWMidi.getOutputDevices()) { if (o.toString().contains("APC")) { APCOut = o.createOutput(); break;}}
+ }
+
+ void setAPCOutput(MidiOutput output) {
+ APCOut = output;
}
void updateLights() { if (APCOut == null) return;
for (int i = 0; i < NumApcRows; ++i)
- for (int j = 0; j < 8; ++j) midiEngine.grid.setState(i, j, 0);
- for (int i=0; i<picks .size(); i++) midiEngine.grid.setState(picks.get(i).CurRow-53, picks.get(i).CurCol, 3);
+ for (int j = 0; j < 8; ++j) APCOut.sendNoteOn(j, 53+i, 0);
+ for (int i=0; i<picks .size(); i++) APCOut.sendNoteOn(picks.get(i).CurCol, picks.get(i).CurRow, 3);
for (int i=0; i<bools .size(); i++) if (bools.get(i).b) APCOut.sendNoteOn (bools.get(i).col, bools.get(i).row, 1);
else APCOut.sendNoteOff (bools.get(i).col, bools.get(i).row, 0);
}