objc2_avf_audio/generated/
AVMusicEvents.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// The base class for all events associated with an AVMusicTrack.
12    ///
13    /// This class is provided to allow enumeration of the heterogenous events contained within an AVMusicTrack.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmusicevent?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct AVMusicEvent;
19);
20
21unsafe impl NSObjectProtocol for AVMusicEvent {}
22
23impl AVMusicEvent {
24    extern_methods!();
25}
26
27/// Methods declared on superclass `NSObject`.
28impl AVMusicEvent {
29    extern_methods!(
30        #[unsafe(method(init))]
31        #[unsafe(method_family = init)]
32        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
33
34        #[unsafe(method(new))]
35        #[unsafe(method_family = new)]
36        pub unsafe fn new() -> Retained<Self>;
37    );
38}
39
40extern_class!(
41    /// The event class representing MIDI note-on/off messages.
42    ///
43    /// Parameter `channel`: The MIDI channel for the note.  Range: 0-15.
44    ///
45    /// Parameter `key`: The MIDI key number for the note.  Range: 0-127.
46    ///
47    /// Parameter `velocity`: The MIDI velocity for the note.  Range: 0-127 (see discussion).
48    ///
49    /// Parameter `duration`: The duration of this note event in AVMusicTimeStamp beats.  Range: Any non-negative number.
50    ///
51    /// The AVAudioSequencer will automatically send a MIDI note-off after the note duration has passed.
52    /// To send an explicit note-off event, create an AVMIDINoteEvent with its velocity set to zero.
53    ///
54    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidinoteevent?language=objc)
55    #[unsafe(super(AVMusicEvent, NSObject))]
56    #[derive(Debug, PartialEq, Eq, Hash)]
57    pub struct AVMIDINoteEvent;
58);
59
60unsafe impl NSObjectProtocol for AVMIDINoteEvent {}
61
62impl AVMIDINoteEvent {
63    extern_methods!(
64        #[cfg(feature = "AVAudioTypes")]
65        /// Initialize the event with a MIDI channel, key number, velocity and duration.
66        ///
67        /// Parameter `channel`: The MIDI channel.  Range: 0-15.
68        ///
69        /// Parameter `key`: The MIDI key number.  Range: 0-127.
70        ///
71        /// Parameter `velocity`: The MIDI velocity.  Range: 0-127 with zero indicating a note-off event.
72        ///
73        /// Parameter `duration`: The duration in beats for this note.  Range: Any non-negative number.
74        #[unsafe(method(initWithChannel:key:velocity:duration:))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn initWithChannel_key_velocity_duration(
77            this: Allocated<Self>,
78            channel: u32,
79            key_num: u32,
80            velocity: u32,
81            duration: AVMusicTimeStamp,
82        ) -> Retained<Self>;
83
84        /// The MIDI channel for the event.  Range: 0-15.
85        #[unsafe(method(channel))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn channel(&self) -> u32;
88
89        /// Setter for [`channel`][Self::channel].
90        #[unsafe(method(setChannel:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setChannel(&self, channel: u32);
93
94        /// The MIDI key number for the event.  Range: 0-127.
95        #[unsafe(method(key))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn key(&self) -> u32;
98
99        /// Setter for [`key`][Self::key].
100        #[unsafe(method(setKey:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setKey(&self, key: u32);
103
104        /// The MIDI velocity for the event.  Range: 0-127.
105        #[unsafe(method(velocity))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn velocity(&self) -> u32;
108
109        /// Setter for [`velocity`][Self::velocity].
110        #[unsafe(method(setVelocity:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setVelocity(&self, velocity: u32);
113
114        #[cfg(feature = "AVAudioTypes")]
115        /// The duration of the event in AVMusicTimeStamp beats.  Range: Any non-negative number.
116        #[unsafe(method(duration))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn duration(&self) -> AVMusicTimeStamp;
119
120        #[cfg(feature = "AVAudioTypes")]
121        /// Setter for [`duration`][Self::duration].
122        #[unsafe(method(setDuration:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setDuration(&self, duration: AVMusicTimeStamp);
125    );
126}
127
128/// Methods declared on superclass `NSObject`.
129impl AVMIDINoteEvent {
130    extern_methods!(
131        #[unsafe(method(init))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
134
135        #[unsafe(method(new))]
136        #[unsafe(method_family = new)]
137        pub unsafe fn new() -> Retained<Self>;
138    );
139}
140
141extern_class!(
142    /// The event base class for all MIDI messages which operate on a single MIDI channel.
143    ///
144    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidichannelevent?language=objc)
145    #[unsafe(super(AVMusicEvent, NSObject))]
146    #[derive(Debug, PartialEq, Eq, Hash)]
147    pub struct AVMIDIChannelEvent;
148);
149
150unsafe impl NSObjectProtocol for AVMIDIChannelEvent {}
151
152impl AVMIDIChannelEvent {
153    extern_methods!(
154        /// The MIDI channel for the event.  Range: 0-15.
155        #[unsafe(method(channel))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn channel(&self) -> u32;
158
159        /// Setter for [`channel`][Self::channel].
160        #[unsafe(method(setChannel:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn setChannel(&self, channel: u32);
163    );
164}
165
166/// Methods declared on superclass `NSObject`.
167impl AVMIDIChannelEvent {
168    extern_methods!(
169        #[unsafe(method(init))]
170        #[unsafe(method_family = init)]
171        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
172
173        #[unsafe(method(new))]
174        #[unsafe(method_family = new)]
175        pub unsafe fn new() -> Retained<Self>;
176    );
177}
178
179/// Types of MIDI control change events.  See the General MIDI Specification for details.
180///
181/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidicontrolchangemessagetype?language=objc)
182// NS_ENUM
183#[repr(transparent)]
184#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
185pub struct AVMIDIControlChangeMessageType(pub NSInteger);
186impl AVMIDIControlChangeMessageType {
187    #[doc(alias = "AVMIDIControlChangeMessageTypeBankSelect")]
188    pub const BankSelect: Self = Self(0);
189    #[doc(alias = "AVMIDIControlChangeMessageTypeModWheel")]
190    pub const ModWheel: Self = Self(1);
191    #[doc(alias = "AVMIDIControlChangeMessageTypeBreath")]
192    pub const Breath: Self = Self(2);
193    #[doc(alias = "AVMIDIControlChangeMessageTypeFoot")]
194    pub const Foot: Self = Self(4);
195    #[doc(alias = "AVMIDIControlChangeMessageTypePortamentoTime")]
196    pub const PortamentoTime: Self = Self(5);
197    #[doc(alias = "AVMIDIControlChangeMessageTypeDataEntry")]
198    pub const DataEntry: Self = Self(6);
199    #[doc(alias = "AVMIDIControlChangeMessageTypeVolume")]
200    pub const Volume: Self = Self(7);
201    #[doc(alias = "AVMIDIControlChangeMessageTypeBalance")]
202    pub const Balance: Self = Self(8);
203    #[doc(alias = "AVMIDIControlChangeMessageTypePan")]
204    pub const Pan: Self = Self(10);
205    #[doc(alias = "AVMIDIControlChangeMessageTypeExpression")]
206    pub const Expression: Self = Self(11);
207    #[doc(alias = "AVMIDIControlChangeMessageTypeSustain")]
208    pub const Sustain: Self = Self(64);
209    #[doc(alias = "AVMIDIControlChangeMessageTypePortamento")]
210    pub const Portamento: Self = Self(65);
211    #[doc(alias = "AVMIDIControlChangeMessageTypeSostenuto")]
212    pub const Sostenuto: Self = Self(66);
213    #[doc(alias = "AVMIDIControlChangeMessageTypeSoft")]
214    pub const Soft: Self = Self(67);
215    #[doc(alias = "AVMIDIControlChangeMessageTypeLegatoPedal")]
216    pub const LegatoPedal: Self = Self(68);
217    #[doc(alias = "AVMIDIControlChangeMessageTypeHold2Pedal")]
218    pub const Hold2Pedal: Self = Self(69);
219    #[doc(alias = "AVMIDIControlChangeMessageTypeFilterResonance")]
220    pub const FilterResonance: Self = Self(71);
221    #[doc(alias = "AVMIDIControlChangeMessageTypeReleaseTime")]
222    pub const ReleaseTime: Self = Self(72);
223    #[doc(alias = "AVMIDIControlChangeMessageTypeAttackTime")]
224    pub const AttackTime: Self = Self(73);
225    #[doc(alias = "AVMIDIControlChangeMessageTypeBrightness")]
226    pub const Brightness: Self = Self(74);
227    #[doc(alias = "AVMIDIControlChangeMessageTypeDecayTime")]
228    pub const DecayTime: Self = Self(75);
229    #[doc(alias = "AVMIDIControlChangeMessageTypeVibratoRate")]
230    pub const VibratoRate: Self = Self(76);
231    #[doc(alias = "AVMIDIControlChangeMessageTypeVibratoDepth")]
232    pub const VibratoDepth: Self = Self(77);
233    #[doc(alias = "AVMIDIControlChangeMessageTypeVibratoDelay")]
234    pub const VibratoDelay: Self = Self(78);
235    #[doc(alias = "AVMIDIControlChangeMessageTypeReverbLevel")]
236    pub const ReverbLevel: Self = Self(91);
237    #[doc(alias = "AVMIDIControlChangeMessageTypeChorusLevel")]
238    pub const ChorusLevel: Self = Self(93);
239    #[doc(alias = "AVMIDIControlChangeMessageTypeRPN_LSB")]
240    pub const RPN_LSB: Self = Self(100);
241    #[doc(alias = "AVMIDIControlChangeMessageTypeRPN_MSB")]
242    pub const RPN_MSB: Self = Self(101);
243    #[doc(alias = "AVMIDIControlChangeMessageTypeAllSoundOff")]
244    pub const AllSoundOff: Self = Self(120);
245    #[doc(alias = "AVMIDIControlChangeMessageTypeResetAllControllers")]
246    pub const ResetAllControllers: Self = Self(121);
247    #[doc(alias = "AVMIDIControlChangeMessageTypeAllNotesOff")]
248    pub const AllNotesOff: Self = Self(123);
249    #[doc(alias = "AVMIDIControlChangeMessageTypeOmniModeOff")]
250    pub const OmniModeOff: Self = Self(124);
251    #[doc(alias = "AVMIDIControlChangeMessageTypeOmniModeOn")]
252    pub const OmniModeOn: Self = Self(125);
253    #[doc(alias = "AVMIDIControlChangeMessageTypeMonoModeOn")]
254    pub const MonoModeOn: Self = Self(126);
255    #[doc(alias = "AVMIDIControlChangeMessageTypeMonoModeOff")]
256    pub const MonoModeOff: Self = Self(127);
257}
258
259unsafe impl Encode for AVMIDIControlChangeMessageType {
260    const ENCODING: Encoding = NSInteger::ENCODING;
261}
262
263unsafe impl RefEncode for AVMIDIControlChangeMessageType {
264    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
265}
266
267extern_class!(
268    /// The event class representing MIDI control change messages.
269    ///
270    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidicontrolchangeevent?language=objc)
271    #[unsafe(super(AVMIDIChannelEvent, AVMusicEvent, NSObject))]
272    #[derive(Debug, PartialEq, Eq, Hash)]
273    pub struct AVMIDIControlChangeEvent;
274);
275
276unsafe impl NSObjectProtocol for AVMIDIControlChangeEvent {}
277
278impl AVMIDIControlChangeEvent {
279    extern_methods!(
280        /// Initialize the event with a channel, a control change type, and a control value.
281        ///
282        /// Parameter `channel`: The MIDI channel for the control change.  Range: 0-15.
283        ///
284        /// Parameter `messageType`: The AVMIDIControlChangeMessageType indicating which MIDI control change message to send.
285        ///
286        /// Parameter `value`: The value for this control change.  Range: Depends on the type (see the General MIDI specification).
287        #[unsafe(method(initWithChannel:messageType:value:))]
288        #[unsafe(method_family = init)]
289        pub unsafe fn initWithChannel_messageType_value(
290            this: Allocated<Self>,
291            channel: u32,
292            message_type: AVMIDIControlChangeMessageType,
293            value: u32,
294        ) -> Retained<Self>;
295
296        /// The type of control change message, specified as an AVMIDIControlChangeMessageType.
297        #[unsafe(method(messageType))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn messageType(&self) -> AVMIDIControlChangeMessageType;
300
301        /// The value of the control change event.  The range of this value depends on the type (see the General MIDI specification).
302        #[unsafe(method(value))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn value(&self) -> u32;
305    );
306}
307
308/// Methods declared on superclass `NSObject`.
309impl AVMIDIControlChangeEvent {
310    extern_methods!(
311        #[unsafe(method(init))]
312        #[unsafe(method_family = init)]
313        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
314
315        #[unsafe(method(new))]
316        #[unsafe(method_family = new)]
317        pub unsafe fn new() -> Retained<Self>;
318    );
319}
320
321extern_class!(
322    /// The event class representing MIDI "poly" or "key" pressure messages.
323    ///
324    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidipolypressureevent?language=objc)
325    #[unsafe(super(AVMIDIChannelEvent, AVMusicEvent, NSObject))]
326    #[derive(Debug, PartialEq, Eq, Hash)]
327    pub struct AVMIDIPolyPressureEvent;
328);
329
330unsafe impl NSObjectProtocol for AVMIDIPolyPressureEvent {}
331
332impl AVMIDIPolyPressureEvent {
333    extern_methods!(
334        /// Initialize the event with a channel, a MIDI key number, and a key pressure value.
335        ///
336        /// Parameter `channel`: The MIDI channel for the message.  Range: 0-15.
337        ///
338        /// Parameter `key`: The MIDI key number to which the pressure should be applied.
339        ///
340        /// Parameter `pressure`: The poly pressure value.
341        #[unsafe(method(initWithChannel:key:pressure:))]
342        #[unsafe(method_family = init)]
343        pub unsafe fn initWithChannel_key_pressure(
344            this: Allocated<Self>,
345            channel: u32,
346            key: u32,
347            pressure: u32,
348        ) -> Retained<Self>;
349
350        /// The MIDI key number.
351        #[unsafe(method(key))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn key(&self) -> u32;
354
355        /// Setter for [`key`][Self::key].
356        #[unsafe(method(setKey:))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn setKey(&self, key: u32);
359
360        /// The poly pressure value for the requested key.
361        #[unsafe(method(pressure))]
362        #[unsafe(method_family = none)]
363        pub unsafe fn pressure(&self) -> u32;
364
365        /// Setter for [`pressure`][Self::pressure].
366        #[unsafe(method(setPressure:))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn setPressure(&self, pressure: u32);
369    );
370}
371
372/// Methods declared on superclass `NSObject`.
373impl AVMIDIPolyPressureEvent {
374    extern_methods!(
375        #[unsafe(method(init))]
376        #[unsafe(method_family = init)]
377        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
378
379        #[unsafe(method(new))]
380        #[unsafe(method_family = new)]
381        pub unsafe fn new() -> Retained<Self>;
382    );
383}
384
385extern_class!(
386    /// The event class representing MIDI program or patch change messages.
387    ///
388    /// The effect of these messages will depend on the containing AVMusicTrack's destinationAudioUnit.
389    ///
390    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidiprogramchangeevent?language=objc)
391    #[unsafe(super(AVMIDIChannelEvent, AVMusicEvent, NSObject))]
392    #[derive(Debug, PartialEq, Eq, Hash)]
393    pub struct AVMIDIProgramChangeEvent;
394);
395
396unsafe impl NSObjectProtocol for AVMIDIProgramChangeEvent {}
397
398impl AVMIDIProgramChangeEvent {
399    extern_methods!(
400        /// Initialize the event with a channel and a program number.
401        ///
402        /// Parameter `channel`: The MIDI channel for the message.  Range: 0-15.
403        ///
404        /// Parameter `programNumber`: The program number to be sent.  Range: 0-127.
405        ///
406        /// Per the General MIDI specification, the actual instrument that is chosen will depend on optional
407        /// AVMIDIControlChangeMessageTypeBankSelect events sent prior to this program change.
408        #[unsafe(method(initWithChannel:programNumber:))]
409        #[unsafe(method_family = init)]
410        pub unsafe fn initWithChannel_programNumber(
411            this: Allocated<Self>,
412            channel: u32,
413            program_number: u32,
414        ) -> Retained<Self>;
415
416        /// The MIDI program number.  Range: 0-127.
417        #[unsafe(method(programNumber))]
418        #[unsafe(method_family = none)]
419        pub unsafe fn programNumber(&self) -> u32;
420
421        /// Setter for [`programNumber`][Self::programNumber].
422        #[unsafe(method(setProgramNumber:))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn setProgramNumber(&self, program_number: u32);
425    );
426}
427
428/// Methods declared on superclass `NSObject`.
429impl AVMIDIProgramChangeEvent {
430    extern_methods!(
431        #[unsafe(method(init))]
432        #[unsafe(method_family = init)]
433        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
434
435        #[unsafe(method(new))]
436        #[unsafe(method_family = new)]
437        pub unsafe fn new() -> Retained<Self>;
438    );
439}
440
441extern_class!(
442    /// The event class representing MIDI channel pressure messages.
443    ///
444    /// The effect of these messages will depend on the containing AVMusicTrack's destinationAudioUnit
445    /// and the capabilities of the destination's currently-loaded instrument.
446    ///
447    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidichannelpressureevent?language=objc)
448    #[unsafe(super(AVMIDIChannelEvent, AVMusicEvent, NSObject))]
449    #[derive(Debug, PartialEq, Eq, Hash)]
450    pub struct AVMIDIChannelPressureEvent;
451);
452
453unsafe impl NSObjectProtocol for AVMIDIChannelPressureEvent {}
454
455impl AVMIDIChannelPressureEvent {
456    extern_methods!(
457        /// Initialize the event with a channel and a pressure value.
458        ///
459        /// Parameter `channel`: The MIDI channel for the message.  Range: 0-15.
460        ///
461        /// Parameter `pressure`: The MIDI channel pressure.  Range: 0-127.
462        #[unsafe(method(initWithChannel:pressure:))]
463        #[unsafe(method_family = init)]
464        pub unsafe fn initWithChannel_pressure(
465            this: Allocated<Self>,
466            channel: u32,
467            pressure: u32,
468        ) -> Retained<Self>;
469
470        /// The MIDI channel pressure.
471        #[unsafe(method(pressure))]
472        #[unsafe(method_family = none)]
473        pub unsafe fn pressure(&self) -> u32;
474
475        /// Setter for [`pressure`][Self::pressure].
476        #[unsafe(method(setPressure:))]
477        #[unsafe(method_family = none)]
478        pub unsafe fn setPressure(&self, pressure: u32);
479    );
480}
481
482/// Methods declared on superclass `NSObject`.
483impl AVMIDIChannelPressureEvent {
484    extern_methods!(
485        #[unsafe(method(init))]
486        #[unsafe(method_family = init)]
487        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
488
489        #[unsafe(method(new))]
490        #[unsafe(method_family = new)]
491        pub unsafe fn new() -> Retained<Self>;
492    );
493}
494
495extern_class!(
496    /// The event class representing MIDI pitch bend messages.
497    ///
498    /// The effect of these messages will depend on the AVMusicTrack's destinationAudioUnit
499    /// and the capabilities of the destination's currently-loaded instrument.
500    ///
501    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidipitchbendevent?language=objc)
502    #[unsafe(super(AVMIDIChannelEvent, AVMusicEvent, NSObject))]
503    #[derive(Debug, PartialEq, Eq, Hash)]
504    pub struct AVMIDIPitchBendEvent;
505);
506
507unsafe impl NSObjectProtocol for AVMIDIPitchBendEvent {}
508
509impl AVMIDIPitchBendEvent {
510    extern_methods!(
511        /// Initialize the event with a channel and a pitch bend value.
512        ///
513        /// Parameter `channel`: The MIDI channel for the message.  Range: 0-15.
514        ///
515        /// Parameter `value`: The pitch bend value.  Range: 0-16383 (midpoint 8192).
516        #[unsafe(method(initWithChannel:value:))]
517        #[unsafe(method_family = init)]
518        pub unsafe fn initWithChannel_value(
519            this: Allocated<Self>,
520            channel: u32,
521            value: u32,
522        ) -> Retained<Self>;
523
524        /// The value of the pitch bend event.  Range: 0-16383 (midpoint 8192).
525        #[unsafe(method(value))]
526        #[unsafe(method_family = none)]
527        pub unsafe fn value(&self) -> u32;
528
529        /// Setter for [`value`][Self::value].
530        #[unsafe(method(setValue:))]
531        #[unsafe(method_family = none)]
532        pub unsafe fn setValue(&self, value: u32);
533    );
534}
535
536/// Methods declared on superclass `NSObject`.
537impl AVMIDIPitchBendEvent {
538    extern_methods!(
539        #[unsafe(method(init))]
540        #[unsafe(method_family = init)]
541        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
542
543        #[unsafe(method(new))]
544        #[unsafe(method_family = new)]
545        pub unsafe fn new() -> Retained<Self>;
546    );
547}
548
549extern_class!(
550    /// The event class representing MIDI system exclusive messages.
551    ///
552    /// The size and contents of an AVMIDISysexEvent cannot be modified once created.
553    ///
554    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidisysexevent?language=objc)
555    #[unsafe(super(AVMusicEvent, NSObject))]
556    #[derive(Debug, PartialEq, Eq, Hash)]
557    pub struct AVMIDISysexEvent;
558);
559
560unsafe impl NSObjectProtocol for AVMIDISysexEvent {}
561
562impl AVMIDISysexEvent {
563    extern_methods!(
564        /// Initialize the event with an NSData.
565        ///
566        /// Parameter `data`: An NSData object containing the raw contents of the system exclusive event.
567        #[unsafe(method(initWithData:))]
568        #[unsafe(method_family = init)]
569        pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Retained<Self>;
570
571        /// The size of the raw data associated with this system exclusive event.
572        #[unsafe(method(sizeInBytes))]
573        #[unsafe(method_family = none)]
574        pub unsafe fn sizeInBytes(&self) -> u32;
575    );
576}
577
578/// Methods declared on superclass `NSObject`.
579impl AVMIDISysexEvent {
580    extern_methods!(
581        #[unsafe(method(init))]
582        #[unsafe(method_family = init)]
583        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
584
585        #[unsafe(method(new))]
586        #[unsafe(method_family = new)]
587        pub unsafe fn new() -> Retained<Self>;
588    );
589}
590
591/// Constants which indicate which type of MIDI Meta-Event to create.
592///
593/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidimetaeventtype?language=objc)
594// NS_ENUM
595#[repr(transparent)]
596#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
597pub struct AVMIDIMetaEventType(pub NSInteger);
598impl AVMIDIMetaEventType {
599    #[doc(alias = "AVMIDIMetaEventTypeSequenceNumber")]
600    pub const SequenceNumber: Self = Self(0x00);
601    #[doc(alias = "AVMIDIMetaEventTypeText")]
602    pub const Text: Self = Self(0x01);
603    #[doc(alias = "AVMIDIMetaEventTypeCopyright")]
604    pub const Copyright: Self = Self(0x02);
605    #[doc(alias = "AVMIDIMetaEventTypeTrackName")]
606    pub const TrackName: Self = Self(0x03);
607    #[doc(alias = "AVMIDIMetaEventTypeInstrument")]
608    pub const Instrument: Self = Self(0x04);
609    #[doc(alias = "AVMIDIMetaEventTypeLyric")]
610    pub const Lyric: Self = Self(0x05);
611    #[doc(alias = "AVMIDIMetaEventTypeMarker")]
612    pub const Marker: Self = Self(0x06);
613    #[doc(alias = "AVMIDIMetaEventTypeCuePoint")]
614    pub const CuePoint: Self = Self(0x07);
615    #[doc(alias = "AVMIDIMetaEventTypeMidiChannel")]
616    pub const MidiChannel: Self = Self(0x20);
617    #[doc(alias = "AVMIDIMetaEventTypeMidiPort")]
618    pub const MidiPort: Self = Self(0x21);
619    #[doc(alias = "AVMIDIMetaEventTypeEndOfTrack")]
620    pub const EndOfTrack: Self = Self(0x2f);
621    #[doc(alias = "AVMIDIMetaEventTypeTempo")]
622    pub const Tempo: Self = Self(0x51);
623    #[doc(alias = "AVMIDIMetaEventTypeSmpteOffset")]
624    pub const SmpteOffset: Self = Self(0x54);
625    #[doc(alias = "AVMIDIMetaEventTypeTimeSignature")]
626    pub const TimeSignature: Self = Self(0x58);
627    #[doc(alias = "AVMIDIMetaEventTypeKeySignature")]
628    pub const KeySignature: Self = Self(0x59);
629    #[doc(alias = "AVMIDIMetaEventTypeProprietaryEvent")]
630    pub const ProprietaryEvent: Self = Self(0x7f);
631}
632
633unsafe impl Encode for AVMIDIMetaEventType {
634    const ENCODING: Encoding = NSInteger::ENCODING;
635}
636
637unsafe impl RefEncode for AVMIDIMetaEventType {
638    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
639}
640
641extern_class!(
642    /// The event class representing MIDI Meta-Event messages.
643    ///
644    /// The size and contents of an AVMIDIMetaEvent cannot be modified once created.
645    ///
646    /// Events with AVMIDIMetaEventType AVMIDIMetaEventTypeTempo, AVMIDIMetaEventTypeSmpteOffset,
647    /// or AVMIDIMetaEventTypeTimeSignature can only be added to a sequence's tempo track.
648    ///
649    /// The class does not verify that the content matches the MIDI specification.
650    ///
651    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmidimetaevent?language=objc)
652    #[unsafe(super(AVMusicEvent, NSObject))]
653    #[derive(Debug, PartialEq, Eq, Hash)]
654    pub struct AVMIDIMetaEvent;
655);
656
657unsafe impl NSObjectProtocol for AVMIDIMetaEvent {}
658
659impl AVMIDIMetaEvent {
660    extern_methods!(
661        /// Initialize the event with a MIDI Meta-Event type and an NSData.
662        ///
663        /// Parameter `type`: A AVMIDIMetaEventType indicating which type of Meta-Event.
664        ///
665        /// Parameter `data`: An NSData object containing the raw contents of the Meta-Event.
666        #[unsafe(method(initWithType:data:))]
667        #[unsafe(method_family = init)]
668        pub unsafe fn initWithType_data(
669            this: Allocated<Self>,
670            r#type: AVMIDIMetaEventType,
671            data: &NSData,
672        ) -> Retained<Self>;
673
674        /// The type of Meta-Event, specified as an AVMIDIMetaEventType.
675        #[unsafe(method(type))]
676        #[unsafe(method_family = none)]
677        pub unsafe fn r#type(&self) -> AVMIDIMetaEventType;
678    );
679}
680
681/// Methods declared on superclass `NSObject`.
682impl AVMIDIMetaEvent {
683    extern_methods!(
684        #[unsafe(method(init))]
685        #[unsafe(method_family = init)]
686        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
687
688        #[unsafe(method(new))]
689        #[unsafe(method_family = new)]
690        pub unsafe fn new() -> Retained<Self>;
691    );
692}
693
694extern_class!(
695    /// The event class representing custom user messages.
696    ///
697    /// When a scheduled AVMusicUserEvent is reached during playback of a AVMusicTrack, the track's
698    /// user callback block will be called if it has been set.  The event's NSData will be provided as
699    /// an argument to that block.
700    /// The size and contents of an AVMusicUserEvent cannot be modified once created.
701    ///
702    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avmusicuserevent?language=objc)
703    #[unsafe(super(AVMusicEvent, NSObject))]
704    #[derive(Debug, PartialEq, Eq, Hash)]
705    pub struct AVMusicUserEvent;
706);
707
708unsafe impl NSObjectProtocol for AVMusicUserEvent {}
709
710impl AVMusicUserEvent {
711    extern_methods!(
712        /// Initialize the event with an NSData.
713        ///
714        /// Parameter `data`: An NSData object containing the contents to be returned via the AVMusicTrack's user callback.
715        #[unsafe(method(initWithData:))]
716        #[unsafe(method_family = init)]
717        pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Retained<Self>;
718
719        /// The size of the data associated with this user event.
720        #[unsafe(method(sizeInBytes))]
721        #[unsafe(method_family = none)]
722        pub unsafe fn sizeInBytes(&self) -> u32;
723    );
724}
725
726/// Methods declared on superclass `NSObject`.
727impl AVMusicUserEvent {
728    extern_methods!(
729        #[unsafe(method(init))]
730        #[unsafe(method_family = init)]
731        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
732
733        #[unsafe(method(new))]
734        #[unsafe(method_family = new)]
735        pub unsafe fn new() -> Retained<Self>;
736    );
737}
738
739extern "C" {
740    /// A constant representing the default instrument ID to use for an AVExtendedNoteOnEvent.  This indicates to the
741    /// system to use the instrument currently loaded on the channel referenced by the groupID.  This is the only
742    /// supported value at this time.
743    ///
744    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avextendednoteoneventdefaultinstrument?language=objc)
745    pub static AVExtendedNoteOnEventDefaultInstrument: u32;
746}
747
748extern_class!(
749    /// The event class representing a custom extension of a MIDI note-on.
750    ///
751    /// Using an AVExtendedNoteOnEvent allows an application to trigger a specialized note-on event on one of several
752    /// Apple audio units which support it.  The floating point note and velocity numbers allow optional fractional control
753    /// of the note's run-time properties which are modulated by those inputs.  In addition, it supports the possibility
754    /// of an audio unit with more than the standard 16 MIDI channels.
755    ///
756    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avextendednoteonevent?language=objc)
757    #[unsafe(super(AVMusicEvent, NSObject))]
758    #[derive(Debug, PartialEq, Eq, Hash)]
759    pub struct AVExtendedNoteOnEvent;
760);
761
762unsafe impl NSObjectProtocol for AVExtendedNoteOnEvent {}
763
764impl AVExtendedNoteOnEvent {
765    extern_methods!(
766        #[cfg(feature = "AVAudioTypes")]
767        /// Initialize the event with a midi note, velocity, instrument and group ID, and a duration.
768        ///
769        /// Parameter `midiNote`: The MIDI velocity represented as a floating point.  Range: Destination-dependent, usually 0.0 - 127.0.
770        ///
771        /// Parameter `velocity`: The MIDI velocity represented as a floating point.  Range: Destination-dependent, usually 0.0 - 127.0.
772        ///
773        /// Parameter `groupID`: An index indicating the AudioUnitElement within the Group Scope which should handle this event (see AudioUnitElement).
774        /// This normally maps to a channel within the audio unit.
775        /// Range: normally between 0 and 15, but may be higher if the AVMusicTrack's destinationAudioUnit supports more channels.
776        ///
777        /// Parameter `duration`: The duration of this event in AVMusicTimeStamp beats.  Range:  Any nonnegative number.
778        #[unsafe(method(initWithMIDINote:velocity:groupID:duration:))]
779        #[unsafe(method_family = init)]
780        pub unsafe fn initWithMIDINote_velocity_groupID_duration(
781            this: Allocated<Self>,
782            midi_note: c_float,
783            velocity: c_float,
784            group_id: u32,
785            duration: AVMusicTimeStamp,
786        ) -> Retained<Self>;
787
788        #[cfg(feature = "AVAudioTypes")]
789        /// Initialize the event with a midi note, velocity, instrument and group ID, and a duration.
790        ///
791        /// This initializer is identical to initWithMIDINote:velocity:groupID:duration with the addition of
792        /// an instrumentID parameter which will allow for the possibility of an externally-created custom instrument.
793        /// If this initializer is used, instrumentID should be set to AVExtendedNoteOnEventDefaultInstrument for now.
794        #[unsafe(method(initWithMIDINote:velocity:instrumentID:groupID:duration:))]
795        #[unsafe(method_family = init)]
796        pub unsafe fn initWithMIDINote_velocity_instrumentID_groupID_duration(
797            this: Allocated<Self>,
798            midi_note: c_float,
799            velocity: c_float,
800            instrument_id: u32,
801            group_id: u32,
802            duration: AVMusicTimeStamp,
803        ) -> Retained<Self>;
804
805        /// The MIDI note number represented as a floating point.  If the instrument within the AVMusicTrack's
806        /// destinationAudioUnit supports fractional values, this may be used to generate arbitrary
807        /// macro- and micro-tunings.  Range: Destination-dependent, usually 0.0 - 127.0.
808        #[unsafe(method(midiNote))]
809        #[unsafe(method_family = none)]
810        pub unsafe fn midiNote(&self) -> c_float;
811
812        /// Setter for [`midiNote`][Self::midiNote].
813        #[unsafe(method(setMidiNote:))]
814        #[unsafe(method_family = none)]
815        pub unsafe fn setMidiNote(&self, midi_note: c_float);
816
817        /// The MIDI velocity represented as a floating point.  If the instrument within the AVMusicTrack's
818        /// destinationAudioUnit supports fractional values, this may be used to generate very precise changes
819        /// in gain, etc.  Range: Destination-dependent, usually 0.0 - 127.0.
820        #[unsafe(method(velocity))]
821        #[unsafe(method_family = none)]
822        pub unsafe fn velocity(&self) -> c_float;
823
824        /// Setter for [`velocity`][Self::velocity].
825        #[unsafe(method(setVelocity:))]
826        #[unsafe(method_family = none)]
827        pub unsafe fn setVelocity(&self, velocity: c_float);
828
829        /// This should be set to AVExtendedNoteOnEventDefaultInstrument.
830        #[unsafe(method(instrumentID))]
831        #[unsafe(method_family = none)]
832        pub unsafe fn instrumentID(&self) -> u32;
833
834        /// Setter for [`instrumentID`][Self::instrumentID].
835        #[unsafe(method(setInstrumentID:))]
836        #[unsafe(method_family = none)]
837        pub unsafe fn setInstrumentID(&self, instrument_id: u32);
838
839        /// This represents the audio unit channel (i.e., Group Scope) which should handle this event.
840        /// Range: normally between 0 and 15, but may be higher if the AVMusicTrack's destinationAudioUnit
841        /// supports more channels.
842        #[unsafe(method(groupID))]
843        #[unsafe(method_family = none)]
844        pub unsafe fn groupID(&self) -> u32;
845
846        /// Setter for [`groupID`][Self::groupID].
847        #[unsafe(method(setGroupID:))]
848        #[unsafe(method_family = none)]
849        pub unsafe fn setGroupID(&self, group_id: u32);
850
851        #[cfg(feature = "AVAudioTypes")]
852        /// The duration of this event in AVMusicTimeStamp beats.  Range:  Any nonnegative number.
853        #[unsafe(method(duration))]
854        #[unsafe(method_family = none)]
855        pub unsafe fn duration(&self) -> AVMusicTimeStamp;
856
857        #[cfg(feature = "AVAudioTypes")]
858        /// Setter for [`duration`][Self::duration].
859        #[unsafe(method(setDuration:))]
860        #[unsafe(method_family = none)]
861        pub unsafe fn setDuration(&self, duration: AVMusicTimeStamp);
862    );
863}
864
865/// Methods declared on superclass `NSObject`.
866impl AVExtendedNoteOnEvent {
867    extern_methods!(
868        #[unsafe(method(init))]
869        #[unsafe(method_family = init)]
870        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
871
872        #[unsafe(method(new))]
873        #[unsafe(method_family = new)]
874        pub unsafe fn new() -> Retained<Self>;
875    );
876}
877
878extern_class!(
879    /// The event class representing a parameter set/change event on the AVMusicTrack's destinationAudioUnit.
880    ///
881    /// AVParameterEvents make it possible to schedule and/or automate parameter changes on the audio unit
882    /// that has been configured as the destination for the AVMusicTrack containing this event.
883    ///
884    /// When the track is played as part of a sequence, the destination audio unit will receive set-parameter
885    /// messages whose values change smoothly along a linear ramp between each event's beat location.
886    ///
887    /// If an AVParameterEvent is added to an empty, non-automation track, the track becomes an automation track.
888    ///
889    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avparameterevent?language=objc)
890    #[unsafe(super(AVMusicEvent, NSObject))]
891    #[derive(Debug, PartialEq, Eq, Hash)]
892    pub struct AVParameterEvent;
893);
894
895unsafe impl NSObjectProtocol for AVParameterEvent {}
896
897impl AVParameterEvent {
898    extern_methods!(
899        /// Initialize the event with the parameter ID, scope, element, and value for the parameter to be set.
900        ///
901        /// Parameter `parameterID`: The ID of the parameter (see AudioUnitParameterID).
902        ///
903        /// Parameter `scope`: The audio unit scope for the parameter (see AudioUnitScope).
904        ///
905        /// Parameter `element`: The element index within the scope (see AudioUnitElement).
906        ///
907        /// Parameter `value`: The value of the parameter to be set.  Range:  Dependent on parameter.
908        #[unsafe(method(initWithParameterID:scope:element:value:))]
909        #[unsafe(method_family = init)]
910        pub unsafe fn initWithParameterID_scope_element_value(
911            this: Allocated<Self>,
912            parameter_id: u32,
913            scope: u32,
914            element: u32,
915            value: c_float,
916        ) -> Retained<Self>;
917
918        /// The ID of the parameter (see AudioUnitParameterID).
919        #[unsafe(method(parameterID))]
920        #[unsafe(method_family = none)]
921        pub unsafe fn parameterID(&self) -> u32;
922
923        /// Setter for [`parameterID`][Self::parameterID].
924        #[unsafe(method(setParameterID:))]
925        #[unsafe(method_family = none)]
926        pub unsafe fn setParameterID(&self, parameter_id: u32);
927
928        /// The audio unit scope for the parameter (see AudioUnitScope).
929        #[unsafe(method(scope))]
930        #[unsafe(method_family = none)]
931        pub unsafe fn scope(&self) -> u32;
932
933        /// Setter for [`scope`][Self::scope].
934        #[unsafe(method(setScope:))]
935        #[unsafe(method_family = none)]
936        pub unsafe fn setScope(&self, scope: u32);
937
938        /// The element index within the scope (see AudioUnitElement).
939        #[unsafe(method(element))]
940        #[unsafe(method_family = none)]
941        pub unsafe fn element(&self) -> u32;
942
943        /// Setter for [`element`][Self::element].
944        #[unsafe(method(setElement:))]
945        #[unsafe(method_family = none)]
946        pub unsafe fn setElement(&self, element: u32);
947
948        /// The value of the parameter to be set.  Range:  Dependent on parameter.
949        #[unsafe(method(value))]
950        #[unsafe(method_family = none)]
951        pub unsafe fn value(&self) -> c_float;
952
953        /// Setter for [`value`][Self::value].
954        #[unsafe(method(setValue:))]
955        #[unsafe(method_family = none)]
956        pub unsafe fn setValue(&self, value: c_float);
957    );
958}
959
960/// Methods declared on superclass `NSObject`.
961impl AVParameterEvent {
962    extern_methods!(
963        #[unsafe(method(init))]
964        #[unsafe(method_family = init)]
965        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
966
967        #[unsafe(method(new))]
968        #[unsafe(method_family = new)]
969        pub unsafe fn new() -> Retained<Self>;
970    );
971}
972
973extern_class!(
974    /// The event class representing a preset load and change on the AVMusicTrack's destinationAudioUnit.
975    ///
976    /// AVAUPresetEvents make it possible to schedule and/or automate preset changes on the audio unit
977    /// that has been configured as the destination for the AVMusicTrack containing this event.
978    ///
979    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaupresetevent?language=objc)
980    #[unsafe(super(AVMusicEvent, NSObject))]
981    #[derive(Debug, PartialEq, Eq, Hash)]
982    pub struct AVAUPresetEvent;
983);
984
985unsafe impl NSObjectProtocol for AVAUPresetEvent {}
986
987impl AVAUPresetEvent {
988    extern_methods!(
989        /// Initialize the event with the scope, element, and dictionary for the preset.
990        ///
991        /// Parameter `scope`: The audio unit scope for the parameter (see AudioUnitScope).  This should always be set to Global.
992        ///
993        /// Parameter `element`: The element index within the scope (see AudioUnitElement).  This should usually be set to 0.
994        ///
995        /// Parameter `presetDictionary`: An NSDictionary containing the preset.  The audio unit will expect this to be a dictionary
996        /// structured as an appropriate audio unit preset.
997        ///
998        /// The dictionary passed to this initializer will be copied and is not editable once the event is
999        /// created.
1000        #[unsafe(method(initWithScope:element:dictionary:))]
1001        #[unsafe(method_family = init)]
1002        pub unsafe fn initWithScope_element_dictionary(
1003            this: Allocated<Self>,
1004            scope: u32,
1005            element: u32,
1006            preset_dictionary: &NSDictionary,
1007        ) -> Retained<Self>;
1008
1009        /// The audio unit scope for the parameter (see AudioUnitScope).  This should always be set to Global.
1010        #[unsafe(method(scope))]
1011        #[unsafe(method_family = none)]
1012        pub unsafe fn scope(&self) -> u32;
1013
1014        /// Setter for [`scope`][Self::scope].
1015        #[unsafe(method(setScope:))]
1016        #[unsafe(method_family = none)]
1017        pub unsafe fn setScope(&self, scope: u32);
1018
1019        /// The element index within the scope (see AudioUnitElement).  This should usually be set to 0.
1020        #[unsafe(method(element))]
1021        #[unsafe(method_family = none)]
1022        pub unsafe fn element(&self) -> u32;
1023
1024        /// Setter for [`element`][Self::element].
1025        #[unsafe(method(setElement:))]
1026        #[unsafe(method_family = none)]
1027        pub unsafe fn setElement(&self, element: u32);
1028
1029        /// An NSDictionary containing the preset.
1030        #[unsafe(method(presetDictionary))]
1031        #[unsafe(method_family = none)]
1032        pub unsafe fn presetDictionary(&self) -> Retained<NSDictionary>;
1033    );
1034}
1035
1036/// Methods declared on superclass `NSObject`.
1037impl AVAUPresetEvent {
1038    extern_methods!(
1039        #[unsafe(method(init))]
1040        #[unsafe(method_family = init)]
1041        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1042
1043        #[unsafe(method(new))]
1044        #[unsafe(method_family = new)]
1045        pub unsafe fn new() -> Retained<Self>;
1046    );
1047}
1048
1049extern_class!(
1050    /// The event class representing a tempo change to a specific beats-per-minute value.
1051    ///
1052    /// This event provides a way to specify a tempo change that is less cumbersome than using
1053    /// tempo meta-events.
1054    ///
1055    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avextendedtempoevent?language=objc)
1056    #[unsafe(super(AVMusicEvent, NSObject))]
1057    #[derive(Debug, PartialEq, Eq, Hash)]
1058    pub struct AVExtendedTempoEvent;
1059);
1060
1061unsafe impl NSObjectProtocol for AVExtendedTempoEvent {}
1062
1063impl AVExtendedTempoEvent {
1064    extern_methods!(
1065        /// Initialize the event tempo.
1066        ///
1067        /// Parameter `tempo`: The new tempo in beats-per-minute.  Range:  Any positive value.
1068        /// The new tempo will begin at the timestamp for this event.
1069        #[unsafe(method(initWithTempo:))]
1070        #[unsafe(method_family = init)]
1071        pub unsafe fn initWithTempo(this: Allocated<Self>, tempo: c_double) -> Retained<Self>;
1072
1073        /// The new tempo in beats-per-minute.  Range:  Any positive value.
1074        #[unsafe(method(tempo))]
1075        #[unsafe(method_family = none)]
1076        pub unsafe fn tempo(&self) -> c_double;
1077
1078        /// Setter for [`tempo`][Self::tempo].
1079        #[unsafe(method(setTempo:))]
1080        #[unsafe(method_family = none)]
1081        pub unsafe fn setTempo(&self, tempo: c_double);
1082    );
1083}
1084
1085/// Methods declared on superclass `NSObject`.
1086impl AVExtendedTempoEvent {
1087    extern_methods!(
1088        #[unsafe(method(init))]
1089        #[unsafe(method_family = init)]
1090        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1091
1092        #[unsafe(method(new))]
1093        #[unsafe(method_family = new)]
1094        pub unsafe fn new() -> Retained<Self>;
1095    );
1096}