---
title: "MIDIGetExternalDevice(_:)"
framework: coremidi
role: symbol
role_heading: Function
path: "coremidi/midigetexternaldevice(_:)"
---

# MIDIGetExternalDevice(_:)

Returns one of the external devices in the system.

## Declaration

```swift
func MIDIGetExternalDevice(_ deviceIndex0: Int) -> MIDIDeviceRef
```

## Parameters

- `deviceIndex0`: The index of the device to return.

## Return Value

Return Value A reference to a device, or NULL if an error occurred.

## Discussion

Discussion Call this function to enumerate the external devices in the system.

## See Also

### Device lookup

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