objc2-core-midi 0.3.2

Bindings to the CoreMIDI framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midi2devicemanufacturer?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MIDI2DeviceManufacturer {
    pub sysExIDByte: [Byte; 3],
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MIDI2DeviceManufacturer {
    const ENCODING: Encoding = Encoding::Struct("?", &[<[Byte; 3]>::ENCODING]);
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MIDI2DeviceManufacturer {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midi2devicerevisionlevel?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MIDI2DeviceRevisionLevel {
    pub revisionLevel: [Byte; 4],
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MIDI2DeviceRevisionLevel {
    const ENCODING: Encoding = Encoding::Struct("?", &[<[Byte; 4]>::ENCODING]);
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MIDI2DeviceRevisionLevel {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MIDI Capability category supported (bitmap: D6 D5 D4 D3 D2 D1 D0)
/// Bit    Category    Sub-ID Range    Description
/// D0            0x00~0x0F    Reserved - No Messages Defined Yet
/// D1            0x10~0x1F    Protocol Negotiation (Deprecated)
/// D2            0x20~0x2F    Profile Configuration Supported
/// D3            0x30~0x3F    Property Exchange Supported
/// D4            0x40~0x4F    Process Inquiry Supported
/// D5            0x50~0x5F    Reserved - No Messages Defined Yet
/// D6            0x60~0x6F    Reserved - No Messages Defined Yet
///
/// e.g., a MIDICIDevice supporting Profile Configuration and Property Exchange has
/// category 0xC.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicicategoryoptions?language=objc)
// NS_OPTIONS
#[cfg(feature = "MIDIMessages")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MIDICICategoryOptions(pub MIDIUInteger7);
#[cfg(feature = "MIDIMessages")]
bitflags::bitflags! {
    impl MIDICICategoryOptions: MIDIUInteger7 {
        #[doc(alias = "kMIDICICategoryOptionsProtocolNegotiation")]
        const ProtocolNegotiation = 1<<1;
        #[doc(alias = "kMIDICICategoryOptionsProfileConfigurationSupported")]
        const ProfileConfigurationSupported = 1<<2;
        #[doc(alias = "kMIDICICategoryOptionsPropertyExchangeSupported")]
        const PropertyExchangeSupported = 1<<3;
        #[doc(alias = "kMIDICICategoryOptionsProcessInquirySupported")]
        const ProcessInquirySupported = 1<<4;
    }
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl Encode for MIDICICategoryOptions {
    const ENCODING: Encoding = MIDIUInteger7::ENCODING;
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl RefEncode for MIDICICategoryOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// The device-unique Function Block ID.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpfunctionblockid?language=objc)
#[cfg(feature = "MIDIMessages")]
pub type MIDIUMPFunctionBlockID = MIDIUInteger7;

/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicidevicetype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MIDICIDeviceType(pub u8);
impl MIDICIDeviceType {
    #[doc(alias = "kMIDICIDeviceTypeUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "kMIDICIDeviceTypeLegacyMIDI1")]
    pub const LegacyMIDI1: Self = Self(1);
    #[doc(alias = "kMIDICIDeviceTypeVirtual")]
    pub const Virtual: Self = Self(2);
    #[doc(alias = "kMIDICIDeviceTypeUSBMIDI")]
    pub const USBMIDI: Self = Self(3);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MIDICIDeviceType {
    const ENCODING: Encoding = u8::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MIDICIDeviceType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MIDI-CI Profile message sub-ID values.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprofilemessagetype?language=objc)
// NS_ENUM
#[cfg(feature = "MIDIMessages")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MIDICIProfileMessageType(pub MIDIUInteger7);
#[cfg(feature = "MIDIMessages")]
impl MIDICIProfileMessageType {
    #[doc(alias = "kMIDICIProfileMessageTypeProfileInquiry")]
    pub const ProfileInquiry: Self = Self(0x20);
    #[doc(alias = "kMIDICIProfileMessageTypeReplyToProfileInquiry")]
    pub const ReplyToProfileInquiry: Self = Self(0x21);
    #[doc(alias = "kMIDICIProfileMessageTypeSetProfileOn")]
    pub const SetProfileOn: Self = Self(0x22);
    #[doc(alias = "kMIDICIProfileMessageTypeSetProfileOff")]
    pub const SetProfileOff: Self = Self(0x23);
    #[doc(alias = "kMIDICIProfileMessageTypeProfileEnabledReport")]
    pub const ProfileEnabledReport: Self = Self(0x24);
    #[doc(alias = "kMIDICIProfileMessageTypeProfileDisabledReport")]
    pub const ProfileDisabledReport: Self = Self(0x25);
    #[doc(alias = "kMIDICIProfileMessageTypeProfileAdded")]
    pub const ProfileAdded: Self = Self(0x26);
    #[doc(alias = "kMIDICIProfileMessageTypeProfileRemoved")]
    pub const ProfileRemoved: Self = Self(0x27);
    #[doc(alias = "kMIDICIProfileMessageTypeDetailsInquiry")]
    pub const DetailsInquiry: Self = Self(0x28);
    #[doc(alias = "kMIDICIProfileMessageTypeReplyToDetailsInquiry")]
    pub const ReplyToDetailsInquiry: Self = Self(0x29);
    #[doc(alias = "kMIDICIProfileMessageTypeProfileSpecificData")]
    pub const ProfileSpecificData: Self = Self(0x2F);
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl Encode for MIDICIProfileMessageType {
    const ENCODING: Encoding = MIDIUInteger7::ENCODING;
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl RefEncode for MIDICIProfileMessageType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MIDI-CI Property Exchange Message sub-ID values.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicipropertyexchangemessagetype?language=objc)
// NS_ENUM
#[cfg(feature = "MIDIMessages")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MIDICIPropertyExchangeMessageType(pub MIDIUInteger7);
#[cfg(feature = "MIDIMessages")]
impl MIDICIPropertyExchangeMessageType {
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeInquiryPropertyExchangeCapabilities")]
    pub const InquiryPropertyExchangeCapabilities: Self = Self(0x30);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeReplyToPropertyExchangeCapabilities")]
    pub const ReplyToPropertyExchangeCapabilities: Self = Self(0x31);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeInquiryHasPropertyData_Reserved")]
    pub const InquiryHasPropertyData_Reserved: Self = Self(0x32);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeInquiryReplyToHasPropertyData_Reserved")]
    pub const InquiryReplyToHasPropertyData_Reserved: Self = Self(0x33);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeInquiryGetPropertyData")]
    pub const InquiryGetPropertyData: Self = Self(0x34);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeReplyToGetProperty")]
    pub const ReplyToGetProperty: Self = Self(0x35);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeInquirySetPropertyData")]
    pub const InquirySetPropertyData: Self = Self(0x36);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeReplyToSetPropertyData")]
    pub const ReplyToSetPropertyData: Self = Self(0x37);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeSubscription")]
    pub const Subscription: Self = Self(0x38);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeReplyToSubscription")]
    pub const ReplyToSubscription: Self = Self(0x39);
    #[doc(alias = "kMIDICIPropertyExchangeMessageTypeNotify")]
    pub const Notify: Self = Self(0x3F);
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl Encode for MIDICIPropertyExchangeMessageType {
    const ENCODING: Encoding = MIDIUInteger7::ENCODING;
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl RefEncode for MIDICIPropertyExchangeMessageType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MIDI-CI Process Inquiry sub-ID values.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprocessinquirymessagetype?language=objc)
// NS_ENUM
#[cfg(feature = "MIDIMessages")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MIDICIProcessInquiryMessageType(pub MIDIUInteger7);
#[cfg(feature = "MIDIMessages")]
impl MIDICIProcessInquiryMessageType {
    #[doc(alias = "kMIDICIProcessInquiryMessageTypeInquiryProcessInquiryCapabilities")]
    pub const InquiryProcessInquiryCapabilities: Self = Self(0x40);
    #[doc(alias = "kMIDICIProcessInquiryMessageTypeReplyToProcessInquiryCapabilities")]
    pub const ReplyToProcessInquiryCapabilities: Self = Self(0x41);
    #[doc(alias = "kMIDICIProcessInquiryMessageTypeInquiryMIDIMessageReport")]
    pub const InquiryMIDIMessageReport: Self = Self(0x42);
    #[doc(alias = "kMIDICIProcessInquiryMessageTypeReplyToMIDIMessageReport")]
    pub const ReplyToMIDIMessageReport: Self = Self(0x43);
    #[doc(alias = "kMIDICIProcessInquiryMessageTypeEndOfMIDIMessageReport")]
    pub const EndOfMIDIMessageReport: Self = Self(0x44);
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl Encode for MIDICIProcessInquiryMessageType {
    const ENCODING: Encoding = MIDIUInteger7::ENCODING;
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl RefEncode for MIDICIProcessInquiryMessageType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MIDI-CI Management sub-ID values.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicimanagementmessagetype?language=objc)
// NS_ENUM
#[cfg(feature = "MIDIMessages")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MIDICIManagementMessageType(pub MIDIUInteger7);
#[cfg(feature = "MIDIMessages")]
impl MIDICIManagementMessageType {
    #[doc(alias = "kMIDICIManagementMessageTypeDiscovery")]
    pub const Discovery: Self = Self(0x70);
    #[doc(alias = "kMIDICIManagementMessageTypeReplyToDiscovery")]
    pub const ReplyToDiscovery: Self = Self(0x71);
    #[doc(alias = "kMIDICIManagementMessageTypeInquiryEndpointInformation")]
    pub const InquiryEndpointInformation: Self = Self(0x72);
    #[doc(alias = "kMIDICIManagementMessageTypeReplyToEndpointInformation")]
    pub const ReplyToEndpointInformation: Self = Self(0x73);
    #[doc(alias = "kMIDICIManagementMessageTypeMIDICIACK")]
    pub const MIDICIACK: Self = Self(0x7D);
    #[doc(alias = "kMIDICIManagementMessageTypeInvalidateMUID")]
    pub const InvalidateMUID: Self = Self(0x7E);
    #[doc(alias = "kMIDICIManagementMessageTypeMIDICINAK")]
    pub const MIDICINAK: Self = Self(0x7F);
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl Encode for MIDICIManagementMessageType {
    const ENCODING: Encoding = MIDIUInteger7::ENCODING;
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl RefEncode for MIDICIManagementMessageType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MIDI-CI Profile variants.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprofiletype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MIDICIProfileType(pub u8);
impl MIDICIProfileType {
    #[doc(alias = "kMIDICIProfileTypeSingleChannel")]
    pub const SingleChannel: Self = Self(1);
    #[doc(alias = "kMIDICIProfileTypeGroup")]
    pub const Group: Self = Self(2);
    #[doc(alias = "kMIDICIProfileTypeFunctionBlock")]
    pub const FunctionBlock: Self = Self(3);
    #[doc(alias = "kMIDICIProfileTypeMultichannel")]
    pub const Multichannel: Self = Self(4);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MIDICIProfileType {
    const ENCODING: Encoding = u8::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MIDICIProfileType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// The underlying transport / backing device type variants.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpciobjectbackingtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MIDIUMPCIObjectBackingType(pub u8);
impl MIDIUMPCIObjectBackingType {
    #[doc(alias = "kMIDIUMPCIObjectBackingTypeUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "kMIDIUMPCIObjectBackingTypeVirtual")]
    pub const Virtual: Self = Self(1);
    #[doc(alias = "kMIDIUMPCIObjectBackingTypeDriverDevice")]
    pub const DriverDevice: Self = Self(2);
    #[doc(alias = "kMIDIUMPCIObjectBackingTypeUSBMIDI")]
    pub const USBMIDI: Self = Self(3);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MIDIUMPCIObjectBackingType {
    const ENCODING: Encoding = u8::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MIDIUMPCIObjectBackingType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// A C-style struct containing a standard profile ID.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprofileidstandard?language=objc)
#[cfg(feature = "MIDIMessages")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MIDICIProfileIDStandard {
    pub profileIDByte1: MIDIUInteger7,
    pub profileBank: MIDIUInteger7,
    pub profileNumber: MIDIUInteger7,
    pub profileVersion: MIDIUInteger7,
    pub profileLevel: MIDIUInteger7,
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl Encode for MIDICIProfileIDStandard {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <MIDIUInteger7>::ENCODING,
            <MIDIUInteger7>::ENCODING,
            <MIDIUInteger7>::ENCODING,
            <MIDIUInteger7>::ENCODING,
            <MIDIUInteger7>::ENCODING,
        ],
    );
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl RefEncode for MIDICIProfileIDStandard {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// A C-style struct containing a Manufacturer Specific profile ID.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprofileidmanufacturerspecific?language=objc)
#[cfg(feature = "MIDIMessages")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MIDICIProfileIDManufacturerSpecific {
    pub sysExID1: MIDIUInteger7,
    pub sysExID2: MIDIUInteger7,
    pub sysExID3: MIDIUInteger7,
    pub info1: MIDIUInteger7,
    pub info2: MIDIUInteger7,
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl Encode for MIDICIProfileIDManufacturerSpecific {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <MIDIUInteger7>::ENCODING,
            <MIDIUInteger7>::ENCODING,
            <MIDIUInteger7>::ENCODING,
            <MIDIUInteger7>::ENCODING,
            <MIDIUInteger7>::ENCODING,
        ],
    );
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl RefEncode for MIDICIProfileIDManufacturerSpecific {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// A C-style struct containing the profile ID.
///
///
/// There are two general types of Profiles -- standard defined Profiles and
/// manufacturer-specific Profiles.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprofileid?language=objc)
#[cfg(feature = "MIDIMessages")]
#[repr(C)]
#[derive(Clone, Copy)]
pub union MIDICIProfileID {
    pub standard: MIDICIProfileIDStandard,
    pub manufacturerSpecific: MIDICIProfileIDManufacturerSpecific,
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl Encode for MIDICIProfileID {
    const ENCODING: Encoding = Encoding::Union(
        "?",
        &[
            <MIDICIProfileIDStandard>::ENCODING,
            <MIDICIProfileIDManufacturerSpecific>::ENCODING,
        ],
    );
}

#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
unsafe impl RefEncode for MIDICIProfileID {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// The request ID associated with a Property Exchange request.
///
///
/// As the respose context of a Property Exchange message is assumed to be known
/// by the initiator, the requestID of each request is included with the response such
/// that it can be correlated with the initial request.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicipropertyexchangerequestid?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type MIDICIPropertyExchangeRequestID = u8;

/// Returned when MIDI-CI Property Messages were not dispatched due to an error.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/kmidicipropertyexchangebadrequestid?language=objc)
pub static kMIDICIPropertyExchangeBadRequestID: MIDICIPropertyExchangeRequestID = 0xFF;