---
title: "MIDIDeviceAddEntity(_:_:_:_:_:_:)"
framework: Core MIDI
role: symbol
role_heading: Function
platforms: [iOS 4.2+, iPadOS 4.2+, Mac Catalyst 13.1+, macOS 10.0+, visionOS 1.0+]
path: "coremidi/midideviceaddentity(_:_:_:_:_:_:)"
---

# MIDIDeviceAddEntity(_:_:_:_:_:_:)

Specifies one of the entities that make up a device.

## Declaration

```swift
func MIDIDeviceAddEntity(_ device: MIDIDeviceRef, _ name: CFString, _ embedded: Bool, _ numSourceEndpoints: Int, _ numDestinationEndpoints: Int, _ newEntity: UnsafeMutablePointer<MIDIEntityRef>) -> OSStatus
```

## Parameters

- `device`: The device to which an entity is to be added.
- `name`: The name of the new entity.
- `embedded`: True if this entity is inside the device, false if the entity simply consists of external connectors to which other devices can be attached.
- `numSourceEndpoints`: The number of source endpoints the entity has.
- `numDestinationEndpoints`: The number of destination endpoints the entity has.
- `newEntity`: On successful return, points to the newly-created entity.

## Return Value

Return Value An OSStatus result code.

## See Also

### Functions

- [MIDI1UPChannelPressure(_:_:_:)](coremidi/midi1upchannelpressure(_:_:_:).md)
- [MIDI1UPPolyPressure(_:_:_:_:)](coremidi/midi1uppolypressure(_:_:_:_:).md)
- [MIDI1UPProgramChange(_:_:_:)](coremidi/midi1upprogramchange(_:_:_:).md)
- [MIDI1UPSysEx(_:_:_:_:_:_:_:_:_:)](coremidi/midi1upsysex(_:_:_:_:_:_:_:_:_:).md)
- [MIDI1UPSysExArray(_:_:_:_:)](coremidi/midi1upsysexarray(_:_:_:_:).md)
- [MIDI2EndOfClipMessage()](coremidi/midi2endofclipmessage().md)
- [MIDI2EndpointDeviceIdentityNotificationMessage(_:_:_:_:_:_:)](coremidi/midi2endpointdeviceidentitynotificationmessage(_:_:_:_:_:_:).md)
- [MIDI2EndpointDiscoveryMessage(_:_:_:_:_:_:_:)](coremidi/midi2endpointdiscoverymessage(_:_:_:_:_:_:_:).md)
- [MIDI2EndpointInfoNotificationMessage(_:_:_:_:_:_:_:_:)](coremidi/midi2endpointinfonotificationmessage(_:_:_:_:_:_:_:_:).md)
- [MIDI2EndpointNameNotificationMessage(_:_:_:)](coremidi/midi2endpointnamenotificationmessage(_:_:_:).md)
- [MIDI2EndpointProductInstanceIDNotificationMessage(_:_:_:)](coremidi/midi2endpointproductinstanceidnotificationmessage(_:_:_:).md)
- [MIDI2FlexDataMessage(_:_:_:_:_:_:_:_:_:)](coremidi/midi2flexdatamessage(_:_:_:_:_:_:_:_:_:).md)
- [MIDI2FunctionBlockDiscoveryMessage(_:_:_:)](coremidi/midi2functionblockdiscoverymessage(_:_:_:).md)
- [MIDI2FunctionBlockInfoNotificationMessage(_:_:_:_:_:_:_:_:_:)](coremidi/midi2functionblockinfonotificationmessage(_:_:_:_:_:_:_:_:_:).md)
- [MIDI2FunctionBlockNameNotificationMessage(_:_:_:_:)](coremidi/midi2functionblocknamenotificationmessage(_:_:_:_:).md)
