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

# MIDIPortConnectSource(_:_:_:)

Makes a connection from a source to a client input port.

```
func MIDIPortConnectSource(_ port: MIDIPortRef, _ source: MIDIEndpointRef, _ connRefCon: UnsafeMutableRawPointer?) -> OSStatus
```

## Parameters

`port`

The port on which to create the connection.

`source`

The source from which to create the connection.

`connRefCon`

The data that passes to the port’s [`MIDIReceiveBlock`](/documentation/CoreMIDI/MIDIReceiveBlock) to identify the source, which is always <doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0> for virtual destinations.

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