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

# MIDIDeviceNewEntity(_:_:_:_:_:_:_:)

Adds a new entity to a device.

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

## Parameters

`device`

The device that owns the new entity.

`name`

The name of the new entity.

`protocol`

The MIDI protocol variant used by the sources and destinations that make up this entity.

`embedded`

A Boolean value that indicates whether this entity is inside the device. If you specify <doc://com.apple.documentation/documentation/Swift/false>, the entity consists only of external connectors to which you can attach other devices.

`numSourceEndpoints`

The entity’s number of source endpoints.

`numDestinationEndpoints`

The entity’s number of destination endpoints.

`newEntity`

On successful return, points to the newly created entity.

## Return Value

An `OSStatus` result code.

## Discussion

Beginning with macOS 11 and iOS 14, non-drivers may call this function to add entities to external devices.

---

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)