2 bug fixes in IGraphics::SetQwertyMidiKeyHandlerFunc

Hi,

I haven’t figured out yet how to make a pull request on GitHub properly, so sorry in case I’m posting this in the wrong place.

I’ve found/fixed 2 small bugs in IGraphics::SetQwertyMidiKeyHandlerFunc (IGraphics.cpp).

onOctSwitch is called on both key up and down resulting in stepping 2 octaves for each keypress. So, doing the onOctSwitch only when ‘isUp == true’ in a separate switch statement will fix this. (line 2272 IGraphics.cpp)

if(isUp) {
  switch (key.VK) {
      case kVK_Z: base -= 12; onOctSwitch(); break;
      case kVK_X: base += 12; onOctSwitch(); break;
  }
}
  
switch (key.VK) {
  case kVK_A: note = 0; break;
  case kVK_W: note = 1; break;
  case kVK_S: note = 2; break;
  case kVK_E: note = 3; break;
  case kVK_D: note = 4; break;
  case kVK_F: note = 5; break;
  case kVK_T: note = 6; break;
  case kVK_G: note = 7; break;
  case kVK_Y: note = 8; break;
  case kVK_H: note = 9; break;
  case kVK_U: note = 10; break;
  case kVK_J: note = 11; break;
  case kVK_K: note = 12; break;
  case kVK_O: note = 13; break;
  case kVK_L: note = 14; break;
  default: return true; // don't beep, but don't do anything
}

On key up, msg.MakeNoteOffMsg(pitch, 127, 0); is called. However, the second parameter in MakeNoteOffMsg is the ‘offset’ of the midi message, not the velocity.
(line 2310 IGraphics.cpp) It should be:

msg.MakeNoteOffMsg(pitch, 0);

Kind regards,
PJ

Sorry, I should read better… I will post this as GitHub issue.