dymokomi/luce-midi
Source of release 0.1.0
## CoreMIDI, as much as listing endpoints, an input port with the legacy
## MIDIPacketList read proc, and MIDISend need; with the CoreFoundation
## string calls the endpoint properties take and the mach clock packet
## timestamps count in. Objects (clients, ports, endpoints) are u32 refs.
import c
## A MIDINotification's fixed head; the rest depends on `id`.
pub extern struct Notification:
pub id: i32
pub size: u32
pub type ReadProc = func(const void*, void*?, void*?) -> unit
pub type NotifyProc = func(const Notification*, void*?) -> unit
pub extern struct Timebase:
pub numer: u32
pub denom: u32
## kMIDIMsg... notification ids.
pub let setup_changed: i32 = 1
pub let object_added: i32 = 2
pub let object_removed: i32 = 3
pub let property_changed: i32 = 4
pub let utf8: u32 = 0x08000100
pub extern var kMIDIPropertyUniqueID: void*
pub extern var kMIDIPropertyDisplayName: void*
pub extern var kMIDIPropertyOffline: void*
pub extern func MIDIClientCreate(name: void*, notify: NotifyProc?, context: void*?, out client: u32) -> i32
pub extern func MIDIClientDispose(client: u32) -> i32
pub extern func MIDIInputPortCreate(client: u32, name: void*, read: ReadProc, context: void*?, out port: u32) -> i32
pub extern func MIDIOutputPortCreate(client: u32, name: void*, out port: u32) -> i32
pub extern func MIDIPortDispose(port: u32) -> i32
pub extern func MIDIPortConnectSource(port: u32, source: u32, context: void*?) -> i32
pub extern func MIDIPortDisconnectSource(port: u32, source: u32) -> i32
pub extern func MIDIGetNumberOfSources() -> usize
pub extern func MIDIGetSource(index: usize) -> u32
pub extern func MIDIGetNumberOfDestinations() -> usize
pub extern func MIDIGetDestination(index: usize) -> u32
pub extern func MIDIObjectGetIntegerProperty(object: u32, property: void*, out value: i32) -> i32
pub extern func MIDIObjectGetStringProperty(object: u32, property: void*, out value: void*?) -> i32
pub extern func MIDISend(port: u32, destination: u32, list: const void*) -> i32
pub extern func CFStringCreateWithCString(allocator: void*?, text: c.str, encoding: u32) -> void*?
pub extern func CFStringGetCString(string: void*, buffer: u8*, size: isize, encoding: u32) -> bool
pub extern func CFRelease(object: void*)
pub extern func mach_absolute_time() -> u64
pub extern func mach_timebase_info(info: Timebase*) -> i32