---
title: "MIDIDeviceGetNumberOfEntities(_:)"
framework: coremidi
role: symbol
role_heading: Function
path: "coremidi/mididevicegetnumberofentities(_:)"
---

# MIDIDeviceGetNumberOfEntities(_:)

Returns the number of entities in a device.

## Declaration

```swift
func MIDIDeviceGetNumberOfEntities(_ device: MIDIDeviceRef) -> Int
```

## Parameters

- `device`: The device to query.

## Return Value

Return Value The number of entities the device contains, or 0 if an error occurred.

## See Also

### Device lookup

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