objc2-core-audio 0.3.2

Bindings to the CoreAudio framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-audio-types")]
use objc2_core_audio_types::*;
use objc2_core_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarerunloopmode?language=objc)
pub const kAudioHardwareRunLoopMode: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.audio.CoreAudio\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudioaggregatedevicemastersubdevicekey?language=objc)
pub const kAudioAggregateDeviceMasterSubDeviceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"master\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyscopeinput?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyScopeInput: AudioObjectPropertyScope = kAudioObjectPropertyScopeInput;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyscopeoutput?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyScopeOutput: AudioObjectPropertyScope =
    kAudioObjectPropertyScopeOutput;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyscopeplaythrough?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyScopePlayThrough: AudioObjectPropertyScope =
    kAudioObjectPropertyScopePlayThrough;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiopropertywildcardpropertyid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioPropertyWildcardPropertyID: AudioObjectPropertySelector =
    kAudioObjectPropertySelectorWildcard;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiopropertywildcardsection?language=objc)
pub const kAudioPropertyWildcardSection: c_uchar = 0xFF;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiopropertywildcardchannel?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioPropertyWildcardChannel: AudioObjectPropertyElement =
    kAudioObjectPropertyElementWildcard;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudioisubownercontrolclassid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioISubOwnerControlClassID: AudioClassID = 0x61746368;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiolevelcontrolpropertydecibelstoscalartransferfunction?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioLevelControlPropertyDecibelsToScalarTransferFunction: AudioObjectPropertySelector =
    0x6c637466;

/// The following constants are the only supported values for a volume control's
/// transfer function.
///
/// The transfer function implemented in the volume control works by raising the
/// scalar value to an exponent to map it into the decibel range. The constants
/// in this enum express the exponent used in the name as a quotient. For example,
/// kAudioLevelControlTranferFunction3Over4 represents the exponent 0.75.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudio/audiolevelcontroltransferfunction?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AudioLevelControlTransferFunction(pub u32);
impl AudioLevelControlTransferFunction {
    #[doc(alias = "kAudioLevelControlTranferFunctionLinear")]
    pub const TranferFunctionLinear: Self = Self(0);
    #[doc(alias = "kAudioLevelControlTranferFunction1Over3")]
    pub const TranferFunction1Over3: Self = Self(1);
    #[doc(alias = "kAudioLevelControlTranferFunction1Over2")]
    pub const TranferFunction1Over2: Self = Self(2);
    #[doc(alias = "kAudioLevelControlTranferFunction3Over4")]
    pub const TranferFunction3Over4: Self = Self(3);
    #[doc(alias = "kAudioLevelControlTranferFunction3Over2")]
    pub const TranferFunction3Over2: Self = Self(4);
    #[doc(alias = "kAudioLevelControlTranferFunction2Over1")]
    pub const TranferFunction2Over1: Self = Self(5);
    #[doc(alias = "kAudioLevelControlTranferFunction3Over1")]
    pub const TranferFunction3Over1: Self = Self(6);
    #[doc(alias = "kAudioLevelControlTranferFunction4Over1")]
    pub const TranferFunction4Over1: Self = Self(7);
    #[doc(alias = "kAudioLevelControlTranferFunction5Over1")]
    pub const TranferFunction5Over1: Self = Self(8);
    #[doc(alias = "kAudioLevelControlTranferFunction6Over1")]
    pub const TranferFunction6Over1: Self = Self(9);
    #[doc(alias = "kAudioLevelControlTranferFunction7Over1")]
    pub const TranferFunction7Over1: Self = Self(10);
    #[doc(alias = "kAudioLevelControlTranferFunction8Over1")]
    pub const TranferFunction8Over1: Self = Self(11);
    #[doc(alias = "kAudioLevelControlTranferFunction9Over1")]
    pub const TranferFunction9Over1: Self = Self(12);
    #[doc(alias = "kAudioLevelControlTranferFunction10Over1")]
    pub const TranferFunction10Over1: Self = Self(13);
    #[doc(alias = "kAudioLevelControlTranferFunction11Over1")]
    pub const TranferFunction11Over1: Self = Self(14);
    #[doc(alias = "kAudioLevelControlTranferFunction12Over1")]
    pub const TranferFunction12Over1: Self = Self(15);
}

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

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

/// An AudioHardwarePropertyID is a integer that identifies a specific piece of
/// information about the AudioSystemObject.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudio/audiohardwarepropertyid?language=objc)
#[cfg(feature = "AudioHardware")]
pub type AudioHardwarePropertyID = AudioObjectPropertySelector;

/// Clients register an AudioHardwarePropertyListenerProc with the AudioSystemObject
/// in order to receive notifications when the properties of the object change.
///
/// Note that the same functionality is provided by AudioObjectPropertyListenerProc.
///
/// Parameter `inPropertyID`: The AudioHardwarePropertyID of the property that changed.
///
/// Parameter `inClientData`: A pointer to client data established when the listener proc was registered
/// with the AudioSystemObject.
///
/// Returns: The return value is currently unused and should always be 0.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudio/audiohardwarepropertylistenerproc?language=objc)
#[cfg(feature = "AudioHardware")]
pub type AudioHardwarePropertyListenerProc =
    Option<unsafe extern "C-unwind" fn(AudioHardwarePropertyID, *mut c_void) -> OSStatus>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertyrunloop?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyRunLoop: AudioObjectPropertySelector = 0x726e6c70;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertydeviceforuid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyDeviceForUID: AudioObjectPropertySelector = 0x64756964;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertypluginforbundleid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyPlugInForBundleID: AudioObjectPropertySelector = 0x70696269;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertyprocessismaster?language=objc)
#[cfg(feature = "AudioHardware")]
#[deprecated]
pub const kAudioHardwarePropertyProcessIsMaster: AudioObjectPropertySelector = 0x6d617374;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertybootchimevolumescalar?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyBootChimeVolumeScalar: AudioObjectPropertySelector = 0x62627673;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertybootchimevolumedecibels?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyBootChimeVolumeDecibels: AudioObjectPropertySelector = 0x62627664;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertybootchimevolumerangedecibels?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyBootChimeVolumeRangeDecibels: AudioObjectPropertySelector =
    0x62626423;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertybootchimevolumescalartodecibels?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyBootChimeVolumeScalarToDecibels: AudioObjectPropertySelector =
    0x62763264;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertybootchimevolumedecibelstoscalar?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyBootChimeVolumeDecibelsToScalar: AudioObjectPropertySelector =
    0x62643276;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiohardwarepropertybootchimevolumedecibelstoscalartransferfunction?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioHardwarePropertyBootChimeVolumeDecibelsToScalarTransferFunction:
    AudioObjectPropertySelector = 0x62767466;

extern "C-unwind" {
    /// Add the given CFRunLoopSource to the the HAL's notification CFRunLoop.
    ///
    /// The CFRunLoop the HAL uses for notifications is specified by
    /// kAudioHardwarePropertyRunLoop. If kAudioHardwarePropertyRunLoop changes,
    /// CFRunLoopSources added with this function will automatically be transferred to
    /// the new CFRunLoop.
    /// Usage of the HAL's notification run loop is deprecated. Please use libdispatch
    /// instead.
    ///
    /// Parameter `inRunLoopSource`: The CFRunLoopSource to add.
    ///
    /// Returns: An OSStatus indicating success or failure.
    #[deprecated]
    pub fn AudioHardwareAddRunLoopSource(in_run_loop_source: &CFRunLoopSource) -> OSStatus;
}

extern "C-unwind" {
    /// Remove the given CFRunLoopSource from the the HAL's notification CFRunLoop.
    ///
    /// The CFRunLoop the HAL uses for notifications is specified by
    /// kAudioHardwarePropertyRunLoop.
    /// Usage of the HAL's notification run loop is deprecated. Please use libdispatch
    /// instead.
    ///
    /// Parameter `inRunLoopSource`: The CFRunLoopSource to remove.
    ///
    /// Returns: An OSStatus indicating success or failure.
    #[deprecated]
    pub fn AudioHardwareRemoveRunLoopSource(in_run_loop_source: &CFRunLoopSource) -> OSStatus;
}

extern "C-unwind" {
    /// Retrieve information about the given property.
    ///
    /// Note that the same functionality is provided by the functions
    /// AudioObjectHasProperty(), AudioObjectIsPropertySettable(), and
    /// AudioObjectGetPropertyDataSize().
    ///
    /// Parameter `inPropertyID`: The AudioHardwarePropertyID of the property to query.
    ///
    /// Parameter `outSize`: A pointer to a UInt32 that receives the size of the property data in bytes
    /// on exit. This can be NULL if the size information is not being requested.
    ///
    /// Parameter `outWritable`: A pointer to a Boolean that receives indication of whether or not the given
    /// property can be set. This can be NULL if the writability is not being
    /// requested.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// - `out_size` must be a valid pointer or null.
    /// - `out_writable` must be a valid pointer or null.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioHardwareGetPropertyInfo(
        in_property_id: AudioHardwarePropertyID,
        out_size: *mut u32,
        out_writable: *mut Boolean,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Queries an the AudioSystemObject to get the data of the given property and
    /// places it in the provided buffer.
    ///
    /// Note that the same functionality is provided by the function
    /// AudioObjectGetPropertyData().
    ///
    /// Parameter `inPropertyID`: The AudioHardwarePropertyID of the property to query.
    ///
    /// Parameter `ioPropertyDataSize`: A UInt32 which on entry indicates the size of the buffer pointed to by
    /// outData and on exit indicates how much of the buffer was used.
    ///
    /// Parameter `outPropertyData`: The buffer into which the AudioSystemObject will put the data for the given
    /// property.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// - `io_property_data_size` must be a valid pointer.
    /// - `out_property_data` must be a valid pointer.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioHardwareGetProperty(
        in_property_id: AudioHardwarePropertyID,
        io_property_data_size: NonNull<u32>,
        out_property_data: NonNull<c_void>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Tells the AudioSystemObject to change the value of the given property using the
    /// provided data.
    ///
    /// Note that the value of the property should not be considered changed until the
    /// HAL has called the listeners as many properties values are changed
    /// asynchronously. Also note that the same functionality is provided by the
    /// function AudioObjectGetPropertyData().
    ///
    /// Parameter `inPropertyID`: The AudioHardwarePropertyID of the property to change.
    ///
    /// Parameter `inPropertyDataSize`: A UInt32 indicating the size of the buffer pointed to by inData.
    ///
    /// Parameter `inPropertyData`: The buffer containing the data to be used to change the property's value.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// `in_property_data` must be a valid pointer.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioHardwareSetProperty(
        in_property_id: AudioHardwarePropertyID,
        in_property_data_size: u32,
        in_property_data: NonNull<c_void>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Registers the given AudioHardwarePropertyListenerProc to receive notifications
    /// when the given property changes.
    ///
    /// Note that the same functionality is provided by AudioObjectAddPropertyListener
    /// in conjunction with AudioObjectPropertyListenerProc.
    ///
    /// Parameter `inPropertyID`: The AudioHardwarePropertyID of the property to listen to.
    ///
    /// Parameter `inProc`: AudioHardwarePropertyListenerProc to call.
    ///
    /// Parameter `inClientData`: A pointer to client data that is passed to the listener when it is called.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// - `in_proc` must be implemented correctly.
    /// - `in_client_data` must be a valid pointer or null.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioHardwareAddPropertyListener(
        in_property_id: AudioHardwarePropertyID,
        in_proc: AudioHardwarePropertyListenerProc,
        in_client_data: *mut c_void,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Unregisters the given AudioHardwarePropertyListenerProc from receive
    /// notifications when the given property changes.
    ///
    /// Note that the same functionality is provided by
    /// AudioObjectRemovePropertyListener in conjunction with
    /// AudioObjectPropertyListenerProc.
    ///
    /// Parameter `inPropertyID`: The AudioHardwarePropertyID of the property to stop listening to.
    ///
    /// Parameter `inProc`: AudioHardwarePropertyListenerProc to unregister.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// `in_proc` must be implemented correctly.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioHardwareRemovePropertyListener(
        in_property_id: AudioHardwarePropertyID,
        in_proc: AudioHardwarePropertyListenerProc,
    ) -> OSStatus;
}

/// AudioDevice is the base class for all objects that represent an audio device.
///
/// AudioDevice is a subclass of AudioObject. AudioDevices normally contain
/// AudioStreams and AudioControls, but may contain other things depending on the
/// kind of AudioDevice (e.g. aggregate devices contain other AudioDevices).
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudio/audiodeviceid?language=objc)
#[cfg(feature = "AudioHardware")]
pub type AudioDeviceID = AudioObjectID;

/// An AudioDevicePropertyID is an integer that identifies a specific piece of
/// information about the object.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudio/audiodevicepropertyid?language=objc)
#[cfg(feature = "AudioHardware")]
pub type AudioDevicePropertyID = AudioObjectPropertySelector;

/// Clients register an AudioDevicePropertyListenerProc with the AudioDevice object
/// in order to receive notifications when the properties of the object change.
///
/// Note that the same functionality is provided by AudioObjectPropertyListenerProc.
///
/// Parameter `inDevice`: The AudioDevice whose property has changed.
///
/// Parameter `inChannel`: The channel of the property that changed where 0 is the main channel.
///
/// Parameter `isInput`: Which section of the AudioDevice changed.
///
/// Parameter `inPropertyID`: The AudioDevicePropertyID of the property that changed.
///
/// Parameter `inClientData`: A pointer to client data established when the listener proc was registered
/// with the object.
///
/// Returns: The return value is currently unused and should always be 0.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudio/audiodevicepropertylistenerproc?language=objc)
#[cfg(feature = "AudioHardware")]
pub type AudioDevicePropertyListenerProc = Option<
    unsafe extern "C-unwind" fn(
        AudioDeviceID,
        u32,
        Boolean,
        AudioDevicePropertyID,
        *mut c_void,
    ) -> OSStatus,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodeviceunknown?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDeviceUnknown: AudioObjectID = kAudioObjectUnknown;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicetransporttypeautoaggregate?language=objc)
pub const kAudioDeviceTransportTypeAutoAggregate: u32 = 0x66677270;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyvolumedecibelstoscalartransferfunction?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyVolumeDecibelsToScalarTransferFunction: AudioObjectPropertySelector =
    0x76637466;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyplaythruvolumedecibelstoscalartransferfunction?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyPlayThruVolumeDecibelsToScalarTransferFunction:
    AudioObjectPropertySelector = 0x6d767466;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertydrivershouldownisub?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyDriverShouldOwniSub: AudioObjectPropertySelector = 0x69737562;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertysubvolumedecibelstoscalartransferfunction?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertySubVolumeDecibelsToScalarTransferFunction:
    AudioObjectPropertySelector = 0x73767466;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertydevicename?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyDeviceName: AudioObjectPropertySelector = 0x6e616d65;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertydevicenamecfstring?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyDeviceNameCFString: AudioObjectPropertySelector =
    kAudioObjectPropertyName;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertydevicemanufacturer?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyDeviceManufacturer: AudioObjectPropertySelector = 0x6d616b72;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertydevicemanufacturercfstring?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyDeviceManufacturerCFString: AudioObjectPropertySelector =
    kAudioObjectPropertyManufacturer;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyregisterbufferlist?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyRegisterBufferList: AudioObjectPropertySelector = 0x72627566;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertybuffersize?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyBufferSize: AudioObjectPropertySelector = 0x6273697a;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertybuffersizerange?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyBufferSizeRange: AudioObjectPropertySelector = 0x62737a23;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertychannelname?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyChannelName: AudioObjectPropertySelector = 0x63686e6d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertychannelnamecfstring?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyChannelNameCFString: AudioObjectPropertySelector =
    kAudioObjectPropertyElementName;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertychannelcategoryname?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyChannelCategoryName: AudioObjectPropertySelector = 0x63636e6d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertychannelcategorynamecfstring?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyChannelCategoryNameCFString: AudioObjectPropertySelector =
    kAudioObjectPropertyElementCategoryName;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertychannelnumbername?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyChannelNumberName: AudioObjectPropertySelector = 0x636e6e6d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertychannelnumbernamecfstring?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyChannelNumberNameCFString: AudioObjectPropertySelector =
    kAudioObjectPropertyElementNumberName;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertysupportsmixing?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertySupportsMixing: AudioObjectPropertySelector = 0x6d69783f;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertystreamformat?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyStreamFormat: AudioObjectPropertySelector = 0x73666d74;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertystreamformats?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyStreamFormats: AudioObjectPropertySelector = 0x73666d23;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertystreamformatsupported?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyStreamFormatSupported: AudioObjectPropertySelector = 0x73666d3f;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertystreamformatmatch?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyStreamFormatMatch: AudioObjectPropertySelector = 0x73666d6d;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertydatasourcenameforid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyDataSourceNameForID: AudioObjectPropertySelector = 0x7373636e;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyclocksourcenameforid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyClockSourceNameForID: AudioObjectPropertySelector = 0x6373636e;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyplaythrudestinationnameforid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyPlayThruDestinationNameForID: AudioObjectPropertySelector =
    0x6d64646e;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertychannelnominallinelevelnameforid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyChannelNominalLineLevelNameForID: AudioObjectPropertySelector =
    0x636e6c76;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiodevicepropertyhighpassfiltersettingnameforid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioDevicePropertyHighPassFilterSettingNameForID: AudioObjectPropertySelector =
    0x63686970;

extern "C-unwind" {
    /// Registers the given AudioDeviceIOProc with the AudioDevice.
    ///
    /// A client may have multiple IOProcs for a given device, but the device is free to
    /// only accept as many as it can handle. Note that it is not recommended for
    /// clients to have more than a single IOProc registered at a time as this can be
    /// wasteful of system resources. Rather, it is recommended that the client do any
    /// necessary mixing itself so that only one IOProc is necessary.
    /// This routine has been deprecated in favor of AudioDeviceCreateIOProcID().
    ///
    /// Parameter `inDevice`: The AudioDevice to register the IOProc with.
    ///
    /// Parameter `inProc`: The AudioDeviceIOProc to register.
    ///
    /// Parameter `inClientData`: A pointer to client data that is passed back to the IOProc when it is
    /// called.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// - `in_proc` must be implemented correctly.
    /// - `in_client_data` must be a valid pointer or null.
    #[cfg(all(feature = "AudioHardware", feature = "objc2-core-audio-types"))]
    #[deprecated]
    pub fn AudioDeviceAddIOProc(
        in_device: AudioDeviceID,
        in_proc: AudioDeviceIOProc,
        in_client_data: *mut c_void,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Unregisters the given AudioDeviceIOProc from the AudioDevice.
    /// This routine has been deprecated in favor of AudioDeviceDestroyIOProcID().
    ///
    /// Parameter `inDevice`: The AudioDevice to unregister the IOProc from.
    ///
    /// Parameter `inProc`: The AudioDeviceIOProc to unregister.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// `in_proc` must be implemented correctly.
    #[cfg(all(feature = "AudioHardware", feature = "objc2-core-audio-types"))]
    #[deprecated]
    pub fn AudioDeviceRemoveIOProc(
        in_device: AudioDeviceID,
        in_proc: AudioDeviceIOProc,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Read some data from an AudioDevice starting at the given time.
    ///
    /// With the advent of aggregate devices, the need for AudioDeviceRead has gone
    /// away. Consequently, this function is now deprecated.
    ///
    /// Parameter `inDevice`: The AudioDevice to read from.
    ///
    /// Parameter `inStartTime`: An AudioTimeStamp indicating the time from which to read the data. In
    /// general, the valid range of time (in frames) is from the current time minus
    /// the maximum IO buffer size to the current time minus the safety offset.
    ///
    /// Parameter `outData`: An AudioBufferList that must be the same size and shape as that returned by
    /// kAudioDevicePropertyStreamConfiguration. Further, the AudioBufferList must
    /// have been previously registered with the device via
    /// kAudioDevicePropertyRegisterBufferList. On exit, the mDataSize fields will
    /// be updated with the amount of data read.
    ///
    /// Returns: An OSStatus indicating success or failure.
    /// kAudioHardwareUnsupportedOperationError will be returned if the AudioDevice does
    /// not support direct reading.
    ///
    /// # Safety
    ///
    /// - `in_start_time` must be a valid pointer.
    /// - `out_data` must be a valid pointer.
    #[cfg(all(feature = "AudioHardware", feature = "objc2-core-audio-types"))]
    #[deprecated]
    pub fn AudioDeviceRead(
        in_device: AudioDeviceID,
        in_start_time: NonNull<AudioTimeStamp>,
        out_data: NonNull<AudioBufferList>,
    ) -> OSStatus;
}

/// Retrieve information about the given property of an AudioDevice.
///
/// Note that the same functionality is provided by the functions
/// AudioObjectHasProperty(), AudioObjectIsPropertySettable(), and
/// AudioObjectGetPropertyDataSize().
///
/// Parameter `inDevice`: The AudioDevice to query.
///
/// Parameter `inChannel`: The channel of the property to query where 0 is the main channel.
///
/// Parameter `isInput`: Which section of the AudioDevice to query.
///
/// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to query.
///
/// Parameter `outSize`: A pointer to a UInt32 that receives the size of the property data in bytes
/// on exit. This can be NULL if the size information is not being requested.
///
/// Parameter `outWritable`: A pointer to a Boolean that receives indication of whether or not the given
/// property can be set. This can be NULL if the writability is not being
/// requested.
///
/// Returns: An OSStatus indicating success or failure.
///
/// # Safety
///
/// - `out_size` must be a valid pointer or null.
/// - `out_writable` must be a valid pointer or null.
#[cfg(feature = "AudioHardware")]
#[deprecated]
#[inline]
pub unsafe extern "C-unwind" fn AudioDeviceGetPropertyInfo(
    in_device: AudioDeviceID,
    in_channel: u32,
    is_input: bool,
    in_property_id: AudioDevicePropertyID,
    out_size: *mut u32,
    out_writable: *mut Boolean,
) -> OSStatus {
    extern "C-unwind" {
        fn AudioDeviceGetPropertyInfo(
            in_device: AudioDeviceID,
            in_channel: u32,
            is_input: Boolean,
            in_property_id: AudioDevicePropertyID,
            out_size: *mut u32,
            out_writable: *mut Boolean,
        ) -> OSStatus;
    }
    unsafe {
        AudioDeviceGetPropertyInfo(
            in_device,
            in_channel,
            is_input as _,
            in_property_id,
            out_size,
            out_writable,
        )
    }
}

/// Queries an the AudioDevice object to get the data of the given property and
/// places it in the provided buffer.
///
/// Note that the same functionality is provided by the function
/// AudioObjectGetPropertyData().
///
/// Parameter `inDevice`: The AudioDevice to query.
///
/// Parameter `inChannel`: The channel of the property to query where 0 is the main channel.
///
/// Parameter `isInput`: Which section of the AudioDevice to query.
///
/// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to query.
///
/// Parameter `ioPropertyDataSize`: A UInt32 which on entry indicates the size of the buffer pointed to by
/// outData and on exit indicates how much of the buffer was used.
///
/// Parameter `outPropertyData`: The buffer into which the object will put the data for the given property.
///
/// Returns: An OSStatus indicating success or failure.
///
/// # Safety
///
/// - `io_property_data_size` must be a valid pointer.
/// - `out_property_data` must be a valid pointer.
#[cfg(feature = "AudioHardware")]
#[deprecated]
#[inline]
pub unsafe extern "C-unwind" fn AudioDeviceGetProperty(
    in_device: AudioDeviceID,
    in_channel: u32,
    is_input: bool,
    in_property_id: AudioDevicePropertyID,
    io_property_data_size: NonNull<u32>,
    out_property_data: NonNull<c_void>,
) -> OSStatus {
    extern "C-unwind" {
        fn AudioDeviceGetProperty(
            in_device: AudioDeviceID,
            in_channel: u32,
            is_input: Boolean,
            in_property_id: AudioDevicePropertyID,
            io_property_data_size: NonNull<u32>,
            out_property_data: NonNull<c_void>,
        ) -> OSStatus;
    }
    unsafe {
        AudioDeviceGetProperty(
            in_device,
            in_channel,
            is_input as _,
            in_property_id,
            io_property_data_size,
            out_property_data,
        )
    }
}

/// Tells the AudioDevice object to change the value of the given property using the
/// provided data.
///
/// Note that the value of the property should not be considered changed until the
/// HAL has called the listeners as many properties values are changed
/// asynchronously. Also note that the same functionality is provided by the
/// function AudioObjectSetPropertyData().
///
/// Parameter `inDevice`: The AudioDevice to change.
///
/// Parameter `inWhen`: A pointer to an AudioTimeStamp that says when to change the property's value
/// relative to the device's time base. NULL means execute the change
/// immediately.
///
/// Parameter `inChannel`: The channel of the property to change where 0 is the main channel.
///
/// Parameter `isInput`: Which section of the AudioDevice to change.
///
/// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to change.
///
/// Parameter `inPropertyDataSize`: A UInt32 indicating the size of the buffer pointed to by inData.
///
/// Parameter `inPropertyData`: The buffer containing the data to be used to change the property's value.
///
/// Returns: An OSStatus indicating success or failure.
///
/// # Safety
///
/// - `in_when` must be a valid pointer or null.
/// - `in_property_data` must be a valid pointer.
#[cfg(all(feature = "AudioHardware", feature = "objc2-core-audio-types"))]
#[deprecated]
#[inline]
pub unsafe extern "C-unwind" fn AudioDeviceSetProperty(
    in_device: AudioDeviceID,
    in_when: *const AudioTimeStamp,
    in_channel: u32,
    is_input: bool,
    in_property_id: AudioDevicePropertyID,
    in_property_data_size: u32,
    in_property_data: NonNull<c_void>,
) -> OSStatus {
    extern "C-unwind" {
        fn AudioDeviceSetProperty(
            in_device: AudioDeviceID,
            in_when: *const AudioTimeStamp,
            in_channel: u32,
            is_input: Boolean,
            in_property_id: AudioDevicePropertyID,
            in_property_data_size: u32,
            in_property_data: NonNull<c_void>,
        ) -> OSStatus;
    }
    unsafe {
        AudioDeviceSetProperty(
            in_device,
            in_when,
            in_channel,
            is_input as _,
            in_property_id,
            in_property_data_size,
            in_property_data,
        )
    }
}

/// Registers the given AudioDevicePropertyListenerProc to receive notifications
/// when the given property changes.
///
/// Note that the same functionality is provided by AudioObjectAddPropertyListener
/// in conjunction with AudioObjectPropertyListenerProc.
///
/// Parameter `inDevice`: The AudioDevice with whom to register the listener.
///
/// Parameter `inChannel`: The channel of the property to listen to.
///
/// Parameter `isInput`: Which section of the AudioDevice to listen to.
///
/// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to listen to.
///
/// Parameter `inProc`: AudioDevicePropertyListenerProc to call.
///
/// Parameter `inClientData`: A pointer to client data that is passed to the listener when it is called.
///
/// Returns: An OSStatus indicating success or failure.
///
/// # Safety
///
/// - `in_proc` must be implemented correctly.
/// - `in_client_data` must be a valid pointer or null.
#[cfg(feature = "AudioHardware")]
#[deprecated]
#[inline]
pub unsafe extern "C-unwind" fn AudioDeviceAddPropertyListener(
    in_device: AudioDeviceID,
    in_channel: u32,
    is_input: bool,
    in_property_id: AudioDevicePropertyID,
    in_proc: AudioDevicePropertyListenerProc,
    in_client_data: *mut c_void,
) -> OSStatus {
    extern "C-unwind" {
        fn AudioDeviceAddPropertyListener(
            in_device: AudioDeviceID,
            in_channel: u32,
            is_input: Boolean,
            in_property_id: AudioDevicePropertyID,
            in_proc: AudioDevicePropertyListenerProc,
            in_client_data: *mut c_void,
        ) -> OSStatus;
    }
    unsafe {
        AudioDeviceAddPropertyListener(
            in_device,
            in_channel,
            is_input as _,
            in_property_id,
            in_proc,
            in_client_data,
        )
    }
}

/// Unregisters the given AudioDevicePropertyListenerProc from receiving
/// notifications when the given property changes.
///
/// Note that the same functionality is provided by
/// AudioObjectRemovePropertyListener in conjunction with
/// AudioObjectPropertyListenerProc.
///
/// Parameter `inDevice`: The AudioDevice with whom to unregister the listener.
///
/// Parameter `inChannel`: The channel of the property to unregister from.
///
/// Parameter `isInput`: Which section of the AudioDevice to unregister from.
///
/// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to stop listening to.
///
/// Parameter `inProc`: AudioDevicePropertyListenerProc to unregister.
///
/// Returns: An OSStatus indicating success or failure.
///
/// # Safety
///
/// `in_proc` must be implemented correctly.
#[cfg(feature = "AudioHardware")]
#[deprecated]
#[inline]
pub unsafe extern "C-unwind" fn AudioDeviceRemovePropertyListener(
    in_device: AudioDeviceID,
    in_channel: u32,
    is_input: bool,
    in_property_id: AudioDevicePropertyID,
    in_proc: AudioDevicePropertyListenerProc,
) -> OSStatus {
    extern "C-unwind" {
        fn AudioDeviceRemovePropertyListener(
            in_device: AudioDeviceID,
            in_channel: u32,
            is_input: Boolean,
            in_property_id: AudioDevicePropertyID,
            in_proc: AudioDevicePropertyListenerProc,
        ) -> OSStatus;
    }
    unsafe {
        AudioDeviceRemovePropertyListener(
            in_device,
            in_channel,
            is_input as _,
            in_property_id,
            in_proc,
        )
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudioaggregatedevicepropertymastersubdevice?language=objc)
#[cfg(feature = "AudioHardware")]
#[deprecated]
pub const kAudioAggregateDevicePropertyMasterSubDevice: AudioObjectPropertySelector =
    kAudioAggregateDevicePropertyMainSubDevice;

/// AudioStream is the base class for all objects that represent a stream of data on
/// an audio device.
///
/// AudioStream is a subclass of AudioObject and can contain AudioControls.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudio/audiostreamid?language=objc)
#[cfg(feature = "AudioHardware")]
pub type AudioStreamID = AudioObjectID;

/// Clients register an AudioStreamPropertyListenerProc with the AudioStream object
/// in order to receive notifications when the properties of the object change.
///
/// Note that the same functionality is provided by AudioObjectPropertyListenerProc.
///
/// Parameter `inStream`: The AudioStream whose property has changed.
///
/// Parameter `inChannel`: The channel of the property that changed where 0 is the main channel.
///
/// Parameter `inPropertyID`: The AudioDevicePropertyID of the property that changed.
///
/// Parameter `inClientData`: A pointer to client data established when the listener proc was registered
/// with the object.
///
/// Returns: The return value is currently unused and should always be 0.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudio/audiostreampropertylistenerproc?language=objc)
#[cfg(feature = "AudioHardware")]
pub type AudioStreamPropertyListenerProc = Option<
    unsafe extern "C-unwind" fn(AudioStreamID, u32, AudioDevicePropertyID, *mut c_void) -> OSStatus,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiostreamunknown?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioStreamUnknown: AudioObjectID = kAudioObjectUnknown;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiostreampropertyowningdevice?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioStreamPropertyOwningDevice: AudioObjectPropertySelector = kAudioObjectPropertyOwner;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiostreampropertyphysicalformats?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioStreamPropertyPhysicalFormats: AudioObjectPropertySelector = 0x70667423;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiostreampropertyphysicalformatsupported?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioStreamPropertyPhysicalFormatSupported: AudioObjectPropertySelector = 0x7066743f;
/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiostreampropertyphysicalformatmatch?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioStreamPropertyPhysicalFormatMatch: AudioObjectPropertySelector = 0x7066746d;

extern "C-unwind" {
    /// Retrieve information about the given property of an AudioStream.
    ///
    /// Parameter `inStream`: The AudioStream to query.
    ///
    /// Parameter `inChannel`: The channel of the property to query where 0 is the main channel.
    ///
    /// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to query.
    ///
    /// Parameter `outSize`: A pointer to a UInt32 that receives the size of the property data in bytes
    /// on exit. This can be NULL if the size information is not being requested.
    ///
    /// Parameter `outWritable`: A pointer to a Boolean that receives indication of whether or not the given
    /// property can be set. This can be NULL if the writability is not being
    /// requested.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// - `out_size` must be a valid pointer or null.
    /// - `out_writable` must be a valid pointer or null.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioStreamGetPropertyInfo(
        in_stream: AudioStreamID,
        in_channel: u32,
        in_property_id: AudioDevicePropertyID,
        out_size: *mut u32,
        out_writable: *mut Boolean,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Queries an the AudioStream object to get the data of the given property and
    /// places it in the provided buffer.
    ///
    /// Note that the same functionality is provided by the function
    /// AudioObjectGetPropertyData().
    ///
    /// Parameter `inStream`: The AudioStream to query.
    ///
    /// Parameter `inChannel`: The channel of the property to query where 0 is the main channel.
    ///
    /// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to query.
    ///
    /// Parameter `ioPropertyDataSize`: A UInt32 which on entry indicates the size of the buffer pointed to by
    /// outData and on exit indicates how much of the buffer was used.
    ///
    /// Parameter `outPropertyData`: The buffer into which the object will put the data for the given property.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// - `io_property_data_size` must be a valid pointer.
    /// - `out_property_data` must be a valid pointer.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioStreamGetProperty(
        in_stream: AudioStreamID,
        in_channel: u32,
        in_property_id: AudioDevicePropertyID,
        io_property_data_size: NonNull<u32>,
        out_property_data: NonNull<c_void>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Tells the AudioStream object to change the value of the given property using the
    /// provided data.
    ///
    /// Note that the value of the property should not be considered changed until the
    /// HAL has called the listeners as many properties values are changed
    /// asynchronously. Also note that the same functionality is provided by the
    /// function AudioObjectSetPropertyData().
    ///
    /// Parameter `inStream`: The AudioStream to change.
    ///
    /// Parameter `inWhen`: A pointer to an AudioTimeStamp that says when to change the property's value
    /// relative to the device's time base. NULL means execute the change
    /// immediately.
    ///
    /// Parameter `inChannel`: The channel of the property to change where 0 is the main channel.
    ///
    /// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to change.
    ///
    /// Parameter `inPropertyDataSize`: A UInt32 indicating the size of the buffer pointed to by inData.
    ///
    /// Parameter `inPropertyData`: The buffer containing the data to be used to change the property's value.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// - `in_when` must be a valid pointer or null.
    /// - `in_property_data` must be a valid pointer.
    #[cfg(all(feature = "AudioHardware", feature = "objc2-core-audio-types"))]
    #[deprecated]
    pub fn AudioStreamSetProperty(
        in_stream: AudioStreamID,
        in_when: *const AudioTimeStamp,
        in_channel: u32,
        in_property_id: AudioDevicePropertyID,
        in_property_data_size: u32,
        in_property_data: NonNull<c_void>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Registers the given AudioStreamPropertyListenerProc to receive notifications
    /// when the given property changes.
    ///
    /// Note that the same functionality is provided by AudioObjectAddPropertyListener
    /// in conjunction with AudioObjectPropertyListenerProc.
    ///
    /// Parameter `inStream`: The AudioStream with whom to register the listener.
    ///
    /// Parameter `inChannel`: The channel of the property to listen to.
    ///
    /// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to listen to.
    ///
    /// Parameter `inProc`: AudioStreamPropertyListenerProc to call.
    ///
    /// Parameter `inClientData`: A pointer to client data that is passed to the listener when it is called.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// - `in_proc` must be implemented correctly.
    /// - `in_client_data` must be a valid pointer or null.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioStreamAddPropertyListener(
        in_stream: AudioStreamID,
        in_channel: u32,
        in_property_id: AudioDevicePropertyID,
        in_proc: AudioStreamPropertyListenerProc,
        in_client_data: *mut c_void,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Unregisters the given AudioStreamPropertyListenerProc from receiving
    /// notifications when the given property changes.
    ///
    /// Note that the same functionality is provided by
    /// AudioObjectRemovePropertyListener in conjunction with
    /// AudioObjectPropertyListenerProc.
    ///
    /// Parameter `inStream`: The AudioStream with whom to unregister the listener.
    ///
    /// Parameter `inChannel`: The channel of the property to unregister from.
    ///
    /// Parameter `inPropertyID`: The AudioDevicePropertyID of the property to stop listening to.
    ///
    /// Parameter `inProc`: AudioStreamPropertyListenerProc to unregister.
    ///
    /// Returns: An OSStatus indicating success or failure.
    ///
    /// # Safety
    ///
    /// `in_proc` must be implemented correctly.
    #[cfg(feature = "AudioHardware")]
    #[deprecated]
    pub fn AudioStreamRemovePropertyListener(
        in_stream: AudioStreamID,
        in_channel: u32,
        in_property_id: AudioDevicePropertyID,
        in_proc: AudioStreamPropertyListenerProc,
    ) -> OSStatus;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiobootchimevolumecontrolclassid?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioBootChimeVolumeControlClassID: AudioClassID = 0x7072616d;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudiocontrolpropertyvariant?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioControlPropertyVariant: AudioObjectPropertySelector = 0x63766172;

/// [Apple's documentation](https://developer.apple.com/documentation/coreaudio/kaudioclocksourcecontrolpropertyitemkind?language=objc)
#[cfg(feature = "AudioHardware")]
pub const kAudioClockSourceControlPropertyItemKind: AudioObjectPropertySelector =
    kAudioSelectorControlPropertyItemKind;