<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMIDI",
  "identifier" : "/documentation/CoreMIDI/MIDIReceiveBlock",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Core MIDI"
    ],
    "preciseIdentifier" : "c:@T@MIDIReceiveBlock"
  },
  "title" : "MIDIReceiveBlock"
}
-->

# MIDIReceiveBlock

A block receiving MIDI input that includes the incoming messages and a refCon to identify the source.

```
typealias MIDIReceiveBlock = (UnsafePointer<MIDIEventList>, UnsafeMutableRawPointer?) -> Void
```

## Parameters

`evtlist`

The incoming MIDI message(s).

`srcConnRefCon`

The refCon that identifies the source of the data, which is the value that you pass for the `connRefCon` parameter to [`MIDIPortConnectSource(_:_:_:)`](/documentation/CoreMIDI/MIDIPortConnectSource(_:_:_:)). This value is always <doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0> when receiving a MIDI event on a virtual input.

## Discussion

A client receives incoming MIDI messages through this callback block.

The [`MIDIInputPortCreateWithProtocol(_:_:_:_:_:)`](/documentation/CoreMIDI/MIDIInputPortCreateWithProtocol(_:_:_:_:_:)) and [`MIDIDestinationCreateWithProtocol(_:_:_:_:_:)`](/documentation/CoreMIDI/MIDIDestinationCreateWithProtocol(_:_:_:_:_:)) functions receive a [`MIDIReceiveBlock`](/documentation/CoreMIDI/MIDIReceiveBlock). The system creates a high-priority receive thread on your client’s behalf, and from that thread it calls your [`MIDIReceiveBlock`](/documentation/CoreMIDI/MIDIReceiveBlock) when incoming MIDI messages arrive.

---

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)