Help with code for Midi legato playing and pitchbend

PieterP:
Something like this maybe?

uint8_t otherNotesPlaying = 0;

bool note62playing = false;

void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
  if(pitch == 62)
    note62playing = true;
  else
    otherNotesPlaying++;
  if (note62playing && otherNotesPlaying == 0)
    MIDI.sendPitchBend(-2949,channel);
  else
    MIDI.sendPitchBend(0,channel);
}

void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {
if(pitch == 62)
    note62playing = false;
  else
    otherNotesPlaying--;
  if (note62playing && otherNotesPlaying == 0)
    MIDI.sendPitchBend(-2949,channel);
  else
    MIDI.sendPitchBend(0,channel);
}

Peter i think that's half way there, that works when the starting note is 62 but now when i start say on note 63 or any other note for that matter and go down to note 62 without releasing 63 its not sending PB, thanks alot for your help by the way!