private void HandleKeyboardNoteEvent(NotePitchType pitch, KeyCode key, KeyCode altKey) { var note = GetMidiNoteNumber(pitch, keyboardOctave); if (Input.GetKeyDown(key) || Input.GetKeyDown(altKey)) { noteOnDelegate(note, keyboardVelocity); } if (Input.GetKeyUp(key) || Input.GetKeyUp(altKey)) { noteOffDelegate(note); } }
private int GetMidiNoteNumber(NotePitchType pitch, int octave = 4) { return((octave + 1) * 12 + (int)pitch); }