     else if (m->Handling == LatchingOn) {
       // Default the value to "on"
       LastValue[i] = 0x7f;
+      LatchState[i] = 1;
     }
     else {
       // Default the value to "off"
       LastValue[i] = 0;
+      LatchState[i] = 0;
     }
   }
 }

#ifdef LOG_EVENTS
      Serial.println(String("Off ") + noteEvt->Channel + "/" + noteEvt->Note + ": " + noteEvt->OffVelocity);
#endif
      usbMIDI.sendNoteOn(noteEvt->Note, noteEvt->OffVelocity, noteEvt->Channel);
      MIDI.sendNoteOn(noteEvt->Note, noteEvt->OffVelocity, noteEvt->Channel);
    }
    value = state / 8; // Scale to 0-127 range
    break;

    }
  }

  // Initialize EventList, NumEvents, LastValue, LatchState
  NumEvents = count;
  EventList = (EventMap *)realloc (EventList, NumEvents * sizeof (*EventList));
  memcpy(EventList, &DefaultEventList[i], NumEvents * sizeof (*EventList));

  LastValue = (uint8_t *)realloc (LastValue, NumEvents * sizeof (*LastValue));
  memset(LastValue, 0, NumEvents * sizeof (*LastValue));

  LatchState = (uint8_t *)realloc (LatchState, NumEvents * sizeof (*LatchState));
  memset(LatchState, 0, NumEvents * sizeof (*LatchState));

  // Send any initialization events, and initialize LastValue[]

