Guides and Sample Code Developer
Search

CoreMIDI Changes for Swift

CoreMIDI

Declaration
From
struct MIDIDriverInterface {
    var _reserved: UnsafeMutableRawPointer!
    var QueryInterface: ((UnsafeMutableRawPointer?, REFIID, UnsafeMutablePointer<LPVOID?>?) -> HRESULT)!
    var AddRef: ((UnsafeMutableRawPointer?) -> ULONG)!
    var Release: ((UnsafeMutableRawPointer?) -> ULONG)!
    var FindDevices: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!
    var Start: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!
    var Stop: ((MIDIDriverRef?) -> OSStatus)!
    var Configure: ((MIDIDriverRef?, MIDIDeviceRef) -> OSStatus)!
    var Send: ((MIDIDriverRef?, UnsafePointer<MIDIPacketList>?, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!
    var EnableSource: ((MIDIDriverRef?, MIDIEndpointRef, DarwinBoolean) -> OSStatus)!
    var Flush: ((MIDIDriverRef?, MIDIEndpointRef, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!
    var Monitor: ((MIDIDriverRef?, MIDIEndpointRef, UnsafePointer<MIDIPacketList>?) -> OSStatus)!
    init()
    init(_reserved _reserved: UnsafeMutableRawPointer!, QueryInterface QueryInterface: (@escaping (UnsafeMutableRawPointer?, REFIID, UnsafeMutablePointer<LPVOID?>?) -> HRESULT)!, AddRef AddRef: (@escaping (UnsafeMutableRawPointer?) -> ULONG)!, Release Release: (@escaping (UnsafeMutableRawPointer?) -> ULONG)!, FindDevices FindDevices: (@escaping (MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Start Start: (@escaping (MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Stop Stop: (@escaping (MIDIDriverRef?) -> OSStatus)!, Configure Configure: (@escaping (MIDIDriverRef?, MIDIDeviceRef) -> OSStatus)!, Send Send: (@escaping (MIDIDriverRef?, UnsafePointer<MIDIPacketList>?, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, EnableSource EnableSource: (@escaping (MIDIDriverRef?, MIDIEndpointRef, DarwinBoolean) -> OSStatus)!, Flush Flush: (@escaping (MIDIDriverRef?, MIDIEndpointRef, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, Monitor Monitor: (@escaping (MIDIDriverRef?, MIDIEndpointRef, UnsafePointer<MIDIPacketList>?) -> OSStatus)!)
}
To
struct MIDIDriverInterface {
    var _reserved: UnsafeMutableRawPointer!
    var QueryInterface: ((UnsafeMutableRawPointer?, REFIID, UnsafeMutablePointer<LPVOID?>?) -> HRESULT)!
    var AddRef: ((UnsafeMutableRawPointer?) -> ULONG)!
    var Release: ((UnsafeMutableRawPointer?) -> ULONG)!
    var FindDevices: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!
    var Start: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!
    var Stop: ((MIDIDriverRef?) -> OSStatus)!
    var Configure: ((MIDIDriverRef?, MIDIDeviceRef) -> OSStatus)!
    var Send: ((MIDIDriverRef?, UnsafePointer<MIDIPacketList>?, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!
    var EnableSource: ((MIDIDriverRef?, MIDIEndpointRef, DarwinBoolean) -> OSStatus)!
    var Flush: ((MIDIDriverRef?, MIDIEndpointRef, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!
    var Monitor: ((MIDIDriverRef?, MIDIEndpointRef, UnsafePointer<MIDIPacketList>?) -> OSStatus)!
    init()
    init(_reserved _reserved: UnsafeMutableRawPointer!, QueryInterface QueryInterface: ((UnsafeMutableRawPointer?, REFIID, UnsafeMutablePointer<LPVOID?>?) -> HRESULT)!, AddRef AddRef: ((UnsafeMutableRawPointer?) -> ULONG)!, Release Release: ((UnsafeMutableRawPointer?) -> ULONG)!, FindDevices FindDevices: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Start Start: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Stop Stop: ((MIDIDriverRef?) -> OSStatus)!, Configure Configure: ((MIDIDriverRef?, MIDIDeviceRef) -> OSStatus)!, Send Send: ((MIDIDriverRef?, UnsafePointer<MIDIPacketList>?, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, EnableSource EnableSource: ((MIDIDriverRef?, MIDIEndpointRef, DarwinBoolean) -> OSStatus)!, Flush Flush: ((MIDIDriverRef?, MIDIEndpointRef, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, Monitor Monitor: ((MIDIDriverRef?, MIDIEndpointRef, UnsafePointer<MIDIPacketList>?) -> OSStatus)!)
}

Modified MIDIDriverInterface.init(_reserved: UnsafeMutableRawPointer!, QueryInterface: ((UnsafeMutableRawPointer?, REFIID, UnsafeMutablePointer<LPVOID?>?) -> HRESULT)!, AddRef: ((UnsafeMutableRawPointer?) -> ULONG)!, Release: ((UnsafeMutableRawPointer?) -> ULONG)!, FindDevices: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Start: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Stop: ((MIDIDriverRef?) -> OSStatus)!, Configure: ((MIDIDriverRef?, MIDIDeviceRef) -> OSStatus)!, Send: ((MIDIDriverRef?, UnsafePointer<MIDIPacketList>?, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, EnableSource: ((MIDIDriverRef?, MIDIEndpointRef, DarwinBoolean) -> OSStatus)!, Flush: ((MIDIDriverRef?, MIDIEndpointRef, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, Monitor: ((MIDIDriverRef?, MIDIEndpointRef, UnsafePointer<MIDIPacketList>?) -> OSStatus)!)
Declaration
From
init(_reserved _reserved: UnsafeMutableRawPointer!, QueryInterface QueryInterface: (@escaping (UnsafeMutableRawPointer?, REFIID, UnsafeMutablePointer<LPVOID?>?) -> HRESULT)!, AddRef AddRef: (@escaping (UnsafeMutableRawPointer?) -> ULONG)!, Release Release: (@escaping (UnsafeMutableRawPointer?) -> ULONG)!, FindDevices FindDevices: (@escaping (MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Start Start: (@escaping (MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Stop Stop: (@escaping (MIDIDriverRef?) -> OSStatus)!, Configure Configure: (@escaping (MIDIDriverRef?, MIDIDeviceRef) -> OSStatus)!, Send Send: (@escaping (MIDIDriverRef?, UnsafePointer<MIDIPacketList>?, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, EnableSource EnableSource: (@escaping (MIDIDriverRef?, MIDIEndpointRef, DarwinBoolean) -> OSStatus)!, Flush Flush: (@escaping (MIDIDriverRef?, MIDIEndpointRef, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, Monitor Monitor: (@escaping (MIDIDriverRef?, MIDIEndpointRef, UnsafePointer<MIDIPacketList>?) -> OSStatus)!)
To
init(_reserved _reserved: UnsafeMutableRawPointer!, QueryInterface QueryInterface: ((UnsafeMutableRawPointer?, REFIID, UnsafeMutablePointer<LPVOID?>?) -> HRESULT)!, AddRef AddRef: ((UnsafeMutableRawPointer?) -> ULONG)!, Release Release: ((UnsafeMutableRawPointer?) -> ULONG)!, FindDevices FindDevices: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Start Start: ((MIDIDriverRef?, MIDIDeviceListRef) -> OSStatus)!, Stop Stop: ((MIDIDriverRef?) -> OSStatus)!, Configure Configure: ((MIDIDriverRef?, MIDIDeviceRef) -> OSStatus)!, Send Send: ((MIDIDriverRef?, UnsafePointer<MIDIPacketList>?, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, EnableSource EnableSource: ((MIDIDriverRef?, MIDIEndpointRef, DarwinBoolean) -> OSStatus)!, Flush Flush: ((MIDIDriverRef?, MIDIEndpointRef, UnsafeMutableRawPointer?, UnsafeMutableRawPointer?) -> OSStatus)!, Monitor Monitor: ((MIDIDriverRef?, MIDIEndpointRef, UnsafePointer<MIDIPacketList>?) -> OSStatus)!)

Declaration
From
func MIDIDestinationCreate(_ client: MIDIClientRef, _ name: CFString, _ readProc: CoreMIDI.MIDIReadProc, _ refCon: UnsafeMutableRawPointer?, _ outDest: UnsafeMutablePointer<MIDIEndpointRef>) -> OSStatus
To
func MIDIDestinationCreate(_ client: MIDIClientRef, _ name: CFString, _ readProc: @escaping CoreMIDI.MIDIReadProc, _ refCon: UnsafeMutableRawPointer?, _ outDest: UnsafeMutablePointer<MIDIEndpointRef>) -> OSStatus

Declaration
From
func MIDIDestinationCreateWithBlock(_ client: MIDIClientRef, _ name: CFString, _ outDest: UnsafeMutablePointer<MIDIEndpointRef>, _ readBlock: CoreMIDI.MIDIReadBlock) -> OSStatus
To
func MIDIDestinationCreateWithBlock(_ client: MIDIClientRef, _ name: CFString, _ outDest: UnsafeMutablePointer<MIDIEndpointRef>, _ readBlock: @escaping CoreMIDI.MIDIReadBlock) -> OSStatus

Declaration
From
func MIDIInputPortCreate(_ client: MIDIClientRef, _ portName: CFString, _ readProc: CoreMIDI.MIDIReadProc, _ refCon: UnsafeMutableRawPointer?, _ outPort: UnsafeMutablePointer<MIDIPortRef>) -> OSStatus
To
func MIDIInputPortCreate(_ client: MIDIClientRef, _ portName: CFString, _ readProc: @escaping CoreMIDI.MIDIReadProc, _ refCon: UnsafeMutableRawPointer?, _ outPort: UnsafeMutablePointer<MIDIPortRef>) -> OSStatus

Declaration
From
func MIDIInputPortCreateWithBlock(_ client: MIDIClientRef, _ portName: CFString, _ outPort: UnsafeMutablePointer<MIDIPortRef>, _ readBlock: CoreMIDI.MIDIReadBlock) -> OSStatus
To
func MIDIInputPortCreateWithBlock(_ client: MIDIClientRef, _ portName: CFString, _ outPort: UnsafeMutablePointer<MIDIPortRef>, _ readBlock: @escaping CoreMIDI.MIDIReadBlock) -> OSStatus

Feedback