MIDIConfig FindConfigForReceiver(MIDIReceiver receiver) { if (receiver != null) { foreach (MIDIConfig c in MIDIConfigs) { if (c.MIDIReceiver == receiver) return c; } } return null; }
void OnMIDIReceiverNoteOn(object sender, MIDIReceiver.MIDIReceiverEventArgs e) { MIDIConfig c = FindConfigForReceiver(e.Receiver); if (c != null) { c.LastNoteOnEvent = e; //Debug.Log("NOTE ON " + e.MidiNote + " for Group: " + c.Group.ToString() + " Beat: " + e.NoteBeat + " curBeat: " + BeatClock.Instance.elapsedBeats + " curSecs: " + BeatClock.Instance.elapsedSecs); if (OnNoteOn != null) { OnNoteOn(this, new EightNightsMIDIEventArgs(e.MidiNote, e.NoteBeat, e.DurationBeats, e.Velocity, c.Group)); } } }
public MIDIReceiverEventArgs(MIDIReceiver r, int midiNote, float beat, float durationBeats, float velocity) { Receiver = r; MidiNote = midiNote; NoteBeat = beat; DurationBeats = durationBeats; Velocity = velocity; }