void OnGUI() { var sourceCount = MidiDriver.CountSources(); // Sources var temp = "Detected MIDI inputs:"; for (var i = 0; i < sourceCount; i++) { var id = MidiDriver.GetSourceIdAtIndex(i); var name = MidiDriver.GetSourceName(id); temp += "\n" + id.ToString("X8") + ": " + name; } EditorGUILayout.HelpBox(temp, MessageType.None); // Message history temp = "Recent MIDI messages:"; foreach (var message in MidiDriver.Instance.History) { temp += "\n" + message.ToString(); } EditorGUILayout.HelpBox(temp, MessageType.None); var destinationCount = MidiDriver.CountDestinations(); // Destinations temp = "Detected MIDI outputs:"; for (var i = 0; i < destinationCount; i++) { var id = MidiDriver.GetDestinationIdAtIndex(i); var name = MidiDriver.GetDestinationName(id); temp += "\n" + id.ToString("X8") + ": " + name; } EditorGUILayout.HelpBox(temp, MessageType.None); }
public void SendMessage(MidiMessage msg) { if (_endpointId == uint.MaxValue) { // Send to all. for (var i = 0; i < MidiDriver.CountDestinations(); i++) { msg.endpoint = MidiDriver.GetDestinationIdAtIndex(i); MidiDriver.SendMessage(msg.Encode64Bit()); } } else if (_endpointId != 0) { msg.endpoint = _endpointId; MidiDriver.SendMessage(msg.Encode64Bit()); } }
public override int CountEndpoints() { return(MidiDriver.CountDestinations()); }