Call onTransitionEnd() after active
[SugarCubes.git] / _MIDI.pde
index a584ef9097d72a69543336def3fc6ef872620b3f..5f25ddad62327f0f10ce797447b8371ae9ba5170 100644 (file)
--- a/_MIDI.pde
+++ b/_MIDI.pde
@@ -348,7 +348,6 @@ public class APC40MidiInput extends GenericDeviceMidiInput {
     int pitch = note.getPitch();
     if (channel < 8) {
       if (pitch >= 53 && pitch <=57) return new GridPosition(pitch-53, channel);
-      else if (pitch == 52) return new GridPosition(5, channel);
     }
     return null;
   }
@@ -453,6 +452,16 @@ public class APC40MidiInput extends GenericDeviceMidiInput {
       }
       break;
       
+    case 52: // CLIP STOP
+      if (nChan < PresetManager.NUM_PRESETS) {
+        if (shiftOn) {
+          presetManager.store(nChan);
+        } else {
+          presetManager.select(nChan);
+        }
+      }
+      break;
+      
     case 82: // scene 1
       EFF_boom.trigger();
       break;
@@ -641,6 +650,12 @@ class APC40MidiOutput implements LXParameter.Listener, GridOutput {
 
     lx.cycleBaseHue(60000);
     output.sendNoteOn(6, 49, 127);
+    
+    // Turn off the track selection lights
+    for (int i = 0; i < 8; ++i) {
+      output.sendNoteOn(i, 51, 0);
+    }
+    output.sendNoteOn(0, 80, 0);
   }
 
   private void resetParameters() {
@@ -727,9 +742,8 @@ class APC40MidiOutput implements LXParameter.Listener, GridOutput {
   }
   
   public void setGridState(int row, int col, int state) {
-    if (col < 8) {
-      if (row < 5) output.sendNoteOn(col, 53+row, state);
-      else if (row == 6) output.sendNoteOn(col, 52, state);
+    if (col < 8 && row < 5) {
+      output.sendNoteOn(col, 53+row, state);
     }
   }
 }