Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 private int GetMidiNoteNumber(NotePitchType pitch, int octave = 4)
 {
     return((octave + 1) * 12 + (int)pitch);
 }