objc2_core_midi/generated/MIDIServices.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-core-foundation")]
8use objc2_core_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiinvalidclient?language=objc)
13pub const kMIDIInvalidClient: OSStatus = -10830;
14/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiinvalidport?language=objc)
15pub const kMIDIInvalidPort: OSStatus = -10831;
16/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiwrongendpointtype?language=objc)
17pub const kMIDIWrongEndpointType: OSStatus = -10832;
18/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidinoconnection?language=objc)
19pub const kMIDINoConnection: OSStatus = -10833;
20/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiunknownendpoint?language=objc)
21pub const kMIDIUnknownEndpoint: OSStatus = -10834;
22/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiunknownproperty?language=objc)
23pub const kMIDIUnknownProperty: OSStatus = -10835;
24/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiwrongpropertytype?language=objc)
25pub const kMIDIWrongPropertyType: OSStatus = -10836;
26/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidinocurrentsetup?language=objc)
27pub const kMIDINoCurrentSetup: OSStatus = -10837;
28/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidimessagesenderr?language=objc)
29pub const kMIDIMessageSendErr: OSStatus = -10838;
30/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiserverstarterr?language=objc)
31pub const kMIDIServerStartErr: OSStatus = -10839;
32/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidisetupformaterr?language=objc)
33pub const kMIDISetupFormatErr: OSStatus = -10840;
34/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiwrongthread?language=objc)
35pub const kMIDIWrongThread: OSStatus = -10841;
36/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiobjectnotfound?language=objc)
37pub const kMIDIObjectNotFound: OSStatus = -10842;
38/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiidnotunique?language=objc)
39pub const kMIDIIDNotUnique: OSStatus = -10843;
40/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidinotpermitted?language=objc)
41pub const kMIDINotPermitted: OSStatus = -10844;
42/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiunknownerror?language=objc)
43pub const kMIDIUnknownError: OSStatus = -10845;
44
45/// The base class of many CoreMIDI objects.
46///
47/// MIDIObject is the base class for many of the objects in CoreMIDI. They have properties,
48/// and often an "owner" object, from which they inherit any properties they do not
49/// themselves have.
50///
51/// Developers may add their own private properties, whose names must begin with their
52/// company's inverted domain name, as in Java package names, but with underscores instead
53/// of dots, e.g.: com_apple_APrivateAppleProperty
54///
55/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiobjectref?language=objc)
56pub type MIDIObjectRef = u32;
57
58/// An object maintaining per-client state.
59///
60/// Derives from MIDIObjectRef, does not have an owner object.
61///
62/// To use CoreMIDI, an application creates a MIDIClientRef, to which it can add
63/// MIDIPortRef's, through which it can send and receive MIDI.
64///
65/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiclientref?language=objc)
66pub type MIDIClientRef = MIDIObjectRef;
67
68/// A MIDI connection port owned by a client.
69///
70/// Derives from MIDIObjectRef, owned by a MIDIClientRef.
71///
72/// A MIDIPortRef, which may be an input port or output port, is an object through which a
73/// client may communicate with any number of MIDI sources or destinations.
74///
75/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiportref?language=objc)
76pub type MIDIPortRef = MIDIObjectRef;
77
78/// A MIDI device or external device, containing entities.
79///
80/// Derives from MIDIObjectRef, does not have an owner object.
81///
82/// A MIDI device, which either attaches directly to the computer and is controlled by a
83/// MIDI driver, or which is "external," meaning that it is connected to a driver-controlled
84/// device via a standard MIDI cable.
85///
86/// A MIDIDeviceRef has properties and contains MIDIEntityRef's.
87///
88/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midideviceref?language=objc)
89pub type MIDIDeviceRef = MIDIObjectRef;
90
91/// A MIDI entity, owned by a device, containing endpoints.
92///
93/// Derives from MIDIObjectRef, owned by a MIDIDeviceRef.
94///
95/// Devices may have multiple logically distinct sub-components, e.g. a MIDI synthesizer and
96/// a pair of MIDI ports, both addressable via a USB port.
97///
98/// By grouping a device's endpoints into entities, the system has enough information for an
99/// application to make reasonable assumptions about how to communicate in a bi-directional
100/// manner with each entity, as is desirable in MIDI librarian applications.
101///
102/// These sub-components are MIDIEntityRef's.
103///
104/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midientityref?language=objc)
105pub type MIDIEntityRef = MIDIObjectRef;
106
107/// A MIDI source or destination, owned by an entity.
108///
109/// Derives from MIDIObjectRef, owned by a MIDIEntityRef, unless it is a virtual endpoint,
110/// in which case there is no owning entity.
111///
112/// Entities have any number of MIDIEndpointRef's, sources and destinations of 16-channel
113/// MIDI streams.
114///
115/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiendpointref?language=objc)
116pub type MIDIEndpointRef = MIDIObjectRef;
117
118/// A host clock time.
119///
120/// A host clock time representing the time of an event, as returned by
121/// mach_absolute_time() or UpTime().
122///
123/// Since MIDI applications will tend to do a fair amount of math with the times of events,
124/// it's more convenient to use a UInt64 than an AbsoluteTime.
125///
126/// See CoreAudio/HostTime.h.
127///
128/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/miditimestamp?language=objc)
129pub type MIDITimeStamp = u64;
130
131/// Signifies the type of a MIDIObject.
132///
133/// Signifies the real type of a MIDIObjectRef instance.
134///
135/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiobjecttype?language=objc)
136// NS_ENUM
137#[repr(transparent)]
138#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
139pub struct MIDIObjectType(pub i32);
140impl MIDIObjectType {
141 #[doc(alias = "kMIDIObjectType_Other")]
142 pub const Other: Self = Self(-1);
143 #[doc(alias = "kMIDIObjectType_Device")]
144 pub const Device: Self = Self(0);
145 #[doc(alias = "kMIDIObjectType_Entity")]
146 pub const Entity: Self = Self(1);
147 #[doc(alias = "kMIDIObjectType_Source")]
148 pub const Source: Self = Self(2);
149 #[doc(alias = "kMIDIObjectType_Destination")]
150 pub const Destination: Self = Self(3);
151 #[doc(alias = "kMIDIObjectType_ExternalDevice")]
152 pub const ExternalDevice: Self = Self(0x10 | MIDIObjectType::Device.0);
153 #[doc(alias = "kMIDIObjectType_ExternalEntity")]
154 pub const ExternalEntity: Self = Self(0x10 | MIDIObjectType::Entity.0);
155 #[doc(alias = "kMIDIObjectType_ExternalSource")]
156 pub const ExternalSource: Self = Self(0x10 | MIDIObjectType::Source.0);
157 #[doc(alias = "kMIDIObjectType_ExternalDestination")]
158 pub const ExternalDestination: Self = Self(0x10 | MIDIObjectType::Destination.0);
159}
160
161#[cfg(feature = "objc2")]
162unsafe impl Encode for MIDIObjectType {
163 const ENCODING: Encoding = i32::ENCODING;
164}
165
166#[cfg(feature = "objc2")]
167unsafe impl RefEncode for MIDIObjectType {
168 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
169}
170
171/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiobjecttype_externalmask?language=objc)
172pub static kMIDIObjectType_ExternalMask: MIDIObjectType = MIDIObjectType(0x10);
173
174/// A unique identifier for a MIDIObjectRef.
175///
176/// An integer which uniquely identifies a MIDIObjectRef.
177///
178/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiuniqueid?language=objc)
179pub type MIDIUniqueID = i32;
180
181/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiinvaliduniqueid?language=objc)
182pub const kMIDIInvalidUniqueID: MIDIUniqueID = 0;
183
184/// Specifies a MIDI protocol variant.
185///
186/// MIDI 1.0.
187///
188/// MIDI 2.0.
189///
190/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiprotocolid?language=objc)
191// NS_ENUM
192#[repr(transparent)]
193#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
194pub struct MIDIProtocolID(pub i32);
195impl MIDIProtocolID {
196 #[doc(alias = "kMIDIProtocol_1_0")]
197 pub const Protocol_1_0: Self = Self(1);
198 #[doc(alias = "kMIDIProtocol_2_0")]
199 pub const Protocol_2_0: Self = Self(2);
200}
201
202#[cfg(feature = "objc2")]
203unsafe impl Encode for MIDIProtocolID {
204 const ENCODING: Encoding = i32::ENCODING;
205}
206
207#[cfg(feature = "objc2")]
208unsafe impl RefEncode for MIDIProtocolID {
209 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
210}
211
212/// A callback function for notifying clients of state changes.
213///
214/// This callback function is called when some aspect of the current MIDI setup changes. It
215/// is called on the runloop (thread) on which MIDIClientCreate was first called.
216///
217///
218/// Parameter `message`: A structure containing information about what changed.
219///
220/// Parameter `refCon`: The client's refCon passed to MIDIClientCreate.
221///
222/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinotifyproc?language=objc)
223pub type MIDINotifyProc =
224 Option<unsafe extern "C-unwind" fn(NonNull<MIDINotification>, *mut c_void)>;
225
226/// A callback block for notifying clients of state changes.
227///
228/// This block is called when some aspect of the current MIDI setup changes. It
229/// is called on an arbitrary thread chosen by the implementation; thread-safety
230/// is the responsibility of the block.
231///
232///
233/// Parameter `message`: A structure containing information about what changed.
234///
235/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinotifyblock?language=objc)
236#[cfg(feature = "block2")]
237pub type MIDINotifyBlock = *mut block2::DynBlock<dyn Fn(NonNull<MIDINotification>)>;
238
239/// A block receiving MIDI input.
240///
241/// This is a callback block through which a client receives incoming MIDI messages.
242///
243/// A MIDIReceiveBlock is passed to the MIDIInputPortCreateWithProtocol and
244/// MIDIDestinationCreateWithProtocol functions. The CoreMIDI framework will create a
245/// high-priority receive thread on your client's behalf, and from that thread, your
246/// MIDIReceiveBlock will be called when incoming MIDI messages arrive.
247///
248///
249/// Parameter `evtlist`: The incoming MIDI message(s).
250///
251/// Parameter `srcConnRefCon`: A refCon you passed to MIDIPortConnectSource, which
252/// identifies the source of the data.
253///
254/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midireceiveblock?language=objc)
255#[cfg(feature = "block2")]
256pub type MIDIReceiveBlock = *mut block2::DynBlock<dyn Fn(NonNull<MIDIEventList>, *mut c_void)>;
257
258/// A function receiving MIDI input.
259///
260/// This is a callback function through which a client receives incoming MIDI messages.
261///
262/// A MIDIReadProc function pointer is passed to the MIDIInputPortCreate and
263/// MIDIDestinationCreate functions. The CoreMIDI framework will create a high-priority
264/// receive thread on your client's behalf, and from that thread, your MIDIReadProc will be
265/// called when incoming MIDI messages arrive.
266///
267///
268/// Parameter `pktlist`: The incoming MIDI message(s).
269///
270/// Parameter `readProcRefCon`: The refCon you passed to MIDIInputPortCreate or
271/// MIDIDestinationCreate
272///
273/// Parameter `srcConnRefCon`: A refCon you passed to MIDIPortConnectSource, which
274/// identifies the source of the data.
275///
276/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midireadproc?language=objc)
277#[deprecated = "use MIDIReceiveBlock and MIDIEventLists"]
278pub type MIDIReadProc =
279 Option<unsafe extern "C-unwind" fn(NonNull<MIDIPacketList>, *mut c_void, *mut c_void)>;
280
281/// A block receiving MIDI input.
282///
283/// This is a callback block through which a client receives incoming MIDI messages.
284///
285/// A MIDIReadBlock is passed to the MIDIInputPortCreateWithBlock and
286/// MIDIDestinationCreateWithBlock functions. The CoreMIDI framework will create a
287/// high-priority receive thread on your client's behalf, and from that thread, your
288/// MIDIReadProc will be called when incoming MIDI messages arrive.
289///
290///
291/// Parameter `pktlist`: The incoming MIDI message(s).
292///
293/// Parameter `srcConnRefCon`: A refCon you passed to MIDIPortConnectSource, which
294/// identifies the source of the data.
295///
296/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midireadblock?language=objc)
297#[deprecated = "use MIDIReceiveBlock and MIDIEventLists"]
298#[cfg(feature = "block2")]
299pub type MIDIReadBlock = *mut block2::DynBlock<dyn Fn(NonNull<MIDIPacketList>, *mut c_void)>;
300
301/// A function called when a system-exclusive event has been completely sent.
302///
303/// Callback function to notify the client of the completion of a call to MIDISendSysex.
304///
305///
306/// Parameter `request`: The MIDISysexSendRequest which has completed, or been
307/// aborted.
308///
309/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicompletionproc?language=objc)
310pub type MIDICompletionProc = Option<unsafe extern "C-unwind" fn(NonNull<MIDISysexSendRequest>)>;
311
312/// A function called when a UMP system-exclusive or system-exclusive 8-bit event has been completely sent.
313///
314/// Callback function to notify the client of the completion of a call to MIDISendSysexUMP or MIDISendSysex8.
315///
316///
317/// Parameter `request`: The MIDISysexSendRequestUMP which has completed, or been
318/// aborted.
319///
320/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicompletionprocump?language=objc)
321pub type MIDICompletionProcUMP =
322 Option<unsafe extern "C-unwind" fn(NonNull<MIDISysexSendRequestUMP>)>;
323
324/// A series of simultaneous MIDI events in UMP format.
325///
326///
327/// WARNING: When using MIDIEventPacket in C++ be aware of the following:
328///
329/// MIDIEventPacket is a variable-length struct and should ALWAYS be passed-by-pointer
330/// rather than passed-by-reference. Conversion from a MIDIEventPacket reference to a pointer
331/// is undefined behavior and can lead to the unintended truncation of data.
332///
333/// Field: timeStamp
334/// The time at which the events occurred, if receiving MIDI,
335/// or, if sending MIDI, the time at which the events are to
336/// be played. Zero means "now." The time stamp applies
337/// applies to each UMP in the word stream.
338/// Field: wordCount
339/// The number of valid MIDI 32-bit words which follow, in data. (It
340/// may be larger than 64 words if the packet is dynamically
341/// allocated.)
342/// Field: words
343/// A variable-length stream of native-endian 32-bit Universal MIDI Packets.
344/// Running status is not allowed. In the case of system-exclusive
345/// messages, a packet may only contain a single message, or portion
346/// of one, with no other MIDI events.
347///
348/// Messages must always be syntactically complete; for example, for 64-bit
349/// message types, both words must be present in the same packet. The same
350/// MIDI message constraints from above apply here.
351///
352/// (This is declared to be 64 words in length so clients don't have to
353/// create custom data structures in simple situations.)
354///
355/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midieventpacket?language=objc)
356#[repr(C, packed(4))]
357#[derive(Clone, Copy, Debug, PartialEq)]
358pub struct MIDIEventPacket {
359 pub timeStamp: MIDITimeStamp,
360 pub wordCount: u32,
361 pub words: [u32; 64],
362}
363
364#[cfg(feature = "objc2")]
365unsafe impl Encode for MIDIEventPacket {
366 const ENCODING: Encoding = Encoding::Struct(
367 "MIDIEventPacket",
368 &[
369 <MIDITimeStamp>::ENCODING,
370 <u32>::ENCODING,
371 <[u32; 64]>::ENCODING,
372 ],
373 );
374}
375
376#[cfg(feature = "objc2")]
377unsafe impl RefEncode for MIDIEventPacket {
378 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
379}
380
381/// A variable-length list of MIDIEventPackets.
382///
383///
384/// The timestamps in the list must be in ascending order.
385///
386/// Note that the packets in the list, while defined as an array, may not be
387/// accessed as an array, since they are variable-length. To iterate through
388/// the packets in an event list, use a loop such as:
389///
390/// ```text
391/// MIDIEventPacket *packet =
392/// &packetList
393/// ->packet[0];
394/// for (unsigned i = 0; i
395/// <
396/// packetList->numPackets; ++i) {
397/// ...
398/// packet = MIDIEventPacketNext(packet);
399/// }
400/// ```
401///
402/// WARNING: When using MIDIEventList in C++ be aware of the following:
403///
404/// MIDIEventList is a variable-length struct and should ALWAYS be passed-by-pointer
405/// rather than passed-by-reference. Conversion from a MIDIEventList reference to a pointer
406/// is undefined behavior and can lead to the unintended truncation of data.
407///
408/// Field: protocol
409/// The MIDI protocol variant of the events in the list.
410/// Field: numPackets
411/// The number of MIDIEventPacket structs in the list.
412/// Field: packet
413/// An open-ended array of variable-length MIDIEventPacket structs.
414///
415/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midieventlist?language=objc)
416#[repr(C)]
417#[derive(Clone, Copy, Debug, PartialEq)]
418pub struct MIDIEventList {
419 pub protocol: MIDIProtocolID,
420 pub numPackets: u32,
421 pub packet: [MIDIEventPacket; 1],
422}
423
424#[cfg(feature = "objc2")]
425unsafe impl Encode for MIDIEventList {
426 const ENCODING: Encoding = Encoding::Struct(
427 "MIDIEventList",
428 &[
429 <MIDIProtocolID>::ENCODING,
430 <u32>::ENCODING,
431 <[MIDIEventPacket; 1]>::ENCODING,
432 ],
433 );
434}
435
436#[cfg(feature = "objc2")]
437unsafe impl RefEncode for MIDIEventList {
438 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
439}
440
441/// A collection of simultaneous MIDI events.
442///
443///
444/// WARNING: When using MIDIPacket in C++ be aware of the following:
445///
446/// MIDIPacket is a variable-length struct and should ALWAYS be passed-by-pointer
447/// rather than passed-by-reference. Conversion from a MIDIPacket reference to a pointer
448/// is undefined behavior and can lead to the unintended truncation of data.
449///
450/// Field: timeStamp
451/// The time at which the events occurred, if receiving MIDI,
452/// or, if sending MIDI, the time at which the events are to
453/// be played. Zero means "now." The time stamp applies
454/// to the first MIDI byte in the packet.
455/// Field: length
456/// The number of valid MIDI bytes which follow, in data. (It
457/// may be larger than 256 bytes if the packet is dynamically
458/// allocated.)
459/// Field: data
460/// A variable-length stream of MIDI messages. Running status
461/// is not allowed. In the case of system-exclusive
462/// messages, a packet may only contain a single message, or
463/// portion of one, with no other MIDI events.
464///
465/// The MIDI messages in the packet must always be complete,
466/// except for system-exclusive.
467///
468/// (This is declared to be 256 bytes in length so clients
469/// don't have to create custom data structures in simple
470/// situations.)
471///
472/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midipacket?language=objc)
473#[repr(C, packed(4))]
474#[derive(Clone, Copy, Debug, PartialEq)]
475pub struct MIDIPacket {
476 pub timeStamp: MIDITimeStamp,
477 pub length: u16,
478 pub data: [Byte; 256],
479}
480
481#[cfg(feature = "objc2")]
482unsafe impl Encode for MIDIPacket {
483 const ENCODING: Encoding = Encoding::Struct(
484 "MIDIPacket",
485 &[
486 <MIDITimeStamp>::ENCODING,
487 <u16>::ENCODING,
488 <[Byte; 256]>::ENCODING,
489 ],
490 );
491}
492
493#[cfg(feature = "objc2")]
494unsafe impl RefEncode for MIDIPacket {
495 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
496}
497
498/// A list of MIDI events being received from, or being sent to,
499/// one endpoint.
500///
501///
502/// The timestamps in the packet list must be in ascending order.
503///
504/// Note that the packets in the list, while defined as an array, may not be
505/// accessed as an array, since they are variable-length. To iterate through
506/// the packets in a packet list, use a loop such as:
507///
508/// ```text
509/// MIDIPacket *packet =
510/// &packetList
511/// ->packet[0];
512/// for (unsigned i = 0; i
513/// <
514/// packetList->numPackets; ++i) {
515/// ...
516/// packet = MIDIPacketNext(packet);
517/// }
518/// ```
519///
520/// The MIDIPacketNext macro is especially important when considering that
521/// the alignment requirements of MIDIPacket may differ between CPU architectures.
522/// On Intel and PowerPC, MIDIPacket is unaligned. On ARM, MIDIPacket must be
523/// 4-byte aligned.
524///
525/// WARNING: When using MIDIPacketList in C++ be aware of the following:
526///
527/// MIDIPacketList is a variable-length struct and should ALWAYS be passed-by-pointer
528/// rather than passed-by-reference. Conversion from a MIDIPacketList reference to a pointer
529/// is undefined behavior and can lead to the unintended truncation of data.
530///
531/// Field: numPackets
532/// The number of MIDIPackets in the list.
533/// Field: packet
534/// An open-ended array of variable-length MIDIPackets.
535///
536/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midipacketlist?language=objc)
537#[repr(C)]
538#[derive(Clone, Copy, Debug, PartialEq)]
539pub struct MIDIPacketList {
540 pub numPackets: u32,
541 pub packet: [MIDIPacket; 1],
542}
543
544#[cfg(feature = "objc2")]
545unsafe impl Encode for MIDIPacketList {
546 const ENCODING: Encoding = Encoding::Struct(
547 "MIDIPacketList",
548 &[<u32>::ENCODING, <[MIDIPacket; 1]>::ENCODING],
549 );
550}
551
552#[cfg(feature = "objc2")]
553unsafe impl RefEncode for MIDIPacketList {
554 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
555}
556
557/// A request to transmit a system-exclusive event.
558///
559///
560/// This represents a request to send a single system-exclusive MIDI event to
561/// a MIDI destination asynchronously.
562///
563/// Field: destination
564/// The endpoint to which the event is to be sent.
565/// Field: data
566/// Initially, a pointer to the sys-ex event to be sent.
567/// MIDISendSysex will advance this pointer as bytes are
568/// sent.
569/// Field: bytesToSend
570/// Initially, the number of bytes to be sent. MIDISendSysex
571/// will decrement this counter as bytes are sent.
572/// Field: complete
573/// The client may set this to true at any time to abort
574/// transmission. The implementation sets this to true when
575/// all bytes have been sent.
576/// Field: completionProc
577/// Called when all bytes have been sent, or after the client
578/// has set complete to true.
579/// Field: completionRefCon
580/// Passed as a refCon to completionProc.
581///
582/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midisysexsendrequest?language=objc)
583#[repr(C)]
584#[allow(unpredictable_function_pointer_comparisons)]
585#[derive(Clone, Copy, Debug, PartialEq)]
586pub struct MIDISysexSendRequest {
587 pub destination: MIDIEndpointRef,
588 pub data: NonNull<Byte>,
589 pub bytesToSend: u32,
590 pub complete: Boolean,
591 pub reserved: [Byte; 3],
592 pub completionProc: MIDICompletionProc,
593 pub completionRefCon: *mut c_void,
594}
595
596#[cfg(feature = "objc2")]
597unsafe impl Encode for MIDISysexSendRequest {
598 const ENCODING: Encoding = Encoding::Struct(
599 "MIDISysexSendRequest",
600 &[
601 <MIDIEndpointRef>::ENCODING,
602 <NonNull<Byte>>::ENCODING,
603 <u32>::ENCODING,
604 <Boolean>::ENCODING,
605 <[Byte; 3]>::ENCODING,
606 <MIDICompletionProc>::ENCODING,
607 <*mut c_void>::ENCODING,
608 ],
609 );
610}
611
612#[cfg(feature = "objc2")]
613unsafe impl RefEncode for MIDISysexSendRequest {
614 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
615}
616
617/// A request to transmit a UMP system-exclusive event.
618///
619///
620/// This represents a request to send a single UMP system-exclusive MIDI event to
621/// a MIDI destination asynchronously.
622///
623/// Field: destination
624/// The endpoint to which the event is to be sent.
625/// Field: words
626/// Initially, a pointer to the UMP SysEx event to be sent.
627/// MIDISendUMPSysex will advance this pointer as data is
628/// sent.
629/// Field: wordsToSend
630/// Initially, the number of words to be sent. MIDISendUMPSysex
631/// will decrement this counter as data is sent.
632/// Field: complete
633/// The client may set this to true at any time to abort
634/// transmission. The implementation sets this to true when
635/// all data been transmitted.
636/// Field: completionProc
637/// Called when all bytes have been sent, or after the client
638/// has set complete to true.
639/// Field: completionRefCon
640/// Passed as a refCon to completionProc.
641///
642/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midisysexsendrequestump?language=objc)
643#[repr(C)]
644#[allow(unpredictable_function_pointer_comparisons)]
645#[derive(Clone, Copy, Debug, PartialEq)]
646pub struct MIDISysexSendRequestUMP {
647 pub destination: MIDIEndpointRef,
648 pub words: NonNull<u32>,
649 pub wordsToSend: u32,
650 pub complete: Boolean,
651 pub completionProc: MIDICompletionProcUMP,
652 pub completionRefCon: *mut c_void,
653}
654
655#[cfg(feature = "objc2")]
656unsafe impl Encode for MIDISysexSendRequestUMP {
657 const ENCODING: Encoding = Encoding::Struct(
658 "MIDISysexSendRequestUMP",
659 &[
660 <MIDIEndpointRef>::ENCODING,
661 <NonNull<u32>>::ENCODING,
662 <u32>::ENCODING,
663 <Boolean>::ENCODING,
664 <MIDICompletionProcUMP>::ENCODING,
665 <*mut c_void>::ENCODING,
666 ],
667 );
668}
669
670#[cfg(feature = "objc2")]
671unsafe impl RefEncode for MIDISysexSendRequestUMP {
672 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
673}
674
675/// Signifies the type of a MIDINotification.
676///
677///
678/// Some aspect of the current MIDISetup has changed. No data. Should ignore this message if
679/// messages 2-6 are handled.
680///
681/// A device, entity or endpoint was added. Structure is MIDIObjectAddRemoveNotification. New in
682/// Mac OS X 10.2.
683///
684/// A device, entity or endpoint was removed. Structure is MIDIObjectAddRemoveNotification. New
685/// in Mac OS X 10.2.
686///
687/// An object's property was changed. Structure is MIDIObjectPropertyChangeNotification. New in
688/// Mac OS X 10.2.
689///
690/// A persistent MIDI Thru connection was created or destroyed. No data. New in Mac OS X 10.2.
691///
692/// No data. New in Mac OS X 10.2.
693///
694/// A driver I/O error occurred.
695///
696/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinotificationmessageid?language=objc)
697// NS_ENUM
698#[repr(transparent)]
699#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
700pub struct MIDINotificationMessageID(pub i32);
701impl MIDINotificationMessageID {
702 #[doc(alias = "kMIDIMsgSetupChanged")]
703 pub const MsgSetupChanged: Self = Self(1);
704 #[doc(alias = "kMIDIMsgObjectAdded")]
705 pub const MsgObjectAdded: Self = Self(2);
706 #[doc(alias = "kMIDIMsgObjectRemoved")]
707 pub const MsgObjectRemoved: Self = Self(3);
708 #[doc(alias = "kMIDIMsgPropertyChanged")]
709 pub const MsgPropertyChanged: Self = Self(4);
710 #[doc(alias = "kMIDIMsgThruConnectionsChanged")]
711 pub const MsgThruConnectionsChanged: Self = Self(5);
712 #[doc(alias = "kMIDIMsgSerialPortOwnerChanged")]
713 pub const MsgSerialPortOwnerChanged: Self = Self(6);
714 #[doc(alias = "kMIDIMsgIOError")]
715 pub const MsgIOError: Self = Self(7);
716 #[doc(alias = "kMIDIMsgInternalStart")]
717 pub const MsgInternalStart: Self = Self(0x1000);
718}
719
720#[cfg(feature = "objc2")]
721unsafe impl Encode for MIDINotificationMessageID {
722 const ENCODING: Encoding = i32::ENCODING;
723}
724
725#[cfg(feature = "objc2")]
726unsafe impl RefEncode for MIDINotificationMessageID {
727 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
728}
729
730/// A message describing a system state change.
731///
732/// A MIDINotification is a structure passed to a MIDINotifyProc or MIDINotifyBlock, when
733/// CoreMIDI wishes to inform a client of a change in the state of the system.
734///
735/// Field: messageID
736/// type of message
737/// Field: messageSize
738/// size of the entire message, including messageID and
739/// messageSize
740///
741/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinotification?language=objc)
742#[repr(C)]
743#[derive(Clone, Copy, Debug, PartialEq)]
744pub struct MIDINotification {
745 pub messageID: MIDINotificationMessageID,
746 pub messageSize: u32,
747}
748
749#[cfg(feature = "objc2")]
750unsafe impl Encode for MIDINotification {
751 const ENCODING: Encoding = Encoding::Struct(
752 "MIDINotification",
753 &[<MIDINotificationMessageID>::ENCODING, <u32>::ENCODING],
754 );
755}
756
757#[cfg(feature = "objc2")]
758unsafe impl RefEncode for MIDINotification {
759 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
760}
761
762/// A message describing the addition or removal of an object.
763///
764/// Field: messageID
765/// type of message
766/// Field: messageSize
767/// size of the entire message, including messageID and messageSize
768/// Field: parent
769/// the parent of the added or removed object (possibly NULL)
770/// Field: parentType
771/// the type of the parent object (undefined if parent is NULL)
772/// Field: child
773/// the added or removed object
774/// Field: childType
775/// the type of the added or removed object
776///
777/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiobjectaddremovenotification?language=objc)
778#[repr(C)]
779#[derive(Clone, Copy, Debug, PartialEq)]
780pub struct MIDIObjectAddRemoveNotification {
781 pub messageID: MIDINotificationMessageID,
782 pub messageSize: u32,
783 pub parent: MIDIObjectRef,
784 pub parentType: MIDIObjectType,
785 pub child: MIDIObjectRef,
786 pub childType: MIDIObjectType,
787}
788
789#[cfg(feature = "objc2")]
790unsafe impl Encode for MIDIObjectAddRemoveNotification {
791 const ENCODING: Encoding = Encoding::Struct(
792 "MIDIObjectAddRemoveNotification",
793 &[
794 <MIDINotificationMessageID>::ENCODING,
795 <u32>::ENCODING,
796 <MIDIObjectRef>::ENCODING,
797 <MIDIObjectType>::ENCODING,
798 <MIDIObjectRef>::ENCODING,
799 <MIDIObjectType>::ENCODING,
800 ],
801 );
802}
803
804#[cfg(feature = "objc2")]
805unsafe impl RefEncode for MIDIObjectAddRemoveNotification {
806 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
807}
808
809/// A message describing the addition or removal of an object.
810///
811/// Field: messageID
812/// type of message
813/// Field: messageSize
814/// size of the entire message, including messageID and messageSize
815/// Field: object
816/// the object whose property has changed
817/// Field: objectType
818/// the type of the object whose property has changed
819/// Field: propertyName
820/// the name of the changed property
821///
822/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiobjectpropertychangenotification?language=objc)
823#[cfg(feature = "objc2-core-foundation")]
824#[repr(C)]
825#[derive(Clone, Copy, Debug, PartialEq)]
826pub struct MIDIObjectPropertyChangeNotification {
827 pub messageID: MIDINotificationMessageID,
828 pub messageSize: u32,
829 pub object: MIDIObjectRef,
830 pub objectType: MIDIObjectType,
831 pub propertyName: NonNull<CFString>,
832}
833
834#[cfg(all(feature = "objc2", feature = "objc2-core-foundation"))]
835unsafe impl Encode for MIDIObjectPropertyChangeNotification {
836 const ENCODING: Encoding = Encoding::Struct(
837 "MIDIObjectPropertyChangeNotification",
838 &[
839 <MIDINotificationMessageID>::ENCODING,
840 <u32>::ENCODING,
841 <MIDIObjectRef>::ENCODING,
842 <MIDIObjectType>::ENCODING,
843 <NonNull<CFString>>::ENCODING,
844 ],
845 );
846}
847
848#[cfg(all(feature = "objc2", feature = "objc2-core-foundation"))]
849unsafe impl RefEncode for MIDIObjectPropertyChangeNotification {
850 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
851}
852
853/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiioerrornotification?language=objc)
854#[repr(C)]
855#[derive(Clone, Copy, Debug, PartialEq)]
856pub struct MIDIIOErrorNotification {
857 pub messageID: MIDINotificationMessageID,
858 pub messageSize: u32,
859 pub driverDevice: MIDIDeviceRef,
860 pub errorCode: OSStatus,
861}
862
863#[cfg(feature = "objc2")]
864unsafe impl Encode for MIDIIOErrorNotification {
865 const ENCODING: Encoding = Encoding::Struct(
866 "MIDIIOErrorNotification",
867 &[
868 <MIDINotificationMessageID>::ENCODING,
869 <u32>::ENCODING,
870 <MIDIDeviceRef>::ENCODING,
871 <OSStatus>::ENCODING,
872 ],
873 );
874}
875
876#[cfg(feature = "objc2")]
877unsafe impl RefEncode for MIDIIOErrorNotification {
878 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
879}
880
881extern "C" {
882 /// device/entity/endpoint property, string
883 ///
884 /// Devices, entities, and endpoints may all have names. The recommended way to display an
885 /// endpoint's name is to ask for the endpoint name, and display only that name if it is
886 /// unique. If it is non-unique, prepend the device name.
887 ///
888 /// A setup editor may allow the user to set the names of both driver-owned and external
889 /// devices.
890 ///
891 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyname?language=objc)
892 #[cfg(feature = "objc2-core-foundation")]
893 pub static kMIDIPropertyName: &'static CFString;
894}
895
896extern "C" {
897 /// device/endpoint property, string
898 ///
899 /// Drivers should set this property on their devices.
900 ///
901 /// Setup editors may allow the user to set this property on external devices.
902 ///
903 /// Creators of virtual endpoints may set this property on their endpoints.
904 ///
905 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertymanufacturer?language=objc)
906 #[cfg(feature = "objc2-core-foundation")]
907 pub static kMIDIPropertyManufacturer: &'static CFString;
908}
909
910extern "C" {
911 /// device/endpoint property, string
912 ///
913 /// Drivers should set this property on their devices.
914 ///
915 /// Setup editors may allow the user to set this property on external devices.
916 ///
917 /// Creators of virtual endpoints may set this property on their endpoints.
918 ///
919 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertymodel?language=objc)
920 #[cfg(feature = "objc2-core-foundation")]
921 pub static kMIDIPropertyModel: &'static CFString;
922}
923
924extern "C" {
925 /// devices, entities, endpoints all have unique ID's, integer
926 ///
927 /// The system assigns unique ID's to all objects. Creators of virtual endpoints may set
928 /// this property on their endpoints, though doing so may fail if the chosen ID is not
929 /// unique.
930 ///
931 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyuniqueid?language=objc)
932 #[cfg(feature = "objc2-core-foundation")]
933 pub static kMIDIPropertyUniqueID: &'static CFString;
934}
935
936extern "C" {
937 /// device/entity property, integer
938 ///
939 /// The entity's system-exclusive ID, in user-visible form
940 ///
941 /// Drivers may set this property on their devices or entities.
942 ///
943 /// Setup editors may allow the user to set this property on external devices.
944 ///
945 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertydeviceid?language=objc)
946 #[cfg(feature = "objc2-core-foundation")]
947 pub static kMIDIPropertyDeviceID: &'static CFString;
948}
949
950extern "C" {
951 /// endpoint property, integer
952 ///
953 /// The value is a bitmap of channels on which the object receives: 1=ch 1, 2=ch 2, 4=ch 3
954 /// ... 0x8000=ch 16.
955 ///
956 /// Drivers may set this property on their entities or endpoints.
957 ///
958 /// Setup editors may allow the user to set this property on external endpoints.
959 ///
960 /// Virtual destination may set this property on their endpoints.
961 ///
962 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyreceivechannels?language=objc)
963 #[cfg(feature = "objc2-core-foundation")]
964 pub static kMIDIPropertyReceiveChannels: &'static CFString;
965}
966
967extern "C" {
968 /// endpoint property, integer
969 ///
970 /// The value is a bitmap of channels on which the object transmits: 1=ch 1, 2=ch 2, 4=ch 3
971 /// ... 0x8000=ch 16.
972 ///
973 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertytransmitchannels?language=objc)
974 #[cfg(feature = "objc2-core-foundation")]
975 pub static kMIDIPropertyTransmitChannels: &'static CFString;
976}
977
978extern "C" {
979 /// device/entity/endpoint property, integer
980 ///
981 /// Set by the owning driver; should not be touched by other clients.
982 /// The value is the maximum rate, in bytes/second, at which sysex messages may
983 /// be sent reliably to this object. (The default value is 3125, as with MIDI 1.0)
984 ///
985 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertymaxsysexspeed?language=objc)
986 #[cfg(feature = "objc2-core-foundation")]
987 pub static kMIDIPropertyMaxSysExSpeed: &'static CFString;
988}
989
990extern "C" {
991 /// device/entity/endpoint property, integer
992 ///
993 /// Set by the owning driver; should not be touched by other clients. If it is non-zero,
994 /// then it is a recommendation of how many microseconds in advance clients should schedule
995 /// output. Clients should treat this value as a minimum. For devices with a non-zero
996 /// advance schedule time, drivers will receive outgoing messages to the device at the time
997 /// they are sent by the client, via MIDISend, and the driver is responsible for scheduling
998 /// events to be played at the right times according to their timestamps.
999 ///
1000 /// As of CoreMIDI 1.3, this property may also be set on virtual destinations (but only the
1001 /// creator of the destination should do so). When a client sends to a virtual destination
1002 /// with an advance schedule time of 0, the virtual destination receives its messages at
1003 /// their scheduled delivery time. If a virtual destination has a non-zero advance schedule
1004 /// time, it receives timestamped messages as soon as they are sent, and must do its own
1005 /// internal scheduling of received events.
1006 ///
1007 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyadvancescheduletimemusec?language=objc)
1008 #[cfg(feature = "objc2-core-foundation")]
1009 pub static kMIDIPropertyAdvanceScheduleTimeMuSec: &'static CFString;
1010}
1011
1012extern "C" {
1013 /// entity/endpoint property, integer
1014 ///
1015 /// 0 if there are external MIDI connectors, 1 if not.
1016 ///
1017 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyisembeddedentity?language=objc)
1018 #[cfg(feature = "objc2-core-foundation")]
1019 pub static kMIDIPropertyIsEmbeddedEntity: &'static CFString;
1020}
1021
1022extern "C" {
1023 /// entity/endpoint property, integer
1024 ///
1025 /// 1 if the endpoint broadcasts messages to all of the other endpoints in the device, 0 if
1026 /// not. Set by the owning driver; should not be touched by other clients.
1027 ///
1028 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyisbroadcast?language=objc)
1029 #[cfg(feature = "objc2-core-foundation")]
1030 pub static kMIDIPropertyIsBroadcast: &'static CFString;
1031}
1032
1033extern "C" {
1034 /// device property, integer
1035 ///
1036 /// Some MIDI interfaces cannot route MIDI realtime messages to individual outputs; they are
1037 /// broadcast. On such devices the inverse is usually also true -- incoming realtime
1038 /// messages cannot be identified as originating from any particular source.
1039 ///
1040 /// When this property is set on a driver device, it signifies the 0-based index of the
1041 /// entity on which incoming realtime messages from the device will appear to have
1042 /// originated from.
1043 ///
1044 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertysinglerealtimeentity?language=objc)
1045 #[cfg(feature = "objc2-core-foundation")]
1046 pub static kMIDIPropertySingleRealtimeEntity: &'static CFString;
1047}
1048
1049extern "C" {
1050 /// device/entity/endpoint property, integer or CFDataRef
1051 ///
1052 /// UniqueID of an external device/entity/endpoint attached to this one. As of Mac OS X
1053 /// 10.3, Audio MIDI Setup maintains endpoint-to-external endpoint connections (in 10.2, it
1054 /// connected devices to devices).
1055 ///
1056 /// The property is non-existant or 0 if there is no connection.
1057 ///
1058 /// Beginning with CoreMIDI 1.3 (Mac OS X 10.2), this property may also be a CFDataRef containing an array of
1059 /// big-endian SInt32's, to allow specifying that a driver object connects to multiple
1060 /// external objects (via MIDI thru-ing or splitting).
1061 ///
1062 /// This property may also exist for external devices/entities/endpoints, in which case it
1063 /// signifies a MIDI Thru connection to another external device/entity/endpoint (again,
1064 /// it is strongly recommended that it be an endpoint).
1065 ///
1066 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyconnectionuniqueid?language=objc)
1067 #[cfg(feature = "objc2-core-foundation")]
1068 pub static kMIDIPropertyConnectionUniqueID: &'static CFString;
1069}
1070
1071extern "C" {
1072 /// device/entity/endpoint property, integer
1073 ///
1074 /// 1 = device is offline (is temporarily absent), 0 = present. Set by the owning driver, on
1075 /// the device; should not be touched by other clients. Property is inherited from the
1076 /// device by its entities and endpoints.
1077 ///
1078 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyoffline?language=objc)
1079 #[cfg(feature = "objc2-core-foundation")]
1080 pub static kMIDIPropertyOffline: &'static CFString;
1081}
1082
1083extern "C" {
1084 /// device/entity/endpoint property, integer
1085 ///
1086 /// 1 = endpoint is private, hidden from other clients. May be set on a device or entity,
1087 /// but they will still appear in the API; only affects whether the owned endpoints are
1088 /// hidden.
1089 ///
1090 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyprivate?language=objc)
1091 #[cfg(feature = "objc2-core-foundation")]
1092 pub static kMIDIPropertyPrivate: &'static CFString;
1093}
1094
1095extern "C" {
1096 /// device/entity/endpoint property, string
1097 ///
1098 /// Name of the driver that owns a device. Set by the owning driver, on the device; should
1099 /// not be touched by other clients. Property is inherited from the device by its entities
1100 /// and endpoints.
1101 ///
1102 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertydriverowner?language=objc)
1103 #[cfg(feature = "objc2-core-foundation")]
1104 pub static kMIDIPropertyDriverOwner: &'static CFString;
1105}
1106
1107extern "C" {
1108 /// device/entity/endpoint property, CFData containing AliasHandle.
1109 ///
1110 /// An alias to the device's current factory patch name file.
1111 ///
1112 /// Added in CoreMIDI 1.1 (Mac OS X 10.1). DEPRECATED as of CoreMIDI 1.3. Use
1113 /// kMIDIPropertyNameConfiguration instead.
1114 ///
1115 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyfactorypatchnamefile?language=objc)
1116 #[cfg(feature = "objc2-core-foundation")]
1117 #[deprecated]
1118 pub static kMIDIPropertyFactoryPatchNameFile: &'static CFString;
1119}
1120
1121extern "C" {
1122 /// device/entity/endpoint property, CFData containing AliasHandle
1123 ///
1124 /// An alias to the device's current user patch name file.
1125 ///
1126 /// Added in CoreMIDI 1.1 (Mac OS X 10.1). DEPRECATED as of CoreMIDI 1.3. Use
1127 /// kMIDIPropertyNameConfiguration instead.
1128 ///
1129 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyuserpatchnamefile?language=objc)
1130 #[cfg(feature = "objc2-core-foundation")]
1131 #[deprecated]
1132 pub static kMIDIPropertyUserPatchNameFile: &'static CFString;
1133}
1134
1135extern "C" {
1136 /// device/entity/endpoint property, CFDictionary
1137 ///
1138 /// This specifies the device's current patch, note and control name values using the
1139 /// MIDINameDocument XML format. This specification requires the use of higher-level,
1140 /// OS-specific constructs outside of the specification to fully define the current names
1141 /// for a device.
1142 ///
1143 /// The MIDINameConfiguration property is implementated as a CFDictionary:
1144 ///
1145 /// key "master" maps to a CFDataRef containing an AliasHandle referring to the device's
1146 /// master name document. This is deprecated as of Mac OS X 10.10.
1147 ///
1148 /// key "masterDocumentPath" maps to a CFStringRef containing the filesystem path to the device's
1149 /// master name document. (This is new as of Mac OS X 10.10, but since the CoreMIDI
1150 /// implementation does not parse this dictionary, the convention can be safely ported
1151 /// to earlier versions of Mac OS X.)
1152 ///
1153 /// key "banks" maps to a CFDictionaryRef. This dictionary's keys are CFStringRef names of
1154 /// patchBank elements in the master document, and its values are each a CFDictionaryRef:
1155 /// key "file" maps to a CFDataRef containing an AliasHandle to a document containing
1156 /// patches that override those in the master document, and key "patchNameList" maps to a
1157 /// CFStringRef which is the name of the patchNameList element in the overriding document.
1158 ///
1159 /// key "currentChannelNameSets" maps to a 16-element CFArrayRef, each element of which is a
1160 /// CFStringRef of the name of the current mode for each of the 16 MIDI channels.
1161 ///
1162 /// key "currentDeviceMode" maps to a CFStringRef containing the name of the device's mode.
1163 ///
1164 /// Clients setting this property must take particular care to preserve dictionary values
1165 /// other than the ones they are interested in changing and to properly structure the
1166 /// dictionary.
1167 ///
1168 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertynameconfiguration?language=objc)
1169 #[cfg(feature = "objc2-core-foundation")]
1170 #[deprecated]
1171 pub static kMIDIPropertyNameConfiguration: &'static CFString;
1172}
1173
1174extern "C" {
1175 /// device/entity/endpoint property, CFDictionary
1176 ///
1177 /// This specifies the device's current patch, note and control name values using the
1178 /// MIDINameDocument XML format. This specification requires the use of higher-level,
1179 /// OS-specific constructs outside of the specification to fully define the current names
1180 /// for a device.
1181 ///
1182 /// The MIDINameConfiguration property is implementated as a CFDictionary:
1183 ///
1184 /// key "masterDocumentPath" maps to a CFStringRef containing the filesystem path to the device's
1185 /// master name document.
1186 ///
1187 /// key "banks" maps to a CFDictionaryRef. This dictionary's keys are CFStringRef names of
1188 /// patchBank elements in the master document, and its values are each a CFDictionaryRef:
1189 /// key "file" maps to a CFDataRef containing URL bookmark data to a document containing
1190 /// patches that override those in the master document, and key "patchNameList" maps to a
1191 /// CFStringRef which is the name of the patchNameList element in the overriding document.
1192 ///
1193 /// key "currentChannelNameSets" maps to a 16-element CFArrayRef, each element of which is a
1194 /// CFStringRef of the name of the current mode for each of the 16 MIDI channels.
1195 ///
1196 /// key "currentDeviceMode" maps to a CFStringRef containing the name of the device's mode.
1197 ///
1198 /// Clients setting this property must take particular care to preserve dictionary values
1199 /// other than the ones they are interested in changing and to properly structure the
1200 /// dictionary.
1201 ///
1202 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertynameconfigurationdictionary?language=objc)
1203 #[cfg(feature = "objc2-core-foundation")]
1204 pub static kMIDIPropertyNameConfigurationDictionary: &'static CFString;
1205}
1206
1207extern "C" {
1208 /// device property, CFStringRef which is a full POSIX path to a device or external device's
1209 /// icon, stored in any standard graphic file format such as JPEG, GIF, PNG and TIFF are all
1210 /// acceptable. (See CFURL for functions to convert between POSIX paths and other ways of
1211 /// specifying files.) The image's maximum size should be 128x128.
1212 ///
1213 /// Drivers should set the icon on the devices they add.
1214 ///
1215 /// A studio setup editor should allow the user to choose icons for external devices.
1216 ///
1217 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyimage?language=objc)
1218 #[cfg(feature = "objc2-core-foundation")]
1219 pub static kMIDIPropertyImage: &'static CFString;
1220}
1221
1222extern "C" {
1223 /// device/entity/endpoint property, integer, returns the driver version API of the owning
1224 /// driver (only for driver- owned devices). Drivers need not set this property;
1225 /// applications should not write to it.
1226 ///
1227 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertydriverversion?language=objc)
1228 #[cfg(feature = "objc2-core-foundation")]
1229 pub static kMIDIPropertyDriverVersion: &'static CFString;
1230}
1231
1232extern "C" {
1233 /// device/entity property, integer (0/1). Indicates whether the device or entity implements
1234 /// the General MIDI specification.
1235 ///
1236 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertysupportsgeneralmidi?language=objc)
1237 #[cfg(feature = "objc2-core-foundation")]
1238 pub static kMIDIPropertySupportsGeneralMIDI: &'static CFString;
1239}
1240
1241extern "C" {
1242 /// device/entity property, integer (0/1). Indicates whether the device or entity implements
1243 /// the MIDI Machine Control portion of the MIDI specification.
1244 ///
1245 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertysupportsmmc?language=objc)
1246 #[cfg(feature = "objc2-core-foundation")]
1247 pub static kMIDIPropertySupportsMMC: &'static CFString;
1248}
1249
1250extern "C" {
1251 /// device/entity property, integer (0/1). Indicates whether the device or entity can route
1252 /// MIDI messages to or from other external MIDI devices (as with MIDI patch bays). This
1253 /// should NOT be set on devices which are controlled by drivers.
1254 ///
1255 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertycanroute?language=objc)
1256 #[cfg(feature = "objc2-core-foundation")]
1257 pub static kMIDIPropertyCanRoute: &'static CFString;
1258}
1259
1260extern "C" {
1261 /// device/entity property, integer (0/1). Indicates whether the device or entity responds
1262 /// to MIDI beat clock messages.
1263 ///
1264 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyreceivesclock?language=objc)
1265 #[cfg(feature = "objc2-core-foundation")]
1266 pub static kMIDIPropertyReceivesClock: &'static CFString;
1267}
1268
1269extern "C" {
1270 /// device/entity property, integer (0/1). Indicates whether the device or entity responds
1271 /// to MIDI Time Code messages.
1272 ///
1273 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyreceivesmtc?language=objc)
1274 #[cfg(feature = "objc2-core-foundation")]
1275 pub static kMIDIPropertyReceivesMTC: &'static CFString;
1276}
1277
1278extern "C" {
1279 /// device/entity property, integer (0/1). Indicates whether the device or entity responds
1280 /// to MIDI Note On messages.
1281 ///
1282 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyreceivesnotes?language=objc)
1283 #[cfg(feature = "objc2-core-foundation")]
1284 pub static kMIDIPropertyReceivesNotes: &'static CFString;
1285}
1286
1287extern "C" {
1288 /// device/entity property, integer (0/1). Indicates whether the device or entity responds
1289 /// to MIDI program change messages.
1290 ///
1291 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyreceivesprogramchanges?language=objc)
1292 #[cfg(feature = "objc2-core-foundation")]
1293 pub static kMIDIPropertyReceivesProgramChanges: &'static CFString;
1294}
1295
1296extern "C" {
1297 /// device/entity property, integer (0/1). Indicates whether the device or entity responds
1298 /// to MIDI bank select MSB messages (control 0).
1299 ///
1300 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyreceivesbankselectmsb?language=objc)
1301 #[cfg(feature = "objc2-core-foundation")]
1302 pub static kMIDIPropertyReceivesBankSelectMSB: &'static CFString;
1303}
1304
1305extern "C" {
1306 /// device/entity property, integer (0/1). Indicates whether the device or entity responds
1307 /// to MIDI bank select LSB messages (control 32).
1308 ///
1309 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyreceivesbankselectlsb?language=objc)
1310 #[cfg(feature = "objc2-core-foundation")]
1311 pub static kMIDIPropertyReceivesBankSelectLSB: &'static CFString;
1312}
1313
1314extern "C" {
1315 /// device/entity property, integer (0/1). Indicates whether the device or entity transmits
1316 /// MIDI beat clock messages.
1317 ///
1318 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertytransmitsclock?language=objc)
1319 #[cfg(feature = "objc2-core-foundation")]
1320 pub static kMIDIPropertyTransmitsClock: &'static CFString;
1321}
1322
1323extern "C" {
1324 /// device/entity property, integer (0/1). Indicates whether the device or entity transmits
1325 /// MIDI Time Code messages.
1326 ///
1327 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertytransmitsmtc?language=objc)
1328 #[cfg(feature = "objc2-core-foundation")]
1329 pub static kMIDIPropertyTransmitsMTC: &'static CFString;
1330}
1331
1332extern "C" {
1333 /// device/entity property, integer (0/1). Indicates whether the device or entity transmits
1334 /// MIDI note messages.
1335 ///
1336 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertytransmitsnotes?language=objc)
1337 #[cfg(feature = "objc2-core-foundation")]
1338 pub static kMIDIPropertyTransmitsNotes: &'static CFString;
1339}
1340
1341extern "C" {
1342 /// device/entity property, integer (0/1). Indicates whether the device or entity transmits
1343 /// MIDI program change messages.
1344 ///
1345 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertytransmitsprogramchanges?language=objc)
1346 #[cfg(feature = "objc2-core-foundation")]
1347 pub static kMIDIPropertyTransmitsProgramChanges: &'static CFString;
1348}
1349
1350extern "C" {
1351 /// device/entity property, integer (0/1). Indicates whether the device or entity transmits
1352 /// MIDI bank select MSB messages (control 0).
1353 ///
1354 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertytransmitsbankselectmsb?language=objc)
1355 #[cfg(feature = "objc2-core-foundation")]
1356 pub static kMIDIPropertyTransmitsBankSelectMSB: &'static CFString;
1357}
1358
1359extern "C" {
1360 /// device/entity property, integer (0/1). Indicates whether the device or entity transmits
1361 /// MIDI bank select LSB messages (control 32).
1362 ///
1363 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertytransmitsbankselectlsb?language=objc)
1364 #[cfg(feature = "objc2-core-foundation")]
1365 pub static kMIDIPropertyTransmitsBankSelectLSB: &'static CFString;
1366}
1367
1368extern "C" {
1369 /// device/entity property, integer (0/1). Indicates whether the MIDI pan messages (control
1370 /// 10), when sent to the device or entity, cause undesirable effects when playing stereo
1371 /// sounds (e.g. converting the signal to mono).
1372 ///
1373 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertypandisruptsstereo?language=objc)
1374 #[cfg(feature = "objc2-core-foundation")]
1375 pub static kMIDIPropertyPanDisruptsStereo: &'static CFString;
1376}
1377
1378extern "C" {
1379 /// device/entity property, integer (0/1). Indicates whether the device or entity plays
1380 /// audio samples in response to MIDI note messages.
1381 ///
1382 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyissampler?language=objc)
1383 #[cfg(feature = "objc2-core-foundation")]
1384 pub static kMIDIPropertyIsSampler: &'static CFString;
1385}
1386
1387extern "C" {
1388 /// device/entity property, integer (0/1). Indicates whether the device or entity's sound
1389 /// presets tend to be collections of non-transposable samples (e.g. drum kits).
1390 ///
1391 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyisdrummachine?language=objc)
1392 #[cfg(feature = "objc2-core-foundation")]
1393 pub static kMIDIPropertyIsDrumMachine: &'static CFString;
1394}
1395
1396extern "C" {
1397 /// device/entity property, integer (0/1). Indicates whether the device or entity mixes
1398 /// external audio signals, controlled by MIDI messages.
1399 ///
1400 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyismixer?language=objc)
1401 #[cfg(feature = "objc2-core-foundation")]
1402 pub static kMIDIPropertyIsMixer: &'static CFString;
1403}
1404
1405extern "C" {
1406 /// device/entity property, integer (0/1). Indicates whether the device or entity is
1407 /// primarily a MIDI-controlled audio effect unit (i.e. does not generate sound on its own).
1408 ///
1409 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyiseffectunit?language=objc)
1410 #[cfg(feature = "objc2-core-foundation")]
1411 pub static kMIDIPropertyIsEffectUnit: &'static CFString;
1412}
1413
1414extern "C" {
1415 /// device/entity property, integer (0-16). Indicates the maximum number of MIDI channels on
1416 /// which a device may simultaneously receive MIDI Channel Messages. Common values are 0
1417 /// (devices which only respond to System Messages), 1 (non-multitimbral devices), and 16
1418 /// (fully multitimbral devices). Other values are possible, for example devices which are
1419 /// multi-timbral but have fewer than 16 "parts".
1420 ///
1421 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertymaxreceivechannels?language=objc)
1422 #[cfg(feature = "objc2-core-foundation")]
1423 pub static kMIDIPropertyMaxReceiveChannels: &'static CFString;
1424}
1425
1426extern "C" {
1427 /// device/entity property, integer (0/1). Indicates the maximum number of MIDI channels on
1428 /// which a device may simultaneously transmit MIDI Channel Messages. Common values are 0, 1
1429 /// and 16.
1430 ///
1431 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertymaxtransmitchannels?language=objc)
1432 #[cfg(feature = "objc2-core-foundation")]
1433 pub static kMIDIPropertyMaxTransmitChannels: &'static CFString;
1434}
1435
1436extern "C" {
1437 /// device property, string, contains the full path to an application which knows how to
1438 /// configure this driver-owned devices. Drivers may set this property on their owned
1439 /// devices. Applications must not write to it.
1440 ///
1441 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertydriverdeviceeditorapp?language=objc)
1442 #[cfg(feature = "objc2-core-foundation")]
1443 pub static kMIDIPropertyDriverDeviceEditorApp: &'static CFString;
1444}
1445
1446extern "C" {
1447 /// device/entity property, integer (0/1). Indicates whether the device implements the MIDI
1448 /// Show Control specification.
1449 ///
1450 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertysupportsshowcontrol?language=objc)
1451 #[cfg(feature = "objc2-core-foundation")]
1452 pub static kMIDIPropertySupportsShowControl: &'static CFString;
1453}
1454
1455extern "C" {
1456 /// device/entity/endpoint property, string.
1457 ///
1458 /// Provides the Apple-recommended user-visible name for an endpoint, by combining the
1459 /// device and endpoint names.
1460 ///
1461 /// For objects other than endpoints, the display name is the same as the name.
1462 ///
1463 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertydisplayname?language=objc)
1464 #[cfg(feature = "objc2-core-foundation")]
1465 pub static kMIDIPropertyDisplayName: &'static CFString;
1466}
1467
1468extern "C" {
1469 /// constant kMIDIPropertyProtocolID
1470 ///
1471 /// device/entity/endpoint property (UMP-native), MIDIProtocolID. Indicates the native protocol in which
1472 /// the endpoint communicates. The value is set by the system on endpoints, when they are
1473 /// created. Drivers may dynamically change the protocol of an endpoint as a result of a MIDI-CI
1474 /// negotiation, by setting this property on the endpoint. Clients can observe changes to
1475 /// this property.
1476 ///
1477 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyprotocolid?language=objc)
1478 #[cfg(feature = "objc2-core-foundation")]
1479 pub static kMIDIPropertyProtocolID: &'static CFString;
1480}
1481
1482extern "C" {
1483 /// constant kMIDIPropertyUMPActiveGroupBitmap
1484 ///
1485 /// entity and endpoint property (UMP-native), 16-bit unsigned integer. If present, describes which
1486 /// groups are currently active and available for message transmission. The most significant bit
1487 /// represents group 16, and the least significant bit represents group 1.
1488 ///
1489 /// If a driver sets this property on a UMP-native endpoint provided for legacy MIDI 1.0 compatibility,
1490 /// only a single bit of the bitfield may be used. As a convenience, MIDI messages sent to a driver-
1491 /// created destination provided for legacy MIDI 1.0 compatibility will have all messages converted
1492 /// to the supported group prior to delivery.
1493 ///
1494 /// Any UMP-native endpoint lacking this property and subsequently defined property
1495 /// kMIDIPropertyCanTransmitGroupless is assumed to handle/transmit all UMP traffic.
1496 ///
1497 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyumpactivegroupbitmap?language=objc)
1498 #[cfg(feature = "objc2-core-foundation")]
1499 pub static kMIDIPropertyUMPActiveGroupBitmap: &'static CFString;
1500}
1501
1502extern "C" {
1503 /// constant kMIDIPropertyUMPCanTransmitGroupless
1504 ///
1505 /// entity and endpoint property (UMP-native), integer. If this property is present and set to 1,
1506 /// the referenced MIDI object is or has (an) endpoint/endpoints capable of transmitting UMP
1507 /// messages with no group (e.g., message type 0 and message type F).
1508 ///
1509 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyumpcantransmitgroupless?language=objc)
1510 #[cfg(feature = "objc2-core-foundation")]
1511 pub static kMIDIPropertyUMPCanTransmitGroupless: &'static CFString;
1512}
1513
1514extern "C" {
1515 /// constant kMIDIPropertyAssociatedEndpoint
1516 ///
1517 /// endpoint property, MIDIUniqueID. If this property is present, the indicated endpoint should be
1518 /// used for bidirectional communication purposes, (e.g. UMP Endpoint pairing or MIDI-CI devices).
1519 /// When setting this property on an endpoint, it should also be set on the assocated endpoint to
1520 /// create a bidirectional mapping.
1521 ///
1522 /// Note: This value is a MIDIUniqueID, use MIDIObjectFindByUniqueID to resolve it to a MIDIObjectRef.
1523 ///
1524 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidipropertyassociatedendpoint?language=objc)
1525 #[cfg(feature = "objc2-core-foundation")]
1526 pub static kMIDIPropertyAssociatedEndpoint: &'static CFString;
1527}
1528
1529extern "C-unwind" {
1530 /// Creates a MIDIClient object.
1531 ///
1532 ///
1533 /// Parameter `name`: The client's name.
1534 ///
1535 /// Parameter `notifyProc`: An optional (may be NULL) callback function through which the client
1536 /// will receive notifications of changes to the system.
1537 ///
1538 /// Parameter `notifyRefCon`: A refCon passed back to notifyRefCon
1539 ///
1540 /// Parameter `outClient`: On successful return, points to the newly-created MIDIClientRef.
1541 ///
1542 /// Returns: An OSStatus result code.
1543 ///
1544 ///
1545 /// Note that notifyProc will always be called on the run loop which was current when
1546 /// MIDIClientCreate was first called.
1547 ///
1548 /// # Safety
1549 ///
1550 /// - `notify_proc` must be implemented correctly.
1551 /// - `notify_ref_con` must be a valid pointer or null.
1552 /// - `out_client` must be a valid pointer.
1553 #[cfg(feature = "objc2-core-foundation")]
1554 pub fn MIDIClientCreate(
1555 name: &CFString,
1556 notify_proc: MIDINotifyProc,
1557 notify_ref_con: *mut c_void,
1558 out_client: NonNull<MIDIClientRef>,
1559 ) -> OSStatus;
1560}
1561
1562extern "C-unwind" {
1563 /// Creates a MIDIClient object.
1564 ///
1565 ///
1566 /// Parameter `name`: The client's name.
1567 ///
1568 /// Parameter `outClient`: On successful return, points to the newly-created MIDIClientRef.
1569 ///
1570 /// Parameter `notifyBlock`: An optional (may be NULL) block via which the client
1571 /// will receive notifications of changes to the system.
1572 ///
1573 /// Returns: An OSStatus result code.
1574 ///
1575 ///
1576 /// Note that notifyBlock is called on a thread chosen by the implementation.
1577 /// Thread-safety is the block's responsibility.
1578 ///
1579 /// # Safety
1580 ///
1581 /// - `out_client` must be a valid pointer.
1582 /// - `notify_block` must be a valid pointer or null.
1583 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
1584 pub fn MIDIClientCreateWithBlock(
1585 name: &CFString,
1586 out_client: NonNull<MIDIClientRef>,
1587 notify_block: MIDINotifyBlock,
1588 ) -> OSStatus;
1589}
1590
1591extern "C-unwind" {
1592 /// Disposes a MIDIClient object.
1593 ///
1594 ///
1595 /// Parameter `client`: The client to dispose.
1596 ///
1597 /// Returns: An OSStatus result code.
1598 ///
1599 ///
1600 /// It is not essential to call this function; the CoreMIDI framework will automatically
1601 /// dispose all MIDIClients when an application terminates. However, if this method is
1602 /// called to dispose the last/only MIDIClient owned by an application, the MIDI server may
1603 /// exit if there are no other MIDIClients remaining in the system, causing all subsequent calls
1604 /// to MIDIClientCreate and MIDIClientCreateWithBlock by that application to fail. For this reason,
1605 /// disposing all of an application's MIDIClients is strongly discouraged.
1606 pub fn MIDIClientDispose(client: MIDIClientRef) -> OSStatus;
1607}
1608
1609extern "C-unwind" {
1610 /// Creates an input port through which the client may receive
1611 /// incoming MIDI messages from any MIDI source.
1612 ///
1613 ///
1614 /// Parameter `client`: The client to own the newly-created port.
1615 ///
1616 /// Parameter `portName`: The name of the port.
1617 ///
1618 /// Parameter `protocol`: The MIDI protocol variant to be delivered to this port. The system
1619 /// will automatically convert to this protocol as needed.
1620 ///
1621 /// Parameter `outPort`: On successful return, points to the newly-created
1622 /// MIDIPort.
1623 ///
1624 /// Parameter `receiveBlock`: The MIDIReceiveBlock which will be called with incoming MIDI, from sources
1625 /// connected to this port.
1626 ///
1627 /// Returns: An OSStatus result code.
1628 ///
1629 ///
1630 /// After creating a port, use MIDIPortConnectSource to establish an input connection from
1631 /// any number of sources to your port.
1632 ///
1633 /// readBlock will be called on a separate high-priority thread owned by CoreMIDI.
1634 ///
1635 /// # Safety
1636 ///
1637 /// - `out_port` must be a valid pointer.
1638 /// - `receive_block` must be a valid pointer.
1639 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
1640 pub fn MIDIInputPortCreateWithProtocol(
1641 client: MIDIClientRef,
1642 port_name: &CFString,
1643 protocol: MIDIProtocolID,
1644 out_port: NonNull<MIDIPortRef>,
1645 receive_block: MIDIReceiveBlock,
1646 ) -> OSStatus;
1647}
1648
1649extern "C-unwind" {
1650 /// Creates an input port through which the client may receive
1651 /// incoming MIDI messages from any MIDI source.
1652 ///
1653 ///
1654 /// Parameter `client`: The client to own the newly-created port.
1655 ///
1656 /// Parameter `portName`: The name of the port.
1657 ///
1658 /// Parameter `readProc`: The MIDIReadProc which will be called with incoming MIDI,
1659 /// from sources connected to this port.
1660 ///
1661 /// Parameter `refCon`: The refCon passed to readHook.
1662 ///
1663 /// Parameter `outPort`: On successful return, points to the newly-created
1664 /// MIDIPort.
1665 ///
1666 /// Returns: An OSStatus result code.
1667 ///
1668 ///
1669 /// After creating a port, use MIDIPortConnectSource to establish an input connection from
1670 /// any number of sources to your port.
1671 ///
1672 /// readProc will be called on a separate high-priority thread owned by CoreMIDI.
1673 ///
1674 /// # Safety
1675 ///
1676 /// - `read_proc` must be implemented correctly.
1677 /// - `ref_con` must be a valid pointer or null.
1678 /// - `out_port` must be a valid pointer.
1679 #[cfg(feature = "objc2-core-foundation")]
1680 #[deprecated]
1681 pub fn MIDIInputPortCreate(
1682 client: MIDIClientRef,
1683 port_name: &CFString,
1684 read_proc: MIDIReadProc,
1685 ref_con: *mut c_void,
1686 out_port: NonNull<MIDIPortRef>,
1687 ) -> OSStatus;
1688}
1689
1690extern "C-unwind" {
1691 /// Creates an input port through which the client may receive
1692 /// incoming MIDI messages from any MIDI source.
1693 ///
1694 ///
1695 /// Parameter `client`: The client to own the newly-created port.
1696 ///
1697 /// Parameter `portName`: The name of the port.
1698 ///
1699 /// Parameter `outPort`: On successful return, points to the newly-created
1700 /// MIDIPort.
1701 ///
1702 /// Parameter `readBlock`: The MIDIReadBlock which will be called with incoming MIDI, from sources
1703 /// connected to this port.
1704 ///
1705 /// Returns: An OSStatus result code.
1706 ///
1707 ///
1708 /// After creating a port, use MIDIPortConnectSource to establish an input connection from
1709 /// any number of sources to your port.
1710 ///
1711 /// readBlock will be called on a separate high-priority thread owned by CoreMIDI.
1712 ///
1713 /// # Safety
1714 ///
1715 /// - `out_port` must be a valid pointer.
1716 /// - `read_block` must be a valid pointer.
1717 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
1718 #[deprecated]
1719 pub fn MIDIInputPortCreateWithBlock(
1720 client: MIDIClientRef,
1721 port_name: &CFString,
1722 out_port: NonNull<MIDIPortRef>,
1723 read_block: MIDIReadBlock,
1724 ) -> OSStatus;
1725}
1726
1727extern "C-unwind" {
1728 /// Creates an output port through which the client may send
1729 /// outgoing MIDI messages to any MIDI destination.
1730 ///
1731 ///
1732 /// Parameter `client`: The client to own the newly-created port
1733 ///
1734 /// Parameter `portName`: The name of the port.
1735 ///
1736 /// Parameter `outPort`: On successful return, points to the newly-created
1737 /// MIDIPort.
1738 ///
1739 /// Returns: An OSStatus result code.
1740 ///
1741 ///
1742 /// Output ports provide a mechanism for MIDI merging. CoreMIDI assumes that each output
1743 /// port will be responsible for sending only a single MIDI stream to each destination,
1744 /// although a single port may address all of the destinations in the system.
1745 ///
1746 /// Multiple output ports are only necessary when an application is capable of directing
1747 /// multiple simultaneous MIDI streams to the same destination.
1748 ///
1749 /// # Safety
1750 ///
1751 /// `out_port` must be a valid pointer.
1752 #[cfg(feature = "objc2-core-foundation")]
1753 pub fn MIDIOutputPortCreate(
1754 client: MIDIClientRef,
1755 port_name: &CFString,
1756 out_port: NonNull<MIDIPortRef>,
1757 ) -> OSStatus;
1758}
1759
1760extern "C-unwind" {
1761 /// Disposes a MIDIPort object.
1762 ///
1763 ///
1764 /// Parameter `port`: The port to dispose.
1765 ///
1766 /// Returns: An OSStatus result code.
1767 ///
1768 ///
1769 /// It is not usually necessary to call this function; when an application's MIDIClient's
1770 /// are automatically disposed at termination, or explicitly, via MIDIClientDispose, the
1771 /// client's ports are automatically disposed at that time.
1772 pub fn MIDIPortDispose(port: MIDIPortRef) -> OSStatus;
1773}
1774
1775extern "C-unwind" {
1776 /// Establishes a connection from a source to a client's input port.
1777 ///
1778 ///
1779 /// Parameter `port`: The port to which to create the connection. This port's
1780 /// readProc is called with incoming MIDI from the source.
1781 ///
1782 /// Parameter `source`: The source from which to create the connection.
1783 ///
1784 /// Parameter `connRefCon`: This refCon is passed to the port's MIDIReadProc or MIDIReadBlock, as a way to
1785 /// identify the source.
1786 ///
1787 /// Returns: An OSStatus result code.
1788 ///
1789 /// # Safety
1790 ///
1791 /// `conn_ref_con` must be a valid pointer or null.
1792 pub fn MIDIPortConnectSource(
1793 port: MIDIPortRef,
1794 source: MIDIEndpointRef,
1795 conn_ref_con: *mut c_void,
1796 ) -> OSStatus;
1797}
1798
1799extern "C-unwind" {
1800 /// Closes a previously-established source-to-input port
1801 /// connection.
1802 ///
1803 ///
1804 /// Parameter `port`: The port whose connection is being closed.
1805 ///
1806 /// Parameter `source`: The source from which to close a connection to the
1807 /// specified port.
1808 ///
1809 /// Returns: An OSStatus result code.
1810 pub fn MIDIPortDisconnectSource(port: MIDIPortRef, source: MIDIEndpointRef) -> OSStatus;
1811}
1812
1813extern "C-unwind" {
1814 /// Returns the number of devices in the system.
1815 ///
1816 ///
1817 /// Returns: The number of devices in the system, or 0 if an error
1818 /// occurred.
1819 pub fn MIDIGetNumberOfDevices() -> ItemCount;
1820}
1821
1822extern "C-unwind" {
1823 /// Returns one of the devices in the system.
1824 ///
1825 ///
1826 /// Parameter `deviceIndex0`: The index (0...MIDIGetNumberOfDevices()-1) of the device
1827 /// to return.
1828 ///
1829 /// Returns: A reference to a device, or NULL if an error occurred.
1830 ///
1831 ///
1832 /// Use this to enumerate the devices in the system.
1833 ///
1834 /// To enumerate the entities in the system, you can walk through the devices, then walk
1835 /// through the devices' entities.
1836 ///
1837 /// Note: If a client iterates through the devices and entities in the system, it will not
1838 /// ever visit any virtual sources and destinations created by other clients. Also, a
1839 /// device iteration will return devices which are "offline" (were present in the past but
1840 /// are not currently present), while iterations through the system's sources and
1841 /// destinations will not include the endpoints of offline devices.
1842 ///
1843 /// Thus clients should usually use MIDIGetNumberOfSources, MIDIGetSource,
1844 /// MIDIGetNumberOfDestinations and MIDIGetDestination, rather iterating through devices and
1845 /// entities to locate endpoints.
1846 pub fn MIDIGetDevice(device_index0: ItemCount) -> MIDIDeviceRef;
1847}
1848
1849extern "C-unwind" {
1850 /// Returns the number of entities in a given device.
1851 ///
1852 ///
1853 /// Parameter `device`: The device being queried.
1854 ///
1855 ///
1856 /// Returns: The number of entities the device contains, or 0 if an
1857 /// error occurred.
1858 pub fn MIDIDeviceGetNumberOfEntities(device: MIDIDeviceRef) -> ItemCount;
1859}
1860
1861extern "C-unwind" {
1862 /// Returns one of a given device's entities.
1863 ///
1864 ///
1865 /// Parameter `device`: The device being queried.
1866 ///
1867 /// Parameter `entityIndex0`: The index (0...MIDIDeviceGetNumberOfEntities(device)-1)
1868 /// of the entity to return
1869 ///
1870 ///
1871 /// Returns: A reference to an entity, or NULL if an error occurred.
1872 pub fn MIDIDeviceGetEntity(device: MIDIDeviceRef, entity_index0: ItemCount) -> MIDIEntityRef;
1873}
1874
1875extern "C-unwind" {
1876 /// Returns the number of sources in a given entity.
1877 ///
1878 ///
1879 /// Parameter `entity`: The entity being queried
1880 ///
1881 ///
1882 /// Returns: The number of sources the entity contains, or 0 if an
1883 /// error occurred.
1884 pub fn MIDIEntityGetNumberOfSources(entity: MIDIEntityRef) -> ItemCount;
1885}
1886
1887extern "C-unwind" {
1888 /// Returns one of a given entity's sources.
1889 ///
1890 ///
1891 /// Parameter `entity`: The entity being queried.
1892 ///
1893 /// Parameter `sourceIndex0`: The index (0...MIDIEntityGetNumberOfSources(entity)-1) of
1894 /// the source to return
1895 ///
1896 ///
1897 /// Returns: A reference to a source, or NULL if an error occurred.
1898 pub fn MIDIEntityGetSource(entity: MIDIEntityRef, source_index0: ItemCount) -> MIDIEndpointRef;
1899}
1900
1901extern "C-unwind" {
1902 /// Returns the number of destinations in a given entity.
1903 ///
1904 ///
1905 /// Parameter `entity`: The entity being queried
1906 ///
1907 ///
1908 /// Returns: The number of destinations the entity contains, or 0
1909 /// if an error occurred.
1910 pub fn MIDIEntityGetNumberOfDestinations(entity: MIDIEntityRef) -> ItemCount;
1911}
1912
1913extern "C-unwind" {
1914 /// Returns one of a given entity's destinations.
1915 ///
1916 ///
1917 /// Parameter `entity`: The entity being queried.
1918 ///
1919 /// Parameter `destIndex0`: The index (0...MIDIEntityGetNumberOfDestinations(entity)
1920 /// - 1) of the destination to return
1921 ///
1922 ///
1923 /// Returns: A reference to a destination, or NULL if an error occurred.
1924 pub fn MIDIEntityGetDestination(
1925 entity: MIDIEntityRef,
1926 dest_index0: ItemCount,
1927 ) -> MIDIEndpointRef;
1928}
1929
1930extern "C-unwind" {
1931 /// Returns an entity's device.
1932 ///
1933 ///
1934 /// Parameter `inEntity`: The entity being queried.
1935 ///
1936 /// Parameter `outDevice`: On successful return, the entity's owning device.
1937 ///
1938 /// # Safety
1939 ///
1940 /// `out_device` must be a valid pointer or null.
1941 pub fn MIDIEntityGetDevice(
1942 in_entity: MIDIEntityRef,
1943 out_device: *mut MIDIDeviceRef,
1944 ) -> OSStatus;
1945}
1946
1947extern "C-unwind" {
1948 /// Returns the number of sources in the system.
1949 ///
1950 ///
1951 /// Returns: The number of sources in the system, or 0 if an error
1952 /// occurred.
1953 pub fn MIDIGetNumberOfSources() -> ItemCount;
1954}
1955
1956extern "C-unwind" {
1957 /// Returns one of the sources in the system.
1958 ///
1959 ///
1960 /// Parameter `sourceIndex0`: The index (0...MIDIGetNumberOfSources()-1) of the source
1961 /// to return
1962 ///
1963 /// Returns: A reference to a source, or NULL if an error occurred.
1964 pub fn MIDIGetSource(source_index0: ItemCount) -> MIDIEndpointRef;
1965}
1966
1967extern "C-unwind" {
1968 /// Returns the number of destinations in the system.
1969 ///
1970 ///
1971 /// Returns: The number of destinations in the system, or 0 if an error
1972 /// occurred.
1973 pub fn MIDIGetNumberOfDestinations() -> ItemCount;
1974}
1975
1976extern "C-unwind" {
1977 /// Returns one of the destinations in the system.
1978 ///
1979 ///
1980 /// Parameter `destIndex0`: The index (0...MIDIGetNumberOfDestinations()-1) of the
1981 /// destination to return
1982 ///
1983 /// Returns: A reference to a destination, or NULL if an error occurred.
1984 pub fn MIDIGetDestination(dest_index0: ItemCount) -> MIDIEndpointRef;
1985}
1986
1987extern "C-unwind" {
1988 /// Returns an endpoint's entity.
1989 ///
1990 ///
1991 /// Parameter `inEndpoint`: The endpoint being queried.
1992 ///
1993 /// Parameter `outEntity`: On exit, the endpoint's owning entity, or NULL if none.
1994 ///
1995 ///
1996 /// Virtual sources and destinations don't have entities.
1997 ///
1998 /// # Safety
1999 ///
2000 /// `out_entity` must be a valid pointer or null.
2001 pub fn MIDIEndpointGetEntity(
2002 in_endpoint: MIDIEndpointRef,
2003 out_entity: *mut MIDIEntityRef,
2004 ) -> OSStatus;
2005}
2006
2007extern "C-unwind" {
2008 /// Creates a virtual destination in a client.
2009 ///
2010 ///
2011 /// Parameter `client`: The client owning the virtual destination.
2012 ///
2013 /// Parameter `name`: The name of the virtual destination.
2014 ///
2015 /// Parameter `protocol`: The MIDI protocol variant to be delivered to this destination. The system
2016 /// will automatically convert to this protocol as needed.
2017 ///
2018 /// Parameter `outDest`: On successful return, a pointer to the newly-created
2019 /// destination.
2020 ///
2021 /// Parameter `readBlock`: The MIDIReceiveBlock to be called when a client sends MIDI to the virtual
2022 /// destination.
2023 ///
2024 /// Returns: An OSStatus result code.
2025 ///
2026 ///
2027 /// The specified readBlock gets called when clients send MIDI to your virtual destination.
2028 ///
2029 /// Drivers need not call this; when they create devices and entities, sources and
2030 /// destinations are created at that time.
2031 ///
2032 /// After creating a virtual destination, it's a good idea to assign it the same unique ID
2033 /// it had the last time your application created it. (Although you should be prepared for
2034 /// this to fail in the unlikely event of a collision.) This will permit other clients
2035 /// to retain persistent references to your virtual destination more easily.
2036 ///
2037 /// See the discussion of kMIDIPropertyAdvanceScheduleTimeMuSec for notes about the
2038 /// relationship between when a sender sends MIDI to the destination and when it is
2039 /// received.
2040 ///
2041 /// # Safety
2042 ///
2043 /// - `out_dest` must be a valid pointer.
2044 /// - `read_block` must be a valid pointer.
2045 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
2046 pub fn MIDIDestinationCreateWithProtocol(
2047 client: MIDIClientRef,
2048 name: &CFString,
2049 protocol: MIDIProtocolID,
2050 out_dest: NonNull<MIDIEndpointRef>,
2051 read_block: MIDIReceiveBlock,
2052 ) -> OSStatus;
2053}
2054
2055extern "C-unwind" {
2056 /// Creates a virtual destination in a client.
2057 ///
2058 ///
2059 /// Parameter `client`: The client owning the virtual destination.
2060 ///
2061 /// Parameter `name`: The name of the virtual destination.
2062 ///
2063 /// Parameter `readProc`: The MIDIReadProc to be called when a client sends MIDI to
2064 /// the virtual destination.
2065 ///
2066 /// Parameter `refCon`: The refCon to be passed to the readProc.
2067 ///
2068 /// Parameter `outDest`: On successful return, a pointer to the newly-created
2069 /// destination.
2070 ///
2071 /// Returns: An OSStatus result code.
2072 ///
2073 ///
2074 /// The specified readProc gets called when clients send MIDI to your virtual destination.
2075 ///
2076 /// Drivers need not call this; when they create devices and entities, sources and
2077 /// destinations are created at that time.
2078 ///
2079 /// After creating a virtual destination, it's a good idea to assign it the same unique ID
2080 /// it had the last time your application created it. (Although you should be prepared for
2081 /// this to fail in the unlikely event of a collision.) This will permit other clients
2082 /// to retain persistent references to your virtual destination more easily.
2083 ///
2084 /// See the discussion of kMIDIPropertyAdvanceScheduleTimeMuSec for notes about the
2085 /// relationship between when a sender sends MIDI to the destination and when it is
2086 /// received.
2087 ///
2088 /// # Safety
2089 ///
2090 /// - `read_proc` must be implemented correctly.
2091 /// - `ref_con` must be a valid pointer or null.
2092 /// - `out_dest` must be a valid pointer.
2093 #[cfg(feature = "objc2-core-foundation")]
2094 #[deprecated]
2095 pub fn MIDIDestinationCreate(
2096 client: MIDIClientRef,
2097 name: &CFString,
2098 read_proc: MIDIReadProc,
2099 ref_con: *mut c_void,
2100 out_dest: NonNull<MIDIEndpointRef>,
2101 ) -> OSStatus;
2102}
2103
2104extern "C-unwind" {
2105 /// Creates a virtual destination in a client.
2106 ///
2107 ///
2108 /// Parameter `client`: The client owning the virtual destination.
2109 ///
2110 /// Parameter `name`: The name of the virtual destination.
2111 ///
2112 /// Parameter `outDest`: On successful return, a pointer to the newly-created
2113 /// destination.
2114 ///
2115 /// Parameter `readBlock`: The MIDIReadBlock to be called when a client sends MIDI to the virtual
2116 /// destination.
2117 ///
2118 /// Returns: An OSStatus result code.
2119 ///
2120 ///
2121 /// The specified readBlock gets called when clients send MIDI to your virtual destination.
2122 ///
2123 /// Drivers need not call this; when they create devices and entities, sources and
2124 /// destinations are created at that time.
2125 ///
2126 /// After creating a virtual destination, it's a good idea to assign it the same unique ID
2127 /// it had the last time your application created it. (Although you should be prepared for
2128 /// this to fail in the unlikely event of a collision.) This will permit other clients
2129 /// to retain persistent references to your virtual destination more easily.
2130 ///
2131 /// See the discussion of kMIDIPropertyAdvanceScheduleTimeMuSec for notes about the
2132 /// relationship between when a sender sends MIDI to the destination and when it is
2133 /// received.
2134 ///
2135 /// # Safety
2136 ///
2137 /// - `out_dest` must be a valid pointer.
2138 /// - `read_block` must be a valid pointer.
2139 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
2140 #[deprecated]
2141 pub fn MIDIDestinationCreateWithBlock(
2142 client: MIDIClientRef,
2143 name: &CFString,
2144 out_dest: NonNull<MIDIEndpointRef>,
2145 read_block: MIDIReadBlock,
2146 ) -> OSStatus;
2147}
2148
2149extern "C-unwind" {
2150 /// Creates a virtual source in a client.
2151 ///
2152 ///
2153 /// Parameter `client`: The client owning the virtual source.
2154 ///
2155 /// Parameter `name`: The name of the virtual source.
2156 ///
2157 /// Parameter `protocol`: The MIDI protocol variant to be sent from this source. The system
2158 /// will automatically convert from this protocol to the protocol of
2159 /// the destination as needed.
2160 ///
2161 /// Parameter `outSrc`: On successful return, a pointer to the newly-created
2162 /// source.
2163 ///
2164 /// Returns: An OSStatus result code.
2165 ///
2166 ///
2167 /// Drivers need not call this; when they create devices and entities, sources and
2168 /// destinations are created at that time.
2169 ///
2170 /// After creating a virtual source, use MIDIReceivedEventList to transmit MIDI messages from your
2171 /// virtual source to any clients connected to the virtual source.
2172 ///
2173 /// After creating a virtual source, it's a good idea to assign it the same unique ID it had
2174 /// the last time your application created it. (Although you should be prepared for this to
2175 /// fail in the unlikely event of a collision.) This will permit other clients to retain
2176 /// persistent references to your virtual source more easily.
2177 ///
2178 /// # Safety
2179 ///
2180 /// `out_src` must be a valid pointer.
2181 #[cfg(feature = "objc2-core-foundation")]
2182 pub fn MIDISourceCreateWithProtocol(
2183 client: MIDIClientRef,
2184 name: &CFString,
2185 protocol: MIDIProtocolID,
2186 out_src: NonNull<MIDIEndpointRef>,
2187 ) -> OSStatus;
2188}
2189
2190extern "C-unwind" {
2191 /// Creates a virtual source in a client.
2192 ///
2193 ///
2194 /// Parameter `client`: The client owning the virtual source.
2195 ///
2196 /// Parameter `name`: The name of the virtual source.
2197 ///
2198 /// Parameter `outSrc`: On successful return, a pointer to the newly-created
2199 /// source.
2200 ///
2201 /// Returns: An OSStatus result code.
2202 ///
2203 ///
2204 /// Drivers need not call this; when they create devices and entities, sources and
2205 /// destinations are created at that time.
2206 ///
2207 /// After creating a virtual source, use MIDIReceived to transmit MIDI messages from your
2208 /// virtual source to any clients connected to the virtual source.
2209 ///
2210 /// After creating a virtual source, it's a good idea to assign it the same unique ID it had
2211 /// the last time your application created it. (Although you should be prepared for this to
2212 /// fail in the unlikely event of a collision.) This will permit other clients to retain
2213 /// persistent references to your virtual source more easily.
2214 ///
2215 /// # Safety
2216 ///
2217 /// `out_src` must be a valid pointer.
2218 #[cfg(feature = "objc2-core-foundation")]
2219 #[deprecated]
2220 pub fn MIDISourceCreate(
2221 client: MIDIClientRef,
2222 name: &CFString,
2223 out_src: NonNull<MIDIEndpointRef>,
2224 ) -> OSStatus;
2225}
2226
2227extern "C-unwind" {
2228 /// Disposes a virtual source or destination your client created.
2229 ///
2230 ///
2231 /// Parameter `endpt`: The endpoint to be disposed.
2232 ///
2233 ///
2234 /// Returns: An OSStatus result code.
2235 pub fn MIDIEndpointDispose(endpt: MIDIEndpointRef) -> OSStatus;
2236}
2237
2238extern "C-unwind" {
2239 /// Returns the number of external MIDI devices in the system.
2240 ///
2241 ///
2242 /// Returns: The number of external devices in the system, or 0 if an error
2243 /// occurred.
2244 ///
2245 ///
2246 /// External MIDI devices are MIDI devices connected to driver endpoints via a standard MIDI
2247 /// cable. Their presence is completely optional, only when a UI (such as Audio MIDI Setup)
2248 /// adds them.
2249 pub fn MIDIGetNumberOfExternalDevices() -> ItemCount;
2250}
2251
2252extern "C-unwind" {
2253 /// Returns one of the external devices in the system.
2254 ///
2255 ///
2256 /// Parameter `deviceIndex0`: The index (0...MIDIGetNumberOfDevices()-1) of the device
2257 /// to return.
2258 ///
2259 /// Returns: A reference to a device, or NULL if an error occurred.
2260 ///
2261 ///
2262 /// Use this to enumerate the external devices in the system.
2263 pub fn MIDIGetExternalDevice(device_index0: ItemCount) -> MIDIDeviceRef;
2264}
2265
2266extern "C-unwind" {
2267 /// Gets an object's integer-type property.
2268 ///
2269 ///
2270 /// Parameter `obj`: The object whose property is to be returned.
2271 ///
2272 /// Parameter `propertyID`: Name of the property to return.
2273 ///
2274 /// Parameter `outValue`: On successful return, the value of the property.
2275 ///
2276 /// Returns: An OSStatus result code.
2277 ///
2278 ///
2279 /// (See the MIDIObjectRef documentation for information about properties.)
2280 ///
2281 /// # Safety
2282 ///
2283 /// `out_value` must be a valid pointer.
2284 #[cfg(feature = "objc2-core-foundation")]
2285 pub fn MIDIObjectGetIntegerProperty(
2286 obj: MIDIObjectRef,
2287 property_id: &CFString,
2288 out_value: NonNull<i32>,
2289 ) -> OSStatus;
2290}
2291
2292extern "C-unwind" {
2293 /// Sets an object's integer-type property.
2294 ///
2295 ///
2296 /// Parameter `obj`: The object whose property is to be altered.
2297 ///
2298 /// Parameter `propertyID`: Name of the property to set.
2299 ///
2300 /// Parameter `value`: New value of the property.
2301 ///
2302 /// Returns: An OSStatus result code.
2303 ///
2304 ///
2305 /// (See the MIDIObjectRef documentation for information about properties.)
2306 #[cfg(feature = "objc2-core-foundation")]
2307 pub fn MIDIObjectSetIntegerProperty(
2308 obj: MIDIObjectRef,
2309 property_id: &CFString,
2310 value: i32,
2311 ) -> OSStatus;
2312}
2313
2314extern "C-unwind" {
2315 /// Gets an object's string-type property.
2316 ///
2317 ///
2318 /// Parameter `obj`: The object whose property is to be returned.
2319 ///
2320 /// Parameter `propertyID`: Name of the property to return.
2321 ///
2322 /// Parameter `str`: On successful return, the value of the property.
2323 ///
2324 /// Returns: An OSStatus result code.
2325 ///
2326 ///
2327 /// (See the MIDIObjectRef documentation for information about properties.)
2328 ///
2329 /// # Safety
2330 ///
2331 /// `str` must be a valid pointer.
2332 #[cfg(feature = "objc2-core-foundation")]
2333 pub fn MIDIObjectGetStringProperty(
2334 obj: MIDIObjectRef,
2335 property_id: &CFString,
2336 str: NonNull<*const CFString>,
2337 ) -> OSStatus;
2338}
2339
2340extern "C-unwind" {
2341 /// Sets an object's string-type property.
2342 ///
2343 ///
2344 /// Parameter `obj`: The object whose property is to be altered.
2345 ///
2346 /// Parameter `propertyID`: Name of the property to set.
2347 ///
2348 /// Parameter `str`: New value of the property.
2349 ///
2350 /// Returns: An OSStatus result code.
2351 ///
2352 ///
2353 /// (See the MIDIObjectRef documentation for information about properties.)
2354 #[cfg(feature = "objc2-core-foundation")]
2355 pub fn MIDIObjectSetStringProperty(
2356 obj: MIDIObjectRef,
2357 property_id: &CFString,
2358 str: &CFString,
2359 ) -> OSStatus;
2360}
2361
2362extern "C-unwind" {
2363 /// Gets an object's data-type property.
2364 ///
2365 ///
2366 /// (See the MIDIObjectRef documentation for information
2367 /// about properties.)
2368 ///
2369 ///
2370 /// Parameter `obj`: The object whose property is to be returned.
2371 ///
2372 /// Parameter `propertyID`: Name of the property to return.
2373 ///
2374 /// Parameter `outData`: On successful return, the value of the property.
2375 ///
2376 /// Returns: An OSStatus result code.
2377 ///
2378 /// # Safety
2379 ///
2380 /// `out_data` must be a valid pointer.
2381 #[cfg(feature = "objc2-core-foundation")]
2382 pub fn MIDIObjectGetDataProperty(
2383 obj: MIDIObjectRef,
2384 property_id: &CFString,
2385 out_data: NonNull<*const CFData>,
2386 ) -> OSStatus;
2387}
2388
2389extern "C-unwind" {
2390 /// Sets an object's data-type property.
2391 ///
2392 ///
2393 /// Parameter `obj`: The object whose property is to be altered.
2394 ///
2395 /// Parameter `propertyID`: Name of the property to set.
2396 ///
2397 /// Parameter `data`: New value of the property.
2398 ///
2399 /// Returns: An OSStatus result code.
2400 ///
2401 ///
2402 /// (See the MIDIObjectRef documentation for information about properties.)
2403 #[cfg(feature = "objc2-core-foundation")]
2404 pub fn MIDIObjectSetDataProperty(
2405 obj: MIDIObjectRef,
2406 property_id: &CFString,
2407 data: &CFData,
2408 ) -> OSStatus;
2409}
2410
2411extern "C-unwind" {
2412 /// Gets an object's dictionary-type property.
2413 ///
2414 ///
2415 /// Parameter `obj`: The object whose property is to be returned.
2416 ///
2417 /// Parameter `propertyID`: Name of the property to return.
2418 ///
2419 /// Parameter `outDict`: On successful return, the value of the property.
2420 ///
2421 /// Returns: An OSStatus result code.
2422 ///
2423 ///
2424 /// (See the MIDIObjectRef documentation for information about properties.)
2425 ///
2426 /// # Safety
2427 ///
2428 /// `out_dict` must be a valid pointer.
2429 #[cfg(feature = "objc2-core-foundation")]
2430 pub fn MIDIObjectGetDictionaryProperty(
2431 obj: MIDIObjectRef,
2432 property_id: &CFString,
2433 out_dict: NonNull<*const CFDictionary>,
2434 ) -> OSStatus;
2435}
2436
2437extern "C-unwind" {
2438 /// Sets an object's dictionary-type property.
2439 ///
2440 ///
2441 /// Parameter `obj`: The object whose property is to be altered.
2442 ///
2443 /// Parameter `propertyID`: Name of the property to set.
2444 ///
2445 /// Parameter `dict`: New value of the property.
2446 ///
2447 /// Returns: An OSStatus result code.
2448 ///
2449 ///
2450 /// (See the MIDIObjectRef documentation for information about properties.)
2451 ///
2452 /// # Safety
2453 ///
2454 /// `dict` generics must be of the correct type.
2455 #[cfg(feature = "objc2-core-foundation")]
2456 pub fn MIDIObjectSetDictionaryProperty(
2457 obj: MIDIObjectRef,
2458 property_id: &CFString,
2459 dict: &CFDictionary,
2460 ) -> OSStatus;
2461}
2462
2463/// Gets all of an object's properties.
2464///
2465///
2466/// Parameter `obj`: The object whose properties are to be returned.
2467///
2468/// Parameter `outProperties`: On successful return, the object's properties.
2469///
2470/// Parameter `deep`: true if the object's child objects are to be included
2471/// (e.g. a device's entities, or an entity's endpoints).
2472///
2473/// Returns: An OSStatus result code.
2474///
2475///
2476/// Returns a CFPropertyList of all of an object's properties. The property list may be a
2477/// dictionary or an array. Dictionaries map property names (CFString) to values, which may
2478/// be CFNumber, CFString, or CFData. Arrays are arrays of such values.
2479///
2480/// Properties which an object inherits from its owning object (if any) are not included.
2481///
2482/// # Safety
2483///
2484/// `out_properties` must be a valid pointer.
2485#[cfg(feature = "objc2-core-foundation")]
2486#[inline]
2487pub unsafe extern "C-unwind" fn MIDIObjectGetProperties(
2488 obj: MIDIObjectRef,
2489 out_properties: NonNull<*const CFPropertyList>,
2490 deep: bool,
2491) -> OSStatus {
2492 extern "C-unwind" {
2493 fn MIDIObjectGetProperties(
2494 obj: MIDIObjectRef,
2495 out_properties: NonNull<*const CFPropertyList>,
2496 deep: Boolean,
2497 ) -> OSStatus;
2498 }
2499 unsafe { MIDIObjectGetProperties(obj, out_properties, deep as _) }
2500}
2501
2502extern "C-unwind" {
2503 /// Removes an object's property.
2504 ///
2505 ///
2506 /// Parameter `obj`: The object whose property is to be removed.
2507 ///
2508 /// Parameter `propertyID`: The property to be removed.
2509 ///
2510 /// Returns: An OSStatus result code.
2511 #[cfg(feature = "objc2-core-foundation")]
2512 pub fn MIDIObjectRemoveProperty(obj: MIDIObjectRef, property_id: &CFString) -> OSStatus;
2513}
2514
2515extern "C-unwind" {
2516 /// Locates a device, external device, entity, or endpoint
2517 /// by its uniqueID.
2518 ///
2519 /// Parameter `inUniqueID`: The uniqueID of the object to search for. (This should
2520 /// be the result of an earlier call to MIDIObjectGetIntegerProperty
2521 /// for the property kMIDIPropertyUniqueID).
2522 ///
2523 /// Parameter `outObject`: The returned object, or 0 if the object was not found or
2524 /// an error occurred. This should be cast to the appropriate
2525 /// type (MIDIDeviceRef, MIDIEntityRef, MIDIEndpointRef),
2526 /// according to *outObjectType.
2527 ///
2528 /// Parameter `outObjectType`: On exit, the type of object which was found; undefined
2529 /// if none found.
2530 ///
2531 /// Returns: An OSStatus error code, including kMIDIObjectNotFound if there
2532 /// is no object with the specified uniqueID.
2533 ///
2534 /// # Safety
2535 ///
2536 /// - `out_object` must be a valid pointer or null.
2537 /// - `out_object_type` must be a valid pointer or null.
2538 pub fn MIDIObjectFindByUniqueID(
2539 in_unique_id: MIDIUniqueID,
2540 out_object: *mut MIDIObjectRef,
2541 out_object_type: *mut MIDIObjectType,
2542 ) -> OSStatus;
2543}
2544
2545extern "C-unwind" {
2546 /// Sends MIDI to a destination.
2547 ///
2548 ///
2549 /// Parameter `port`: The output port through which the MIDI is to be sent.
2550 ///
2551 /// Parameter `dest`: The destination to receive the events.
2552 ///
2553 /// Parameter `evtlist`: The MIDI events to be sent.
2554 ///
2555 /// Returns: An OSStatus result code.
2556 ///
2557 ///
2558 /// Events with future timestamps are scheduled for future delivery. CoreMIDI performs
2559 /// any needed MIDI merging.
2560 ///
2561 /// # Safety
2562 ///
2563 /// `evtlist` must be a valid pointer.
2564 pub fn MIDISendEventList(
2565 port: MIDIPortRef,
2566 dest: MIDIEndpointRef,
2567 evtlist: NonNull<MIDIEventList>,
2568 ) -> OSStatus;
2569}
2570
2571extern "C-unwind" {
2572 /// Sends MIDI to a destination.
2573 ///
2574 ///
2575 /// Parameter `port`: The output port through which the MIDI is to be sent.
2576 ///
2577 /// Parameter `dest`: The destination to receive the events.
2578 ///
2579 /// Parameter `pktlist`: The MIDI events to be sent.
2580 ///
2581 /// Returns: An OSStatus result code.
2582 ///
2583 ///
2584 /// Events with future timestamps are scheduled for future delivery. CoreMIDI performs
2585 /// any needed MIDI merging.
2586 ///
2587 /// # Safety
2588 ///
2589 /// `pktlist` must be a valid pointer.
2590 #[deprecated]
2591 pub fn MIDISend(
2592 port: MIDIPortRef,
2593 dest: MIDIEndpointRef,
2594 pktlist: NonNull<MIDIPacketList>,
2595 ) -> OSStatus;
2596}
2597
2598extern "C-unwind" {
2599 /// Sends a single system-exclusive event, asynchronously.
2600 ///
2601 ///
2602 /// Parameter `request`: Contains the destination, and a pointer to the MIDI data to be sent.
2603 ///
2604 /// Returns: An OSStatus result code.
2605 ///
2606 ///
2607 /// request->data must point to a single MIDI system-exclusive message, or portion thereof.
2608 ///
2609 /// # Safety
2610 ///
2611 /// `request` must be a valid pointer.
2612 pub fn MIDISendSysex(request: NonNull<MIDISysexSendRequest>) -> OSStatus;
2613}
2614
2615extern "C-unwind" {
2616 /// Sends a single UMP system-exclusive event, asynchronously.
2617 ///
2618 ///
2619 /// Parameter `umpRequest`: Contains the destination, and a pointer to the MIDI data to be sent.
2620 ///
2621 /// Returns: An OSStatus result code.
2622 ///
2623 ///
2624 /// request->words must point to a single MIDI system-exclusive message, or portion thereof.
2625 ///
2626 /// # Safety
2627 ///
2628 /// `ump_request` must be a valid pointer.
2629 pub fn MIDISendUMPSysex(ump_request: NonNull<MIDISysexSendRequestUMP>) -> OSStatus;
2630}
2631
2632extern "C-unwind" {
2633 /// Sends single system-exclusive 8-bit event, asynchronously.
2634 ///
2635 ///
2636 /// Parameter `umpRequest`: Contains the destination, and a pointer to the 8-bit system-exclusive data to be sent.
2637 ///
2638 /// Returns: An OSStatus result code.
2639 ///
2640 ///
2641 /// request->data must point to a single MIDI system-exclusive message, or portion thereof.
2642 ///
2643 /// # Safety
2644 ///
2645 /// `ump_request` must be a valid pointer.
2646 pub fn MIDISendUMPSysex8(ump_request: NonNull<MIDISysexSendRequestUMP>) -> OSStatus;
2647}
2648
2649impl MIDIEventPacket {
2650 /// Gets MIDI 1.0 SysEx bytes on the indicated group.
2651 ///
2652 ///
2653 /// Parameter `pkt`: A MIDIEventPacket containing UMP system-exclusive data.
2654 ///
2655 ///
2656 /// Parameter `groupIndex`: The target group index, 0 to 15.
2657 ///
2658 ///
2659 /// Parameter `outData`: When successful, a CFDataRef byte stream of extracted system-exclusive data.
2660 ///
2661 ///
2662 /// Returns: An OSStatus result code.
2663 ///
2664 ///
2665 /// pkt must contain a single MIDI system-exclusive message on groupIndex, or portion thereof.
2666 ///
2667 /// # Safety
2668 ///
2669 /// - `pkt` must be a valid pointer.
2670 /// - `out_data` must be a valid pointer.
2671 #[doc(alias = "MIDIEventPacketSysexBytesForGroup")]
2672 #[cfg(feature = "objc2-core-foundation")]
2673 #[inline]
2674 pub unsafe fn sysex_bytes_for_group(
2675 pkt: NonNull<MIDIEventPacket>,
2676 group_index: u8,
2677 out_data: NonNull<*const CFData>,
2678 ) -> OSStatus {
2679 extern "C-unwind" {
2680 fn MIDIEventPacketSysexBytesForGroup(
2681 pkt: NonNull<MIDIEventPacket>,
2682 group_index: u8,
2683 out_data: NonNull<*const CFData>,
2684 ) -> OSStatus;
2685 }
2686 unsafe { MIDIEventPacketSysexBytesForGroup(pkt, group_index, out_data) }
2687 }
2688}
2689
2690extern "C-unwind" {
2691 /// Distributes incoming MIDI from a source to the client input ports
2692 /// which are connected to that source.
2693 ///
2694 ///
2695 /// Parameter `src`: The source which is transmitting MIDI.
2696 ///
2697 /// Parameter `evtlist`: The MIDI events to be transmitted.
2698 ///
2699 /// Returns: An OSStatus result code.
2700 ///
2701 ///
2702 /// Drivers should call this function when receiving MIDI from a source.
2703 ///
2704 /// Clients which have created virtual sources, using MIDISourceCreateWithProtocol, should call this
2705 /// function when the source is generating MIDI.
2706 ///
2707 /// Unlike MIDISendEventList(), a timestamp of 0 is not equivalent to "now"; the driver or virtual
2708 /// source is responsible for putting proper timestamps in the packets.
2709 ///
2710 /// # Safety
2711 ///
2712 /// `evtlist` must be a valid pointer.
2713 pub fn MIDIReceivedEventList(src: MIDIEndpointRef, evtlist: NonNull<MIDIEventList>)
2714 -> OSStatus;
2715}
2716
2717extern "C-unwind" {
2718 /// Distributes incoming MIDI from a source to the client input ports
2719 /// which are connected to that source.
2720 ///
2721 ///
2722 /// Parameter `src`: The source which is transmitting MIDI.
2723 ///
2724 /// Parameter `pktlist`: The MIDI events to be transmitted.
2725 ///
2726 /// Returns: An OSStatus result code.
2727 ///
2728 ///
2729 /// Drivers should call this function when receiving MIDI from a source.
2730 ///
2731 /// Clients which have created virtual sources, using MIDISourceCreate, should call this
2732 /// function when the source is generating MIDI.
2733 ///
2734 /// Unlike MIDISend(), a timestamp of 0 is not equivalent to "now"; the driver or virtual
2735 /// source is responsible for putting proper timestamps in the packets.
2736 ///
2737 /// # Safety
2738 ///
2739 /// `pktlist` must be a valid pointer.
2740 #[deprecated]
2741 pub fn MIDIReceived(src: MIDIEndpointRef, pktlist: NonNull<MIDIPacketList>) -> OSStatus;
2742}
2743
2744extern "C-unwind" {
2745 /// Unschedules previously-sent packets.
2746 ///
2747 ///
2748 /// Parameter `dest`: All pending events scheduled to be sent to this destination
2749 /// are unscheduled. If NULL, the operation applies to
2750 /// all destinations.
2751 ///
2752 ///
2753 /// Clients may use MIDIFlushOutput to cancel the sending of packets that were previously
2754 /// scheduled for future delivery.
2755 pub fn MIDIFlushOutput(dest: MIDIEndpointRef) -> OSStatus;
2756}
2757
2758extern "C-unwind" {
2759 /// Stops and restarts MIDI I/O.
2760 ///
2761 ///
2762 /// This is useful for forcing CoreMIDI to ask its drivers to rescan for hardware.
2763 ///
2764 ///
2765 /// Returns: An OSStatus result code.
2766 pub fn MIDIRestart() -> OSStatus;
2767}
2768
2769impl MIDIEventPacket {
2770 // TODO: pub fn MIDIEventPacketNext(pkt: NonNull<MIDIEventPacket>,)-> Option<NonNull<MIDIEventPacket>>;
2771}
2772
2773impl MIDIEventList {
2774 /// Prepares a MIDIEventList to be built up dynamically.
2775 ///
2776 ///
2777 /// Parameter `evtlist`: The event list to be initialized.
2778 ///
2779 ///
2780 /// Returns: A pointer to the first MIDIEventPacket in the event list.
2781 ///
2782 /// # Safety
2783 ///
2784 /// `evtlist` must be a valid pointer.
2785 #[doc(alias = "MIDIEventListInit")]
2786 #[inline]
2787 pub unsafe fn init(
2788 evtlist: NonNull<MIDIEventList>,
2789 protocol: MIDIProtocolID,
2790 ) -> NonNull<MIDIEventPacket> {
2791 extern "C-unwind" {
2792 fn MIDIEventListInit(
2793 evtlist: NonNull<MIDIEventList>,
2794 protocol: MIDIProtocolID,
2795 ) -> Option<NonNull<MIDIEventPacket>>;
2796 }
2797 let ret = unsafe { MIDIEventListInit(evtlist, protocol) };
2798 ret.expect("function was marked as returning non-null, but actually returned NULL")
2799 }
2800
2801 /// Adds a MIDI event to a MIDIEventList.
2802 ///
2803 ///
2804 /// Parameter `evtlist`: The event list to which the event is to be added.
2805 ///
2806 /// Parameter `listSize`: The capacity, in bytes, of the event list.
2807 ///
2808 /// Parameter `curPacket`: A packet pointer returned by a previous call to
2809 /// MIDIEventListInit or MIDIEventListAdd for this packet
2810 /// list.
2811 ///
2812 /// Parameter `time`: The new event's time.
2813 ///
2814 /// Parameter `wordCount`: The number of valid MIDI 32-bit words which follow, in data.
2815 ///
2816 /// Parameter `words`: The new event. May be a single MIDI event, or a partial
2817 /// sys-ex event. Running status is
2818 /// <b>
2819 /// not
2820 /// </b>
2821 /// permitted.
2822 ///
2823 /// Returns: Returns null if there was not room in the packet for the
2824 /// event; otherwise returns a packet pointer which should be
2825 /// passed as curPacket in a subsequent call to this function.
2826 ///
2827 ///
2828 /// The maximum size of a event list is 65536 bytes. Large sysex messages must be sent in
2829 /// smaller event lists.
2830 ///
2831 /// Note that events must use the same protocol as was passed to MIDIEventListInit().
2832 ///
2833 /// # Safety
2834 ///
2835 /// - `evtlist` must be a valid pointer.
2836 /// - `cur_packet` must be a valid pointer.
2837 /// - `words` must be a valid pointer.
2838 #[doc(alias = "MIDIEventListAdd")]
2839 #[inline]
2840 pub unsafe fn add(
2841 evtlist: NonNull<MIDIEventList>,
2842 list_size: ByteCount,
2843 cur_packet: NonNull<MIDIEventPacket>,
2844 time: MIDITimeStamp,
2845 word_count: ByteCount,
2846 words: NonNull<u32>,
2847 ) -> NonNull<MIDIEventPacket> {
2848 extern "C-unwind" {
2849 fn MIDIEventListAdd(
2850 evtlist: NonNull<MIDIEventList>,
2851 list_size: ByteCount,
2852 cur_packet: NonNull<MIDIEventPacket>,
2853 time: MIDITimeStamp,
2854 word_count: ByteCount,
2855 words: NonNull<u32>,
2856 ) -> Option<NonNull<MIDIEventPacket>>;
2857 }
2858 let ret =
2859 unsafe { MIDIEventListAdd(evtlist, list_size, cur_packet, time, word_count, words) };
2860 ret.expect("function was marked as returning non-null, but actually returned NULL")
2861 }
2862}
2863
2864impl MIDIPacket {
2865 // TODO: pub fn MIDIPacketNext(pkt: NonNull<MIDIPacket>,)-> Option<NonNull<MIDIPacket>>;
2866}
2867
2868impl MIDIPacketList {
2869 /// Prepares a MIDIPacketList to be built up dynamically.
2870 ///
2871 ///
2872 /// Parameter `pktlist`: The packet list to be initialized.
2873 ///
2874 ///
2875 /// Returns: A pointer to the first MIDIPacket in the packet list.
2876 ///
2877 /// # Safety
2878 ///
2879 /// `pktlist` must be a valid pointer.
2880 #[doc(alias = "MIDIPacketListInit")]
2881 #[deprecated]
2882 #[inline]
2883 pub unsafe fn init(pktlist: NonNull<MIDIPacketList>) -> NonNull<MIDIPacket> {
2884 extern "C-unwind" {
2885 fn MIDIPacketListInit(pktlist: NonNull<MIDIPacketList>) -> Option<NonNull<MIDIPacket>>;
2886 }
2887 let ret = unsafe { MIDIPacketListInit(pktlist) };
2888 ret.expect("function was marked as returning non-null, but actually returned NULL")
2889 }
2890
2891 /// Adds a MIDI event to a MIDIPacketList.
2892 ///
2893 ///
2894 /// Parameter `pktlist`: The packet list to which the event is to be added.
2895 ///
2896 /// Parameter `listSize`: The size, in bytes, of the packet list.
2897 ///
2898 /// Parameter `curPacket`: A packet pointer returned by a previous call to
2899 /// MIDIPacketListInit or MIDIPacketListAdd for this packet
2900 /// list.
2901 ///
2902 /// Parameter `time`: The new event's time.
2903 ///
2904 /// Parameter `nData`: The length of the new event, in bytes.
2905 ///
2906 /// Parameter `data`: The new event. May be a single MIDI event, or a partial
2907 /// sys-ex event. Running status is
2908 /// <b>
2909 /// not
2910 /// </b>
2911 /// permitted.
2912 ///
2913 /// Returns: Returns null if there was not room in the packet for the
2914 /// event; otherwise returns a packet pointer which should be
2915 /// passed as curPacket in a subsequent call to this function.
2916 ///
2917 ///
2918 /// The maximum size of a packet list is 65536 bytes. Large sysex messages must be sent in
2919 /// smaller packet lists.
2920 ///
2921 /// # Safety
2922 ///
2923 /// - `pktlist` must be a valid pointer.
2924 /// - `cur_packet` must be a valid pointer.
2925 /// - `data` must be a valid pointer.
2926 #[doc(alias = "MIDIPacketListAdd")]
2927 #[deprecated]
2928 #[inline]
2929 pub unsafe fn add(
2930 pktlist: NonNull<MIDIPacketList>,
2931 list_size: ByteCount,
2932 cur_packet: NonNull<MIDIPacket>,
2933 time: MIDITimeStamp,
2934 n_data: ByteCount,
2935 data: NonNull<Byte>,
2936 ) -> NonNull<MIDIPacket> {
2937 extern "C-unwind" {
2938 fn MIDIPacketListAdd(
2939 pktlist: NonNull<MIDIPacketList>,
2940 list_size: ByteCount,
2941 cur_packet: NonNull<MIDIPacket>,
2942 time: MIDITimeStamp,
2943 n_data: ByteCount,
2944 data: NonNull<Byte>,
2945 ) -> Option<NonNull<MIDIPacket>>;
2946 }
2947 let ret = unsafe { MIDIPacketListAdd(pktlist, list_size, cur_packet, time, n_data, data) };
2948 ret.expect("function was marked as returning non-null, but actually returned NULL")
2949 }
2950}
2951
2952extern "C-unwind" {
2953 #[cfg(feature = "objc2-core-foundation")]
2954 #[deprecated = "renamed to `MIDIEventPacket::sysex_bytes_for_group`"]
2955 pub fn MIDIEventPacketSysexBytesForGroup(
2956 pkt: NonNull<MIDIEventPacket>,
2957 group_index: u8,
2958 out_data: NonNull<*const CFData>,
2959 ) -> OSStatus;
2960}
2961
2962#[deprecated = "renamed to `MIDIEventList::init`"]
2963#[inline]
2964pub unsafe extern "C-unwind" fn MIDIEventListInit(
2965 evtlist: NonNull<MIDIEventList>,
2966 protocol: MIDIProtocolID,
2967) -> NonNull<MIDIEventPacket> {
2968 extern "C-unwind" {
2969 fn MIDIEventListInit(
2970 evtlist: NonNull<MIDIEventList>,
2971 protocol: MIDIProtocolID,
2972 ) -> Option<NonNull<MIDIEventPacket>>;
2973 }
2974 let ret = unsafe { MIDIEventListInit(evtlist, protocol) };
2975 ret.expect("function was marked as returning non-null, but actually returned NULL")
2976}
2977
2978#[deprecated = "renamed to `MIDIEventList::add`"]
2979#[inline]
2980pub unsafe extern "C-unwind" fn MIDIEventListAdd(
2981 evtlist: NonNull<MIDIEventList>,
2982 list_size: ByteCount,
2983 cur_packet: NonNull<MIDIEventPacket>,
2984 time: MIDITimeStamp,
2985 word_count: ByteCount,
2986 words: NonNull<u32>,
2987) -> NonNull<MIDIEventPacket> {
2988 extern "C-unwind" {
2989 fn MIDIEventListAdd(
2990 evtlist: NonNull<MIDIEventList>,
2991 list_size: ByteCount,
2992 cur_packet: NonNull<MIDIEventPacket>,
2993 time: MIDITimeStamp,
2994 word_count: ByteCount,
2995 words: NonNull<u32>,
2996 ) -> Option<NonNull<MIDIEventPacket>>;
2997 }
2998 let ret = unsafe { MIDIEventListAdd(evtlist, list_size, cur_packet, time, word_count, words) };
2999 ret.expect("function was marked as returning non-null, but actually returned NULL")
3000}
3001
3002#[deprecated = "renamed to `MIDIPacketList::init`"]
3003#[inline]
3004pub unsafe extern "C-unwind" fn MIDIPacketListInit(
3005 pktlist: NonNull<MIDIPacketList>,
3006) -> NonNull<MIDIPacket> {
3007 extern "C-unwind" {
3008 fn MIDIPacketListInit(pktlist: NonNull<MIDIPacketList>) -> Option<NonNull<MIDIPacket>>;
3009 }
3010 let ret = unsafe { MIDIPacketListInit(pktlist) };
3011 ret.expect("function was marked as returning non-null, but actually returned NULL")
3012}
3013
3014#[deprecated = "renamed to `MIDIPacketList::add`"]
3015#[inline]
3016pub unsafe extern "C-unwind" fn MIDIPacketListAdd(
3017 pktlist: NonNull<MIDIPacketList>,
3018 list_size: ByteCount,
3019 cur_packet: NonNull<MIDIPacket>,
3020 time: MIDITimeStamp,
3021 n_data: ByteCount,
3022 data: NonNull<Byte>,
3023) -> NonNull<MIDIPacket> {
3024 extern "C-unwind" {
3025 fn MIDIPacketListAdd(
3026 pktlist: NonNull<MIDIPacketList>,
3027 list_size: ByteCount,
3028 cur_packet: NonNull<MIDIPacket>,
3029 time: MIDITimeStamp,
3030 n_data: ByteCount,
3031 data: NonNull<Byte>,
3032 ) -> Option<NonNull<MIDIPacket>>;
3033 }
3034 let ret = unsafe { MIDIPacketListAdd(pktlist, list_size, cur_packet, time, n_data, data) };
3035 ret.expect("function was marked as returning non-null, but actually returned NULL")
3036}