PieterP:
What do you expect to happen then?
Please specify all possible cases.
so i modified the code a little to try with 2 notes and its playing perfectly except from one to the other, in the following code if i press note 69, hold down, press 62 and then release 62, 69 is played without PB or the other way around, All these variables are coming up now as the program is progressing, i really appreciate your help on this
uint8_t otherNotesPlaying = 0;
bool noteplaying = false;
void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
if(pitch == 62 || pitch == 69)
noteplaying = true;
else
otherNotesPlaying++;
if (noteplaying && otherNotesPlaying == 0)
MIDI.sendPitchBend(-2949,channel);
else
MIDI.sendPitchBend(0,channel);
if (pitch == 62)
MIDI.sendPitchBend(-2949,channel);
if (pitch == 69)
MIDI.sendPitchBend(-2949,channel);
}
void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {
if(pitch == 62 || pitch == 69)
noteplaying = false;
else
otherNotesPlaying--;
if (noteplaying && otherNotesPlaying == 0)
MIDI.sendPitchBend(-2949,channel);
else
MIDI.sendPitchBend(0,channel);
}