<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.1.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AudioToolbox",
  "identifier" : "/documentation/AudioToolbox/MusicTrackGetDestMIDIEndpoint(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@MusicTrackGetDestMIDIEndpoint"
  },
  "title" : "MusicTrackGetDestMIDIEndpoint(_:_:)"
}
-->

# MusicTrackGetDestMIDIEndpoint(_:_:)

Gets the MIDI endpoint that is the event target for a music track.

```
func MusicTrackGetDestMIDIEndpoint(_ inTrack: MusicTrack, _ outEndpoint: UnsafeMutablePointer<MIDIEndpointRef>) -> OSStatus
```

## Parameters

`inTrack`

The music track for which you want to get the associated MIDI endpoint.

`outEndpoint`

On return, the MIDI endpoint that is the event target of the music track. This function instead returns an error if the music track’s event target is not a MIDI endpoint.

## Return Value

A result code. If the music track’s event target is an audio unit node, returns `kAudioToolboxErr_IllegalTrackDestination`.

## 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)