MIDISourceCreateWithProtocol

Function MIDISourceCreateWithProtocol 

Source
pub unsafe extern "C-unwind" fn MIDISourceCreateWithProtocol(
    client: MIDIClientRef,
    name: &CFString,
    protocol: MIDIProtocolID,
    out_src: NonNull<MIDIEndpointRef>,
) -> i32
Available on crate features MIDIServices and objc2-core-foundation only.
Expand description

Creates a virtual source in a client.

Parameter client: The client owning the virtual source.

Parameter name: The name of the virtual source.

Parameter protocol: The MIDI protocol variant to be sent from this source. The system will automatically convert from this protocol to the protocol of the destination as needed.

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

Returns: An OSStatus result code.

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 MIDIReceivedEventList 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.

§Safety

out_src must be a valid pointer.