---
title: "MIDIPortConnectSource(_:_:_:)"
framework: coremidi
role: symbol
role_heading: Function
path: "coremidi/midiportconnectsource(_:_:_:)"
---

# MIDIPortConnectSource(_:_:_:)

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

## Declaration

```swift
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 doc://com.apple.coremidi/documentation/CoreMIDI/MIDIReceiveBlock to identify the source, which is always doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0 for virtual destinations.

## Return Value

Return Value An OSStatus result code.

## See Also

### Port management

- [MIDIInputPortCreateWithProtocol(_:_:_:_:_:)](coremidi/midiinputportcreatewithprotocol(_:_:_:_:_:).md)
- [MIDIOutputPortCreate(_:_:_:)](coremidi/midioutputportcreate(_:_:_:).md)
- [MIDIPortDispose(_:)](coremidi/midiportdispose(_:).md)
- [MIDIPortDisconnectSource(_:_:)](coremidi/midiportdisconnectsource(_:_:).md)
- [MIDIPortRef](coremidi/midiportref.md)
- [MIDIReceiveBlock](coremidi/midireceiveblock.md)
