- MidiOutput APCOut = null;
-
- boolean noteOff(Note note) { if (!isFocused()) return false;
- 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;
- updateLights(); // may not be needed
- return false;
- }
-
- boolean noteOn(Note note) { if (!isFocused()) return false;
- 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;
- if (row == 84 && col==0) { onReset(); return true; }
- println("row: " + row + " col: " + col); return false;
- }
-
- 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.getFocusedPattern() == this; }
- void onInactive() { uiDebugText.setText(""); }
- void onTransitionEnd() { updateLights(); }
- void onReset() {
- 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();
- updateLights();
- }
-
- void updateLights() {
- if (!isFocused() || APCOut == null) return;
- for (int i=53;i< 58; i++) for (int j=0; j<NumApcCols; j++) SetNoteOn(i, j, 0);
- for (int i=0; i<picks .size(); i++) SetNoteOn (picks.get(i).CurRow, picks.get(i).CurCol, 3);
- for (int i=0; i<bools .size(); i++) if (bools.get(i).b) SetNoteOn (bools.get(i).row, bools.get(i).col, 1);
- else SetNoteOff (bools.get(i).row, bools.get(i).col, 0);
- }
-
- void setText() { if (!isFocused()) return;
- String Text1="", Text2="";
- for (int i=0; i<bools.size(); i++) if (bools.get(i).b) Text1 += " " + bools.get(i).tag + " ";
- for (int i=0; i<picks.size(); i++) Text1 += picks.get(i).tag + ": " + picks.get(i).CurDesc() + " ";
- uiDebugText.setText(Text1, Text2);
- }
-