objc2_core_midi/generated/
MIDIMessages.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midimessagetype?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct MIDIMessageType(pub c_uint);
14impl MIDIMessageType {
15    #[doc(alias = "kMIDIMessageTypeUtility")]
16    pub const Utility: Self = Self(0x0);
17    #[doc(alias = "kMIDIMessageTypeSystem")]
18    pub const System: Self = Self(0x1);
19    #[doc(alias = "kMIDIMessageTypeChannelVoice1")]
20    pub const ChannelVoice1: Self = Self(0x2);
21    #[doc(alias = "kMIDIMessageTypeSysEx")]
22    pub const SysEx: Self = Self(0x3);
23    #[doc(alias = "kMIDIMessageTypeChannelVoice2")]
24    pub const ChannelVoice2: Self = Self(0x4);
25    #[doc(alias = "kMIDIMessageTypeData128")]
26    pub const Data128: Self = Self(0x5);
27    #[doc(alias = "kMIDIMessageTypeFlexData")]
28    pub const FlexData: Self = Self(0xD);
29    #[doc(alias = "kMIDIMessageTypeUnknownF")]
30    pub const UnknownF: Self = Self(0xF);
31    #[doc(alias = "kMIDIMessageTypeStream")]
32    pub const Stream: Self = Self(0xF);
33    #[doc(alias = "kMIDIMessageTypeInvalid")]
34    pub const Invalid: Self = Self(0xFF);
35}
36
37#[cfg(feature = "objc2")]
38unsafe impl Encode for MIDIMessageType {
39    const ENCODING: Encoding = c_uint::ENCODING;
40}
41
42#[cfg(feature = "objc2")]
43unsafe impl RefEncode for MIDIMessageType {
44    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicvstatus?language=objc)
48// NS_ENUM
49#[repr(transparent)]
50#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
51pub struct MIDICVStatus(pub c_uint);
52impl MIDICVStatus {
53    #[doc(alias = "kMIDICVStatusNoteOff")]
54    pub const NoteOff: Self = Self(0x8);
55    #[doc(alias = "kMIDICVStatusNoteOn")]
56    pub const NoteOn: Self = Self(0x9);
57    #[doc(alias = "kMIDICVStatusPolyPressure")]
58    pub const PolyPressure: Self = Self(0xA);
59    #[doc(alias = "kMIDICVStatusControlChange")]
60    pub const ControlChange: Self = Self(0xB);
61    #[doc(alias = "kMIDICVStatusProgramChange")]
62    pub const ProgramChange: Self = Self(0xC);
63    #[doc(alias = "kMIDICVStatusChannelPressure")]
64    pub const ChannelPressure: Self = Self(0xD);
65    #[doc(alias = "kMIDICVStatusPitchBend")]
66    pub const PitchBend: Self = Self(0xE);
67    #[doc(alias = "kMIDICVStatusRegisteredPNC")]
68    pub const RegisteredPNC: Self = Self(0x0);
69    #[doc(alias = "kMIDICVStatusAssignablePNC")]
70    pub const AssignablePNC: Self = Self(0x1);
71    #[doc(alias = "kMIDICVStatusRegisteredControl")]
72    pub const RegisteredControl: Self = Self(0x2);
73    #[doc(alias = "kMIDICVStatusAssignableControl")]
74    pub const AssignableControl: Self = Self(0x3);
75    #[doc(alias = "kMIDICVStatusRelRegisteredControl")]
76    pub const RelRegisteredControl: Self = Self(0x4);
77    #[doc(alias = "kMIDICVStatusRelAssignableControl")]
78    pub const RelAssignableControl: Self = Self(0x5);
79    #[doc(alias = "kMIDICVStatusPerNotePitchBend")]
80    pub const PerNotePitchBend: Self = Self(0x6);
81    #[doc(alias = "kMIDICVStatusPerNoteMgmt")]
82    pub const PerNoteMgmt: Self = Self(0xF);
83}
84
85#[cfg(feature = "objc2")]
86unsafe impl Encode for MIDICVStatus {
87    const ENCODING: Encoding = c_uint::ENCODING;
88}
89
90#[cfg(feature = "objc2")]
91unsafe impl RefEncode for MIDICVStatus {
92    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
93}
94
95/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midisystemstatus?language=objc)
96// NS_ENUM
97#[repr(transparent)]
98#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
99pub struct MIDISystemStatus(pub c_uint);
100impl MIDISystemStatus {
101    #[doc(alias = "kMIDIStatusStartOfExclusive")]
102    pub const StatusStartOfExclusive: Self = Self(0xF0);
103    #[doc(alias = "kMIDIStatusEndOfExclusive")]
104    pub const StatusEndOfExclusive: Self = Self(0xF7);
105    #[doc(alias = "kMIDIStatusMTC")]
106    pub const StatusMTC: Self = Self(0xF1);
107    #[doc(alias = "kMIDIStatusSongPosPointer")]
108    pub const StatusSongPosPointer: Self = Self(0xF2);
109    #[doc(alias = "kMIDIStatusSongSelect")]
110    pub const StatusSongSelect: Self = Self(0xF3);
111    #[doc(alias = "kMIDIStatusTuneRequest")]
112    pub const StatusTuneRequest: Self = Self(0xF6);
113    #[doc(alias = "kMIDIStatusTimingClock")]
114    pub const StatusTimingClock: Self = Self(0xF8);
115    #[doc(alias = "kMIDIStatusStart")]
116    pub const StatusStart: Self = Self(0xFA);
117    #[doc(alias = "kMIDIStatusContinue")]
118    pub const StatusContinue: Self = Self(0xFB);
119    #[doc(alias = "kMIDIStatusStop")]
120    pub const StatusStop: Self = Self(0xFC);
121    #[doc(alias = "kMIDIStatusActiveSending")]
122    pub const StatusActiveSending: Self = Self(0xFE);
123    #[doc(alias = "kMIDIStatusActiveSensing")]
124    pub const StatusActiveSensing: Self = Self(MIDISystemStatus::StatusActiveSending.0);
125    #[doc(alias = "kMIDIStatusSystemReset")]
126    pub const StatusSystemReset: Self = Self(0xFF);
127}
128
129#[cfg(feature = "objc2")]
130unsafe impl Encode for MIDISystemStatus {
131    const ENCODING: Encoding = c_uint::ENCODING;
132}
133
134#[cfg(feature = "objc2")]
135unsafe impl RefEncode for MIDISystemStatus {
136    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
137}
138
139/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midisysexstatus?language=objc)
140// NS_ENUM
141#[repr(transparent)]
142#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
143pub struct MIDISysExStatus(pub c_uint);
144impl MIDISysExStatus {
145    #[doc(alias = "kMIDISysExStatusComplete")]
146    pub const Complete: Self = Self(0x0);
147    #[doc(alias = "kMIDISysExStatusStart")]
148    pub const Start: Self = Self(0x1);
149    #[doc(alias = "kMIDISysExStatusContinue")]
150    pub const Continue: Self = Self(0x2);
151    #[doc(alias = "kMIDISysExStatusEnd")]
152    pub const End: Self = Self(0x3);
153    #[doc(alias = "kMIDISysExStatusMixedDataSetHeader")]
154    pub const MixedDataSetHeader: Self = Self(0x8);
155    #[doc(alias = "kMIDISysExStatusMixedDataSetPayload")]
156    pub const MixedDataSetPayload: Self = Self(0x9);
157}
158
159#[cfg(feature = "objc2")]
160unsafe impl Encode for MIDISysExStatus {
161    const ENCODING: Encoding = c_uint::ENCODING;
162}
163
164#[cfg(feature = "objc2")]
165unsafe impl RefEncode for MIDISysExStatus {
166    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
167}
168
169/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiutilitystatus?language=objc)
170// NS_ENUM
171#[repr(transparent)]
172#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
173pub struct MIDIUtilityStatus(pub c_uint);
174impl MIDIUtilityStatus {
175    #[doc(alias = "kMIDIUtilityStatusNOOP")]
176    pub const NOOP: Self = Self(0x0);
177    #[doc(alias = "kMIDIUtilityStatusJitterReductionClock")]
178    pub const JitterReductionClock: Self = Self(0x1);
179    #[doc(alias = "kMIDIUtilityStatusJitterReductionTimestamp")]
180    pub const JitterReductionTimestamp: Self = Self(0x2);
181    #[doc(alias = "kMIDIUtilityStatusDeltaClockstampTicksPerQuarterNote")]
182    pub const DeltaClockstampTicksPerQuarterNote: Self = Self(0x3);
183    #[doc(alias = "kMIDIUtilityStatusTicksSinceLastEvent")]
184    pub const TicksSinceLastEvent: Self = Self(0x4);
185}
186
187#[cfg(feature = "objc2")]
188unsafe impl Encode for MIDIUtilityStatus {
189    const ENCODING: Encoding = c_uint::ENCODING;
190}
191
192#[cfg(feature = "objc2")]
193unsafe impl RefEncode for MIDIUtilityStatus {
194    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
195}
196
197/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/umpstreammessagestatus?language=objc)
198// NS_ENUM
199#[repr(transparent)]
200#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
201pub struct UMPStreamMessageStatus(pub c_uint);
202impl UMPStreamMessageStatus {
203    #[doc(alias = "kUMPStreamMessageStatusEndpointDiscovery")]
204    pub const EndpointDiscovery: Self = Self(0x00);
205    #[doc(alias = "kUMPStreamMessageStatusEndpointInfoNotification")]
206    pub const EndpointInfoNotification: Self = Self(0x01);
207    #[doc(alias = "kUMPStreamMessageStatusDeviceIdentityNotification")]
208    pub const DeviceIdentityNotification: Self = Self(0x02);
209    #[doc(alias = "kUMPStreamMessageStatusEndpointNameNotification")]
210    pub const EndpointNameNotification: Self = Self(0x03);
211    #[doc(alias = "kUMPStreamMessageStatusProductInstanceIDNotification")]
212    pub const ProductInstanceIDNotification: Self = Self(0x04);
213    #[doc(alias = "kUMPStreamMessageStatusStreamConfigurationRequest")]
214    pub const StreamConfigurationRequest: Self = Self(0x05);
215    #[doc(alias = "kUMPStreamMessageStatusStreamConfigurationNotification")]
216    pub const StreamConfigurationNotification: Self = Self(0x06);
217    #[doc(alias = "kUMPStreamMessageStatusFunctionBlockDiscovery")]
218    pub const FunctionBlockDiscovery: Self = Self(0x10);
219    #[doc(alias = "kUMPStreamMessageStatusFunctionBlockInfoNotification")]
220    pub const FunctionBlockInfoNotification: Self = Self(0x11);
221    #[doc(alias = "kUMPStreamMessageStatusFunctionBlockNameNotification")]
222    pub const FunctionBlockNameNotification: Self = Self(0x12);
223    #[doc(alias = "kUMPStreamMessageStatusStartOfClip")]
224    pub const StartOfClip: Self = Self(0x20);
225    #[doc(alias = "kUMPStreamMessageStatusEndOfClip")]
226    pub const EndOfClip: Self = Self(0x21);
227}
228
229#[cfg(feature = "objc2")]
230unsafe impl Encode for UMPStreamMessageStatus {
231    const ENCODING: Encoding = c_uint::ENCODING;
232}
233
234#[cfg(feature = "objc2")]
235unsafe impl RefEncode for UMPStreamMessageStatus {
236    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
237}
238
239/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinoteattribute?language=objc)
240// NS_ENUM
241#[repr(transparent)]
242#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
243pub struct MIDINoteAttribute(pub u8);
244impl MIDINoteAttribute {
245    #[doc(alias = "kMIDINoteAttributeNone")]
246    pub const None: Self = Self(0x0);
247    #[doc(alias = "kMIDINoteAttributeManufacturerSpecific")]
248    pub const ManufacturerSpecific: Self = Self(0x1);
249    #[doc(alias = "kMIDINoteAttributeProfileSpecific")]
250    pub const ProfileSpecific: Self = Self(0x2);
251    #[doc(alias = "kMIDINoteAttributePitch")]
252    pub const Pitch: Self = Self(0x3);
253}
254
255#[cfg(feature = "objc2")]
256unsafe impl Encode for MIDINoteAttribute {
257    const ENCODING: Encoding = u8::ENCODING;
258}
259
260#[cfg(feature = "objc2")]
261unsafe impl RefEncode for MIDINoteAttribute {
262    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
263}
264
265/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiprogramchangeoptions?language=objc)
266// NS_OPTIONS
267#[repr(transparent)]
268#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
269pub struct MIDIProgramChangeOptions(pub u8);
270bitflags::bitflags! {
271    impl MIDIProgramChangeOptions: u8 {
272        #[doc(alias = "kMIDIProgramChangeBankValid")]
273        const BankValid = 0x1;
274    }
275}
276
277#[cfg(feature = "objc2")]
278unsafe impl Encode for MIDIProgramChangeOptions {
279    const ENCODING: Encoding = u8::ENCODING;
280}
281
282#[cfg(feature = "objc2")]
283unsafe impl RefEncode for MIDIProgramChangeOptions {
284    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
285}
286
287/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midipernotemanagementoptions?language=objc)
288// NS_OPTIONS
289#[repr(transparent)]
290#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
291pub struct MIDIPerNoteManagementOptions(pub u8);
292bitflags::bitflags! {
293    impl MIDIPerNoteManagementOptions: u8 {
294        #[doc(alias = "kMIDIPerNoteManagementReset")]
295        const Reset = 0x1;
296        #[doc(alias = "kMIDIPerNoteManagementDetach")]
297        const Detach = 0x2;
298    }
299}
300
301#[cfg(feature = "objc2")]
302unsafe impl Encode for MIDIPerNoteManagementOptions {
303    const ENCODING: Encoding = u8::ENCODING;
304}
305
306#[cfg(feature = "objc2")]
307unsafe impl RefEncode for MIDIPerNoteManagementOptions {
308    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
309}
310
311/// MIDI 1.0 speed information for Function Blocks
312///
313/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpfunctionblockmidi1info?language=objc)
314// NS_ENUM
315#[repr(transparent)]
316#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
317pub struct MIDIUMPFunctionBlockMIDI1Info(pub i32);
318impl MIDIUMPFunctionBlockMIDI1Info {
319    #[doc(alias = "kMIDIUMPFunctionBlockMIDI1InfoNotMIDI1")]
320    pub const NotMIDI1: Self = Self(0);
321    #[doc(alias = "kMIDIUMPFunctionBlockMIDI1InfoUnrestrictedBandwidth")]
322    pub const UnrestrictedBandwidth: Self = Self(1);
323    #[doc(alias = "kMIDIUMPFunctionBlockMIDI1InfoRestrictedBandwidth")]
324    pub const RestrictedBandwidth: Self = Self(2);
325}
326
327#[cfg(feature = "objc2")]
328unsafe impl Encode for MIDIUMPFunctionBlockMIDI1Info {
329    const ENCODING: Encoding = i32::ENCODING;
330}
331
332#[cfg(feature = "objc2")]
333unsafe impl RefEncode for MIDIUMPFunctionBlockMIDI1Info {
334    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
335}
336
337/// UI hint types for Function Blocks
338///
339/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpfunctionblockuihint?language=objc)
340// NS_ENUM
341#[repr(transparent)]
342#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
343pub struct MIDIUMPFunctionBlockUIHint(pub i32);
344impl MIDIUMPFunctionBlockUIHint {
345    #[doc(alias = "kMIDIUMPFunctionBlockUIHintUnknown")]
346    pub const Unknown: Self = Self(0);
347    #[doc(alias = "kMIDIUMPFunctionBlockUIHintReceiver")]
348    pub const Receiver: Self = Self(1);
349    #[doc(alias = "kMIDIUMPFunctionBlockUIHintSender")]
350    pub const Sender: Self = Self(2);
351    #[doc(alias = "kMIDIUMPFunctionBlockUIHintSenderReceiver")]
352    pub const SenderReceiver: Self = Self(3);
353}
354
355#[cfg(feature = "objc2")]
356unsafe impl Encode for MIDIUMPFunctionBlockUIHint {
357    const ENCODING: Encoding = i32::ENCODING;
358}
359
360#[cfg(feature = "objc2")]
361unsafe impl RefEncode for MIDIUMPFunctionBlockUIHint {
362    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
363}
364
365/// Function Block direction types
366///
367/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpfunctionblockdirection?language=objc)
368// NS_ENUM
369#[repr(transparent)]
370#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
371pub struct MIDIUMPFunctionBlockDirection(pub i32);
372impl MIDIUMPFunctionBlockDirection {
373    #[doc(alias = "kMIDIUMPFunctionBlockDirectionUnknown")]
374    pub const Unknown: Self = Self(0);
375    #[doc(alias = "kMIDIUMPFunctionBlockDirectionInput")]
376    pub const Input: Self = Self(1);
377    #[doc(alias = "kMIDIUMPFunctionBlockDirectionOutput")]
378    pub const Output: Self = Self(2);
379    #[doc(alias = "kMIDIUMPFunctionBlockDirectionBidirectional")]
380    pub const Bidirectional: Self = Self(3);
381}
382
383#[cfg(feature = "objc2")]
384unsafe impl Encode for MIDIUMPFunctionBlockDirection {
385    const ENCODING: Encoding = i32::ENCODING;
386}
387
388#[cfg(feature = "objc2")]
389unsafe impl RefEncode for MIDIUMPFunctionBlockDirection {
390    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
391}
392
393/// Stream Message Format
394///
395/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/umpstreammessageformat?language=objc)
396// NS_ENUM
397#[repr(transparent)]
398#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
399pub struct UMPStreamMessageFormat(pub u8);
400impl UMPStreamMessageFormat {
401    #[doc(alias = "kUMPStreamMessageFormatComplete")]
402    pub const Complete: Self = Self(0x00);
403    #[doc(alias = "kUMPStreamMessageFormatStart")]
404    pub const Start: Self = Self(0x01);
405    #[doc(alias = "kUMPStreamMessageFormatContinuing")]
406    pub const Continuing: Self = Self(0x02);
407    #[doc(alias = "kUMPStreamMessageFormatEnd")]
408    pub const End: Self = Self(0x03);
409}
410
411#[cfg(feature = "objc2")]
412unsafe impl Encode for UMPStreamMessageFormat {
413    const ENCODING: Encoding = u8::ENCODING;
414}
415
416#[cfg(feature = "objc2")]
417unsafe impl RefEncode for UMPStreamMessageFormat {
418    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
419}
420
421/// MIDI unsigned integer types
422///
423/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiuinteger2?language=objc)
424pub type MIDIUInteger2 = u8;
425
426/// 2  bits usable; allowed values 0x0~0x3
427///
428/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiuinteger4?language=objc)
429pub type MIDIUInteger4 = u8;
430
431/// 4  bits usable; allowed values 0x0~0xF
432///
433/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiuinteger7?language=objc)
434pub type MIDIUInteger7 = u8;
435
436/// 7  bits usable; allowed values 0x0~0x7F
437///
438/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiuinteger14?language=objc)
439pub type MIDIUInteger14 = u16;
440
441/// 14 bits usable; allowed values 0x0~0x3FFF;
442///
443/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiuinteger28?language=objc)
444pub type MIDIUInteger28 = u32;
445
446/// 28 bits usable; allowed values 0x0~0xFFFFFFF;
447///
448/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiuinteger2max?language=objc)
449pub static kMIDIUInteger2Max: MIDIUInteger2 = 0x3;
450
451/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiuinteger4max?language=objc)
452pub static kMIDIUInteger4Max: MIDIUInteger4 = 0xF;
453
454/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiuinteger7max?language=objc)
455pub static kMIDIUInteger7Max: MIDIUInteger7 = 0x7F;
456
457/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiuinteger14max?language=objc)
458pub static kMIDIUInteger14Max: MIDIUInteger14 = 0x3FFF;
459
460/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidiuinteger28max?language=objc)
461pub static kMIDIUInteger28Max: MIDIUInteger28 = 0xFFFFFFF;
462
463/// Type for all UMP Groups
464///
465/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpgroupnumber?language=objc)
466pub type MIDIUMPGroupNumber = MIDIUInteger4;
467
468/// MIDI Channel, 0~15 (channels 1 through 16, respectively).
469/// Per the MIDI-CI specification, this is always a single nibble, 0x0~0xF.
470///
471/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midichannelnumber?language=objc)
472pub type MIDIChannelNumber = MIDIUInteger4;
473
474/// Some MIDI-CI messages use a CI device ID, which is either a UMP group or a reserved 7-bit value
475///
476/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicideviceid?language=objc)
477pub type MIDICIDeviceID = MIDIUInteger7;
478
479/// Device ID value used to specify that a message is to/from a UMP group.
480///
481/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidideviceidumpgroup?language=objc)
482pub static kMIDIDeviceIDUMPGroup: MIDICIDeviceID = 0x7e;
483
484/// Device ID used for to/from Function Block; also used when Function Blocks are not supported.
485///
486/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidideviceidfunctionblock?language=objc)
487pub static kMIDIDeviceIDFunctionBlock: MIDICIDeviceID = 0x7f;
488
489/// The unique MIDI-CI negotiation identifier (MUID) used for a MIDICIResponder connection.
490/// Per the MIDI-CI specification, this is a randomly assigned unsigned 28-bit integer.
491///
492/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicimuid?language=objc)
493pub type MIDICIMUID = MIDIUInteger28;
494
495/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midimessage_32?language=objc)
496pub type MIDIMessage_32 = u32;
497
498/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midimessage_64?language=objc)
499#[repr(C)]
500#[derive(Clone, Copy, Debug, PartialEq)]
501pub struct MIDIMessage_64 {
502    pub word0: u32,
503    pub word1: u32,
504}
505
506#[cfg(feature = "objc2")]
507unsafe impl Encode for MIDIMessage_64 {
508    const ENCODING: Encoding =
509        Encoding::Struct("MIDIMessage_64", &[<u32>::ENCODING, <u32>::ENCODING]);
510}
511
512#[cfg(feature = "objc2")]
513unsafe impl RefEncode for MIDIMessage_64 {
514    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
515}
516
517/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midimessage_96?language=objc)
518#[repr(C)]
519#[derive(Clone, Copy, Debug, PartialEq)]
520pub struct MIDIMessage_96 {
521    pub word0: u32,
522    pub word1: u32,
523    pub word2: u32,
524}
525
526#[cfg(feature = "objc2")]
527unsafe impl Encode for MIDIMessage_96 {
528    const ENCODING: Encoding = Encoding::Struct(
529        "MIDIMessage_96",
530        &[<u32>::ENCODING, <u32>::ENCODING, <u32>::ENCODING],
531    );
532}
533
534#[cfg(feature = "objc2")]
535unsafe impl RefEncode for MIDIMessage_96 {
536    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
537}
538
539/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midimessage_128?language=objc)
540#[repr(C)]
541#[derive(Clone, Copy, Debug, PartialEq)]
542pub struct MIDIMessage_128 {
543    pub word0: u32,
544    pub word1: u32,
545    pub word2: u32,
546    pub word3: u32,
547}
548
549#[cfg(feature = "objc2")]
550unsafe impl Encode for MIDIMessage_128 {
551    const ENCODING: Encoding = Encoding::Struct(
552        "MIDIMessage_128",
553        &[
554            <u32>::ENCODING,
555            <u32>::ENCODING,
556            <u32>::ENCODING,
557            <u32>::ENCODING,
558        ],
559    );
560}
561
562#[cfg(feature = "objc2")]
563unsafe impl RefEncode for MIDIMessage_128 {
564    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
565}
566
567impl MIDIMessageType {
568    // TODO: pub fn MIDIMessageTypeForUPWord(word: u32,) -> MIDIMessageType;
569}
570
571// TODO: pub fn MIDI1UPChannelVoiceMessage(group: u8,status: u8,channel: u8,data1: u8,data2: u8,) -> MIDIMessage_32;
572
573// TODO: pub fn MIDI1UPNoteOff(group: u8,channel: u8,note_number: u8,velocity: u8,) -> MIDIMessage_32;
574
575// TODO: pub fn MIDI1UPNoteOn(group: u8,channel: u8,note_number: u8,velocity: u8,) -> MIDIMessage_32;
576
577// TODO: pub fn MIDI1UPPolyPressure(group: u8,channel: u8,note_number: u8,pressure: u8,) -> MIDIMessage_32;
578
579// TODO: pub fn MIDI1UPControlChange(group: u8,channel: u8,index: u8,data: u8,) -> MIDIMessage_32;
580
581// TODO: pub fn MIDI1UPProgramChange(group: u8,channel: u8,program: u8,) -> MIDIMessage_32;
582
583// TODO: pub fn MIDI1UPChannelPressure(group: u8,channel: u8,value: u8,) -> MIDIMessage_32;
584
585// TODO: pub fn MIDI1UPPitchBend(group: u8,channel: u8,lsb: u8,msb: u8,) -> MIDIMessage_32;
586
587// TODO: pub fn MIDI1UPSystemCommon(group: u8,status: u8,byte1: u8,byte2: u8,) -> MIDIMessage_32;
588
589// TODO: pub fn MIDI1UPSysEx(group: u8,status: u8,bytes_used: u8,byte1: u8,byte2: u8,byte3: u8,byte4: u8,byte5: u8,byte6: u8,) -> MIDIMessage_64;
590
591/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidi1upmaxsysexsize?language=objc)
592pub static kMIDI1UPMaxSysexSize: u8 = 6;
593
594// TODO: pub fn MIDI1UPSysExArray(group: u8,status: u8,begin: *const Byte,end: *const Byte,) -> MIDIMessage_64;
595
596// TODO: pub fn MIDI2ChannelVoiceMessage(group: u8,status: u8,channel: u8,index: u16,value: u32,) -> MIDIMessage_64;
597
598// TODO: pub fn MIDI2NoteOn(group: u8,channel: u8,note_number: u8,attribute_type: u8,attribute_data: u16,velocity: u16,) -> MIDIMessage_64;
599
600// TODO: pub fn MIDI2NoteOff(group: u8,channel: u8,note_number: u8,attribute_type: u8,attribute_data: u16,velocity: u16,) -> MIDIMessage_64;
601
602// TODO: pub fn MIDI2PolyPressure(group: u8,channel: u8,note_number: u8,value: u32,) -> MIDIMessage_64;
603
604// TODO: pub fn MIDI2RegisteredPNC(group: u8,channel: u8,note_number: u8,index: u8,value: u32,) -> MIDIMessage_64;
605
606// TODO: pub fn MIDI2AssignablePNC(group: u8,channel: u8,note_number: u8,index: u8,value: u32,) -> MIDIMessage_64;
607
608// TODO: pub fn MIDI2PerNoteManagment(group: u8,channel: u8,note_number: u8,detach_pn_cs: bool,reset_pn_cs_to_default: bool,) -> MIDIMessage_64;
609
610// TODO: pub fn MIDI2ControlChange(group: u8,channel: u8,index: u8,value: u32,) -> MIDIMessage_64;
611
612// TODO: pub fn MIDI2RegisteredControl(group: u8,channel: u8,bank: u8,index: u8,value: u32,) -> MIDIMessage_64;
613
614// TODO: pub fn MIDI2AssignableControl(group: u8,channel: u8,bank: u8,index: u8,value: u32,) -> MIDIMessage_64;
615
616// TODO: pub fn MIDI2RelRegisteredControl(group: u8,channel: u8,bank: u8,index: u8,value: u32,) -> MIDIMessage_64;
617
618// TODO: pub fn MIDI2RelAssignableControl(group: u8,channel: u8,bank: u8,index: u8,value: u32,) -> MIDIMessage_64;
619
620// TODO: pub fn MIDI2ProgramChange(group: u8,channel: u8,bank_is_valid: bool,program: u8,bank_msb: u8,bank_lsb: u8,) -> MIDIMessage_64;
621
622// TODO: pub fn MIDI2ChannelPressure(group: u8,channel: u8,value: u32,) -> MIDIMessage_64;
623
624// TODO: pub fn MIDI2PitchBend(group: u8,channel: u8,value: u32,) -> MIDIMessage_64;
625
626// TODO: pub fn MIDI2PerNotePitchBend(group: u8,channel: u8,note_number: u8,value: u32,) -> MIDIMessage_64;
627
628// TODO: pub fn MIDI2StreamMessage(format: UMPStreamMessageFormat,status: UMPStreamMessageStatus,data1: u16,data2: u32,data3: u32,data4: u32,) -> MIDIMessage_128;
629
630// TODO: pub fn MIDI2StreamMessageFromData(format: UMPStreamMessageFormat,status: UMPStreamMessageStatus,data: *const Byte,length: usize,) -> MIDIMessage_128;
631
632// TODO: pub fn MIDI2EndpointDiscoveryMessage(version_major: u8,version_minor: u8,endpoint_info_request: bool,device_identity_request: bool,endpoint_name_request: bool,product_instance_id_request: bool,stream_configuration_request: bool,) -> MIDIMessage_128;
633
634// TODO: pub fn MIDI2EndpointInfoNotificationMessage(version_major: u8,version_minor: u8,static_function_blocks: bool,number_of_function_blocks: u8,m1: bool,m2: bool,receive_jr_timestamp: bool,transmit_jr_timestamp: bool,) -> MIDIMessage_128;
635
636// TODO: pub fn MIDI2EndpointDeviceIdentityNotificationMessage(device_manufacturer1: MIDIUInteger7,device_manufacturer2: MIDIUInteger7,device_manufacturer3: MIDIUInteger7,device_family: MIDIUInteger14,device_family_model: MIDIUInteger14,revision_level: MIDIUInteger28,) -> MIDIMessage_128;
637
638// TODO: pub fn MIDI2EndpointNameNotificationMessage(format: UMPStreamMessageFormat,data: *const c_char,length: usize,) -> MIDIMessage_128;
639
640// TODO: pub fn MIDI2EndpointProductInstanceIDNotificationMessage(format: UMPStreamMessageFormat,data: *const c_char,length: usize,) -> MIDIMessage_128;
641
642// TODO: pub fn MIDI2StreamConfigurationRequestMessage(protocol: u8,receive_jr_timestamp: bool,transmit_jr_timestamp: bool,) -> MIDIMessage_128;
643
644// TODO: pub fn MIDI2StreamConfigurationNotificationMessage(protocol: u8,receive_jr_timestamp: bool,transmit_jr_timestamp: bool,) -> MIDIMessage_128;
645
646// TODO: pub fn MIDI2FunctionBlockDiscoveryMessage(function_block_number: u8,info_request: bool,name_request: bool,) -> MIDIMessage_128;
647
648// TODO: pub fn MIDI2FunctionBlockInfoNotificationMessage(active: bool,block_number: MIDIUInteger7,ui_hint: MIDIUMPFunctionBlockUIHint,midi1: MIDIUMPFunctionBlockMIDI1Info,direction: MIDIUMPFunctionBlockDirection,first_group: u8,number_of_groups_spanned: u8,ci_version: u8,max_sysex8_streams: u8,) -> MIDIMessage_128;
649
650// TODO: pub fn MIDI2FunctionBlockNameNotificationMessage(format: UMPStreamMessageFormat,block_number: u8,data: *const c_char,length: usize,) -> MIDIMessage_128;
651
652// TODO: pub fn MIDI2StartOfClipMessage() -> MIDIMessage_128;
653
654// TODO: pub fn MIDI2EndOfClipMessage() -> MIDIMessage_128;
655
656// TODO: pub fn MIDINoOpMessage() -> MIDIMessage_32;
657
658// TODO: pub fn MIDIJitterReductionClockMessage(sender_clock_time: u16,) -> MIDIMessage_32;
659
660// TODO: pub fn MIDIJitterReductionTimestampMessage(sender_clock_timestamp: u16,) -> MIDIMessage_32;
661
662// TODO: pub fn MIDIDeltaClockstampTicksPerQuarterNoteMessage(ticks_per_quarter_note: u16,) -> MIDIMessage_32;
663
664// TODO: pub fn MIDITicksSinceLastEventMessage(ticks_since_last_event: u32,) -> MIDIMessage_32;
665
666// TODO: pub fn MIDI2FlexDataMessage(group: MIDIUInteger4,format: MIDIUInteger2,address: MIDIUInteger2,channel: MIDIUInteger4,status_bank: u8,status: u8,data1: u32,data2: u32,data3: u32,) -> MIDIMessage_128;
667
668/// A representation of all possible messages stored in a Universal MIDI packet.
669///
670/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiuniversalmessage?language=objc)
671#[repr(C)]
672#[derive(Clone, Copy, Debug, PartialEq)]
673pub struct MIDIUniversalMessage {
674    /// determines which variant in the union is active
675    pub r#type: MIDIMessageType,
676    /// 4 bit MIDI group
677    pub group: u8,
678    pub reserved: [u8; 3],
679}
680
681#[cfg(feature = "objc2")]
682unsafe impl Encode for MIDIUniversalMessage {
683    const ENCODING: Encoding = Encoding::Struct(
684        "MIDIUniversalMessage",
685        &[
686            <MIDIMessageType>::ENCODING,
687            <u8>::ENCODING,
688            <[u8; 3]>::ENCODING,
689        ],
690    );
691}
692
693#[cfg(feature = "objc2")]
694unsafe impl RefEncode for MIDIUniversalMessage {
695    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
696}
697
698/// A callback function which receives a single MIDIUniversalMessage.
699///
700/// This callback function is called by MIDIEventListForEachEvent on every UMP
701/// that has been parsed from a MIDIEventList. From the provided `MIDIUniversalMessage`
702/// the MIDI information can be accessed, e.g.:
703///
704/// - Parameters:
705/// - context: A context provided by the client via call to MIDIEventListForEachEvent.
706/// - timeStamp: The timestamp of the current UMP.
707/// - message: A filled MIDIUniversalMessage struct that has been parsed from a single UMP.
708///
709/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midieventvisitor?language=objc)
710#[cfg(feature = "MIDIServices")]
711pub type MIDIEventVisitor =
712    Option<unsafe extern "C-unwind" fn(*mut c_void, MIDITimeStamp, MIDIUniversalMessage)>;
713
714#[cfg(feature = "MIDIServices")]
715impl MIDIEventList {
716    /// Parses UMPs from a MIDIEventList.
717    ///
718    /// MIDIEventListForEachEvent iterates over all UMPs in the provided MIDIEventList.
719    /// It parses each UMP and fills a MIDIUniversalMessage struct. It calls the provided
720    /// visitor on each of these UMPs. In case of an unknown UMP the raw UMP words will be provided.
721    ///
722    ///
723    /// Parameter `evtlist`: The MIDIEventList which is to be parsed.
724    ///
725    ///
726    /// Parameter `visitor`: The visitor that is called on each UMP in evtlist.
727    ///
728    ///
729    /// Parameter `visitorContext`: A context for the visitor that is passed to it when being called.
730    ///
731    /// # Safety
732    ///
733    /// - `evtlist` must be a valid pointer.
734    /// - `visitor` must be implemented correctly.
735    /// - `visitor_context` must be a valid pointer.
736    #[doc(alias = "MIDIEventListForEachEvent")]
737    #[cfg(feature = "MIDIServices")]
738    #[inline]
739    pub unsafe fn for_each_event(
740        evtlist: *const MIDIEventList,
741        visitor: MIDIEventVisitor,
742        visitor_context: *mut c_void,
743    ) {
744        extern "C-unwind" {
745            fn MIDIEventListForEachEvent(
746                evtlist: *const MIDIEventList,
747                visitor: MIDIEventVisitor,
748                visitor_context: *mut c_void,
749            );
750        }
751        unsafe { MIDIEventListForEachEvent(evtlist, visitor, visitor_context) }
752    }
753}
754
755extern "C-unwind" {
756    #[cfg(feature = "MIDIServices")]
757    #[deprecated = "renamed to `MIDIEventList::for_each_event`"]
758    pub fn MIDIEventListForEachEvent(
759        evtlist: *const MIDIEventList,
760        visitor: MIDIEventVisitor,
761        visitor_context: *mut c_void,
762    );
763}