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