Function

MIDISourceCreate(_:_:_:)

Creates a virtual source in a client.

Declaration

func MIDISourceCreate(_ client: MIDIClientRef, _ name: CFString, _ outSrc: UnsafeMutablePointer<MIDIEndpointRef>) -> OSStatus

Parameters

client

The client owning the virtual source.

name

The name of the virtual source.

outSrc

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

Return Value

A result code.

Discussion

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

After creating a virtual source, use MIDIReceived to transmit MIDI messages from your virtual source to any clients connected to the virtual source.

After creating a virtual source, 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 source more easily.

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.