Help with code for Midi legato playing and pitchbend

PieterP:
I don't think I understand what you mean.

If any note other than 62 is playing, PB = 0, if note 62 is playing, and all other notes are off PB = -2949. Is that a correct interpretation of your problem?

Well that is a correct interpretation of what i would like to happen, but the actual problem is :

noteOn = 62 PB = -2949
noteOn = 63 PB = 0

so at this point i have pressed note 63 but have not released 62

note 63 is playing now with PB = 0

So now this is the problem:

noteOff = 63
so note 62 continues playing because noteOff was never sent because i am still holding it down
so now it is playing note 62 with PB = 0 when it should be PB = -2949 and the reason is it started playing again without a noteOn being sent so i cannot resend PB = -2949 On NoteOn