---
title: "MIDIEntityGetNumberOfSources(_:)"
framework: coremidi
role: symbol
role_heading: Function
path: "coremidi/midientitygetnumberofsources(_:)"
---

# MIDIEntityGetNumberOfSources(_:)

Returns the number of sources in an entity.

## Declaration

```swift
func MIDIEntityGetNumberOfSources(_ entity: MIDIEntityRef) -> Int
```

## Parameters

- `entity`: The entity to query.

## Return Value

Return Value The number of sources the entity contains, or 0 if an error occurred.

## See Also

### Entity lookup

- [MIDIEntityGetDevice(_:_:)](coremidi/midientitygetdevice(_:_:).md)
- [MIDIEntityGetSource(_:_:)](coremidi/midientitygetsource(_:_:).md)
- [MIDIEntityGetNumberOfDestinations(_:)](coremidi/midientitygetnumberofdestinations(_:).md)
- [MIDIEntityGetDestination(_:_:)](coremidi/midientitygetdestination(_:_:).md)
- [MIDIEntityRef](coremidi/midientityref.md)
