void SetNoteOn (int row, int col, int clr){ if (APCOut != null) APCOut.sendNoteOn (col, row, clr); }
void SetNoteOff (int row, int col, int clr){ if (APCOut != null) APCOut.sendNoteOff (col, row, clr); }
- boolean isFocused() { return midiEngine != null && midiEngine.getFocusedDeck() != null &&
- this == midiEngine.getFocusedDeck().getActivePattern(); }
+ boolean isFocused() { return midiEngine != null && midiEngine.getFocusedPattern() == this; }
void onInactive() { uiDebugText.setText(""); }
void onTransitionEnd() { updateLights(); }
void onReset() {
}
// A little silliness to test the grid API
- for (int i = 0; i < 7; ++i) {
- for (int j = 0; j < 8; ++j) {
- int gi = (int) constrain(j * NUM_DIVISIONS / 8, 0, NUM_DIVISIONS-1);
- float b = 1 - 4.*abs((6-i)/7. - gravity[gi].getValuef() / model.yMax);
- midiEngine.grid.setState(i, j, (b < 0) ? 0 : 1);
+ if (midiEngine != null && midiEngine.getFocusedPattern() == this) {
+ for (int i = 0; i < 5; ++i) {
+ for (int j = 0; j < 8; ++j) {
+ int gi = (int) constrain(j * NUM_DIVISIONS / 8, 0, NUM_DIVISIONS-1);
+ float b = 1 - 4.*abs((6-i)/6. - gravity[gi].getValuef() / model.yMax);
+ midiEngine.grid.setState(i, j, (b < 0) ? 0 : 3);
+ }
}
}
while (i < 12) {
sendKnob(i++, 0);
}
- for (int row = 0; row < 7; ++row) {
- for (int col = 0; col < 8; ++col) {
- setGridState(row, col, 0);
+ if (focusedPattern instanceof DPat) {
+ ((DPat)focusedPattern).updateLights();
+ } else {
+ for (int row = 0; row < 7; ++row) {
+ for (int col = 0; col < 8; ++col) {
+ setGridState(row, col, 0);
+ }
}
}
}
}
private void onPresetDirty() {
- for (PresetListener listener : listeners) {
- listener.onPresetDirty(loadedPreset);
+ if (loadedPreset != null) {
+ for (PresetListener listener : listeners) {
+ listener.onPresetDirty(loadedPreset);
+ }
}
}