---
title: MIDIGetNumberOfExternalDevices()
framework: coremidi
role: symbol
role_heading: Function
path: coremidi/midigetnumberofexternaldevices()
---

# MIDIGetNumberOfExternalDevices()

Returns the number of external MIDI devices in the system.

## Declaration

```swift
func MIDIGetNumberOfExternalDevices() -> Int
```

## Return Value

Return Value The number of external devices in the system, or 0 if an error occurred.

## Discussion

Discussion External MIDI devices connect to driver endpoints using a standard MIDI cable. Their presence is optional only when a UI (such as Audio MIDI Setup) adds them.

## See Also

### Device lookup

- [MIDIGetNumberOfDevices()](coremidi/midigetnumberofdevices().md)
- [MIDIGetDevice(_:)](coremidi/midigetdevice(_:).md)
- [MIDIGetExternalDevice(_:)](coremidi/midigetexternaldevice(_:).md)
- [MIDIDeviceGetNumberOfEntities(_:)](coremidi/mididevicegetnumberofentities(_:).md)
- [MIDIDeviceGetEntity(_:_:)](coremidi/mididevicegetentity(_:_:).md)
- [MIDIDeviceRef](coremidi/midideviceref.md)
