Function

MIDIDestinationCreate(_:_:_:_:_:)

Creates a virtual destination in a client.

Declaration

func MIDIDestinationCreate(_ client: MIDIClientRef, _ name: CFString, _ readProc: MIDIReadProc, _ refCon: UnsafeMutableRawPointer?, _ outDest: UnsafeMutablePointer<MIDIEndpointRef>) -> OSStatus

Parameters

client

The client owning the virtual destination.

name

The name of the virtual destination.

readProc

The MIDIReadProc to be called when a client sends MIDI to the virtual destination.

refCon

The refCon to be passed to the readProc.

outDest

On successful return, a pointer to the newly-created destination.

Return Value

A result code.

Discussion

The specified readProc gets called when clients send MIDI to your virtual destination.

Drivers need not call this; when they create devices and entities, sources and destinations are created at that time.

After creating a virtual destination, it's a good idea to assign it the same unique ID it had the last time your application created it. (Although you should be prepared for this to fail in the unlikely event of a collision.) This will permit other clients to retain persistent references to your virtual destination more easily.

See the discussion of kMIDIPropertyAdvanceScheduleTimeMuSec for notes about the relationship between when a sender sends MIDI to the destination and when it is received.

See Also

Using MIDI Endpoints

func MIDIEndpointDispose(MIDIEndpointRef) -> OSStatus

Disposes a virtual source or destination your client created.

func MIDIGetDestination(Int) -> MIDIEndpointRef

Returns one of the destinations in the system.

func MIDIGetNumberOfDestinations() -> Int

Returns the number of destinations in the system.

func MIDIGetNumberOfSources() -> Int

Returns the number of sources in the system.

func MIDIGetSource(Int) -> MIDIEndpointRef

Returns one of the sources in the system.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software