---
title: MIDIReceiveBlock
framework: coremidi
role: symbol
role_heading: Type Alias
path: coremidi/midireceiveblock
---

# MIDIReceiveBlock

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

## Declaration

```swift
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 doc://com.apple.coremidi/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

Discussion A client receives incoming MIDI messages through this callback block. The MIDIInputPortCreateWithProtocol(_:_:_:_:_:) and MIDIDestinationCreateWithProtocol(_:_:_:_:_:) functions receive a MIDIReceiveBlock. The system creates a high-priority receive thread on your client’s behalf, and from that thread it calls your MIDIReceiveBlock when incoming MIDI messages arrive.

## See Also

### Port management

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