---
title: MIDIGetNumberOfDevices()
framework: coremidi
role: symbol
role_heading: Function
path: coremidi/midigetnumberofdevices()
---

# MIDIGetNumberOfDevices()

Returns the number of devices in the system.

## Declaration

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

## Return Value

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

## See Also

### Device lookup

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