pub struct MIDIDriverInterface {Show 13 fields
pub QueryInterface: unsafe extern "C-unwind" fn(NonNull<c_void>, REFIID, *mut LPVOID) -> HRESULT,
pub AddRef: unsafe extern "C-unwind" fn(NonNull<c_void>) -> ULONG,
pub Release: unsafe extern "C-unwind" fn(NonNull<c_void>) -> ULONG,
pub FindDevices: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIDeviceListRef) -> i32,
pub Start: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIDeviceListRef) -> i32,
pub Stop: unsafe extern "C-unwind" fn(MIDIDriverRef) -> i32,
pub Configure: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIDeviceRef) -> i32,
pub Send: unsafe extern "C-unwind" fn(MIDIDriverRef, NonNull<MIDIPacketList>, NonNull<c_void>, NonNull<c_void>) -> i32,
pub EnableSource: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIEndpointRef, u8) -> i32,
pub Flush: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIEndpointRef, *mut c_void, *mut c_void) -> i32,
pub Monitor: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIEndpointRef, NonNull<MIDIPacketList>) -> i32,
pub SendPackets: unsafe extern "C-unwind" fn(MIDIDriverRef, NonNull<MIDIEventList>, NonNull<c_void>, NonNull<c_void>) -> i32,
pub MonitorEvents: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIEndpointRef, NonNull<MIDIEventList>) -> i32,
/* private fields */
}MIDIDriver and MIDIServices and objc2-core-foundation only.Expand description
The COM-style interface to a MIDI driver.
This is the function table interface to a MIDI driver. Version 1 and 2 drivers use this same table of function pointers (except as noted).
Drivers which support multiple version interfaces can tell which version of the server is running by checking to see whether kMIDIDriverInterface2ID or kMIDIDriverInterfaceID is passed to the factory function. If the version 1 interface is requested, the driver should behave as if it is a version 1 driver.
See also Apple’s documentation
Fields§
§QueryInterface: unsafe extern "C-unwind" fn(NonNull<c_void>, REFIID, *mut LPVOID) -> HRESULT§AddRef: unsafe extern "C-unwind" fn(NonNull<c_void>) -> ULONG§Release: unsafe extern "C-unwind" fn(NonNull<c_void>) -> ULONG§FindDevices: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIDeviceListRef) -> i32This is only called for version 1 drivers. The server is requesting that the driver detect the devices which are present. For each device present, the driver should create a MIDIDeviceRef with entities, using MIDIDeviceCreate and MIDIDeviceAddEntity, and add the device to the supplied MIDIDeviceListRef, using MIDIDeviceListAddDevice.
The driver should not retain any references to the created devices and entities.
Start: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIDeviceListRef) -> i32The server is telling the driver to begin MIDI I/O.
The provided device list contains the devices which were previously located by FindDevices (in the case of a version 1 driver), or the devices which are owned by this driver and are currently in the current MIDISetup (for version 2 drivers).
The provided devices may or may not still be present. A version 1 driver should attempt to use as many of the devices as are actually present.
A version 2 driver may make calls such as MIDISetupAddDevice, MIDIDeviceAddEntity, MIDIDeviceRemoveEntity to dynamically modify the system’s current state. For devices in the provided device list which are not present, the driver should set their kMIDIPropertyOffline property to 1. A version 2 driver may also set up notifications when the IORegistry changes, to detect connection and disconnection of devices it wishes to control. At these times also, the driver may change the devices’ kMIDIPropertyOffline, and dynamically modify the system’s current state to reflect the devices which are present. When passing a CFRunLoopRef to IOKit for notification purposes, the driver must use the server’s main runloop, which is obtained with CFRunLoopGetCurrent().
The driver will probably want to iterate through the destination endpoints and assign their driver refCons, so as to identify multiple destinations when Send() is called.
The provided device list remains owned by the system and can be assumed to contain only devices owned by this driver. The driver may retain references to the devices in this list and any it creates while running.
Stop: unsafe extern "C-unwind" fn(MIDIDriverRef) -> i32The server is telling the driver to terminate MIDI I/O. All I/O operations that were begun in Start, or as a result of a subsequent IOKit notification, should be terminated.
Configure: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIDeviceRef) -> i32not currently used
Send: unsafe extern "C-unwind" fn(MIDIDriverRef, NonNull<MIDIPacketList>, NonNull<c_void>, NonNull<c_void>) -> i32Send a MIDIPacketList to the destination endpoint whose refCons are being passed as arguments.
EnableSource: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIEndpointRef, u8) -> i32A client has opened or closed a connection, and now the server is telling the driver that input from a particular source either does or does not have any listeners in the system. The driver may use this information to decide whether to pass messages from the source to the server, and it may even be able to tell the source hardware not to generate incoming MIDI I/O for that source.
Flush: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIEndpointRef, *mut c_void, *mut c_void) -> i32Only for version 2 drivers (new for CoreMIDI 1.1).
Drivers which support schedule-ahead, when receiving this message, should unschedule all pending output to the specified destination. If the destination is null/0, the driver should unschedule all pending output to all destinations.
Monitor: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIEndpointRef, NonNull<MIDIPacketList>) -> i32Only for version 2 drivers (new for CoreMIDI 1.1).
Some specialized drivers (e.g. a MIDI monitor display) may wish to intercept and look at all outgoing MIDI messages. After a driver calls MIDIDriverEnableMonitoring(true) on itself, this function is called with the outgoing MIDI packets for all destinations in the system. The Monitor function cannot rely on the MIDI events arriving in order, due to MIDIServer’s schedule-ahead facilities.
SendPackets: unsafe extern "C-unwind" fn(MIDIDriverRef, NonNull<MIDIEventList>, NonNull<c_void>, NonNull<c_void>) -> i32Only for version 3 drivers (new for macOS 12.0).
Send a MIDIEventList to the destination endpoint whose refCons are being passed as arguments.
MonitorEvents: unsafe extern "C-unwind" fn(MIDIDriverRef, MIDIEndpointRef, NonNull<MIDIEventList>) -> i32Only for version 3 drivers (new for macOS 12.0).
Same as Monitor but uses MIDEventList, whose protocol may vary from MIDI 1.0.
Trait Implementations§
Source§impl Clone for MIDIDriverInterface
impl Clone for MIDIDriverInterface
Source§fn clone(&self) -> MIDIDriverInterface
fn clone(&self) -> MIDIDriverInterface
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MIDIDriverInterface
impl Debug for MIDIDriverInterface
Source§impl Encode for MIDIDriverInterface
Available on crate feature objc2 only.
impl Encode for MIDIDriverInterface
objc2 only.Source§impl PartialEq for MIDIDriverInterface
impl PartialEq for MIDIDriverInterface
Source§impl RefEncode for MIDIDriverInterface
Available on crate feature objc2 only.
impl RefEncode for MIDIDriverInterface
objc2 only.