<!--
{
  "availability" : [
    "iOS: 4.2.0 - 27.0.0",
    "iPadOS: 4.2.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMIDI",
  "identifier" : "/documentation/CoreMIDI/MIDIDeviceAddEntity(_:_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core MIDI"
    ],
    "preciseIdentifier" : "c:@F@MIDIDeviceAddEntity"
  },
  "title" : "MIDIDeviceAddEntity(_:_:_:_:_:_:)"
}
-->

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

Specifies one of the entities that make up a device.

```
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

An OSStatus result code.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)