objc2_audio_toolbox/generated/
AudioFile.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-audio-types")]
9use objc2_core_audio_types::*;
10#[cfg(feature = "objc2-core-foundation")]
11use objc2_core_foundation::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_album?language=objc)
16pub const kAFInfoDictionary_Album: &CStr =
17    unsafe { CStr::from_bytes_with_nul_unchecked(b"album\0") };
18/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_approximatedurationinseconds?language=objc)
19pub const kAFInfoDictionary_ApproximateDurationInSeconds: &CStr =
20    unsafe { CStr::from_bytes_with_nul_unchecked(b"approximate duration in seconds\0") };
21/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_artist?language=objc)
22pub const kAFInfoDictionary_Artist: &CStr =
23    unsafe { CStr::from_bytes_with_nul_unchecked(b"artist\0") };
24/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_channellayout?language=objc)
25pub const kAFInfoDictionary_ChannelLayout: &CStr =
26    unsafe { CStr::from_bytes_with_nul_unchecked(b"channel layout\0") };
27/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_comments?language=objc)
28pub const kAFInfoDictionary_Comments: &CStr =
29    unsafe { CStr::from_bytes_with_nul_unchecked(b"comments\0") };
30/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_composer?language=objc)
31pub const kAFInfoDictionary_Composer: &CStr =
32    unsafe { CStr::from_bytes_with_nul_unchecked(b"composer\0") };
33/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_copyright?language=objc)
34pub const kAFInfoDictionary_Copyright: &CStr =
35    unsafe { CStr::from_bytes_with_nul_unchecked(b"copyright\0") };
36/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_encodingapplication?language=objc)
37pub const kAFInfoDictionary_EncodingApplication: &CStr =
38    unsafe { CStr::from_bytes_with_nul_unchecked(b"encoding application\0") };
39/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_genre?language=objc)
40pub const kAFInfoDictionary_Genre: &CStr =
41    unsafe { CStr::from_bytes_with_nul_unchecked(b"genre\0") };
42/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_isrc?language=objc)
43pub const kAFInfoDictionary_ISRC: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"ISRC\0") };
44/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_keysignature?language=objc)
45pub const kAFInfoDictionary_KeySignature: &CStr =
46    unsafe { CStr::from_bytes_with_nul_unchecked(b"key signature\0") };
47/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_lyricist?language=objc)
48pub const kAFInfoDictionary_Lyricist: &CStr =
49    unsafe { CStr::from_bytes_with_nul_unchecked(b"lyricist\0") };
50/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_nominalbitrate?language=objc)
51pub const kAFInfoDictionary_NominalBitRate: &CStr =
52    unsafe { CStr::from_bytes_with_nul_unchecked(b"nominal bit rate\0") };
53/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_recordeddate?language=objc)
54pub const kAFInfoDictionary_RecordedDate: &CStr =
55    unsafe { CStr::from_bytes_with_nul_unchecked(b"recorded date\0") };
56/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_sourcebitdepth?language=objc)
57pub const kAFInfoDictionary_SourceBitDepth: &CStr =
58    unsafe { CStr::from_bytes_with_nul_unchecked(b"source bit depth\0") };
59/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_sourceencoder?language=objc)
60pub const kAFInfoDictionary_SourceEncoder: &CStr =
61    unsafe { CStr::from_bytes_with_nul_unchecked(b"source encoder\0") };
62/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_subtitle?language=objc)
63pub const kAFInfoDictionary_SubTitle: &CStr =
64    unsafe { CStr::from_bytes_with_nul_unchecked(b"subtitle\0") };
65/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_tempo?language=objc)
66pub const kAFInfoDictionary_Tempo: &CStr =
67    unsafe { CStr::from_bytes_with_nul_unchecked(b"tempo\0") };
68/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_timesignature?language=objc)
69pub const kAFInfoDictionary_TimeSignature: &CStr =
70    unsafe { CStr::from_bytes_with_nul_unchecked(b"time signature\0") };
71/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_title?language=objc)
72pub const kAFInfoDictionary_Title: &CStr =
73    unsafe { CStr::from_bytes_with_nul_unchecked(b"title\0") };
74/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_tracknumber?language=objc)
75pub const kAFInfoDictionary_TrackNumber: &CStr =
76    unsafe { CStr::from_bytes_with_nul_unchecked(b"track number\0") };
77/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_year?language=objc)
78pub const kAFInfoDictionary_Year: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"year\0") };
79/// Identifier for an audio file type.
80///
81/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofiletypeid?language=objc)
82pub type AudioFileTypeID = u32;
83
84/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileaifftype?language=objc)
85pub const kAudioFileAIFFType: AudioFileTypeID = 0x41494646;
86/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileaifctype?language=objc)
87pub const kAudioFileAIFCType: AudioFileTypeID = 0x41494643;
88/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilewavetype?language=objc)
89pub const kAudioFileWAVEType: AudioFileTypeID = 0x57415645;
90/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilerf64type?language=objc)
91pub const kAudioFileRF64Type: AudioFileTypeID = 0x52463634;
92/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilebw64type?language=objc)
93pub const kAudioFileBW64Type: AudioFileTypeID = 0x42573634;
94/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilewave64type?language=objc)
95pub const kAudioFileWave64Type: AudioFileTypeID = 0x57363466;
96/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilesounddesigner2type?language=objc)
97pub const kAudioFileSoundDesigner2Type: AudioFileTypeID = 0x53643266;
98/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilenexttype?language=objc)
99pub const kAudioFileNextType: AudioFileTypeID = 0x4e655854;
100/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilemp3type?language=objc)
101pub const kAudioFileMP3Type: AudioFileTypeID = 0x4d504733;
102/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilemp2type?language=objc)
103pub const kAudioFileMP2Type: AudioFileTypeID = 0x4d504732;
104/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilemp1type?language=objc)
105pub const kAudioFileMP1Type: AudioFileTypeID = 0x4d504731;
106/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileac3type?language=objc)
107pub const kAudioFileAC3Type: AudioFileTypeID = 0x61632d33;
108/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileaac_adtstype?language=objc)
109pub const kAudioFileAAC_ADTSType: AudioFileTypeID = 0x61647473;
110/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilempeg4type?language=objc)
111pub const kAudioFileMPEG4Type: AudioFileTypeID = 0x6d703466;
112/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilem4atype?language=objc)
113pub const kAudioFileM4AType: AudioFileTypeID = 0x6d346166;
114/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilem4btype?language=objc)
115pub const kAudioFileM4BType: AudioFileTypeID = 0x6d346266;
116/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilecaftype?language=objc)
117pub const kAudioFileCAFType: AudioFileTypeID = 0x63616666;
118/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofile3gptype?language=objc)
119pub const kAudioFile3GPType: AudioFileTypeID = 0x33677070;
120/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofile3gp2type?language=objc)
121pub const kAudioFile3GP2Type: AudioFileTypeID = 0x33677032;
122/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileamrtype?language=objc)
123pub const kAudioFileAMRType: AudioFileTypeID = 0x616d7266;
124/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileflactype?language=objc)
125pub const kAudioFileFLACType: AudioFileTypeID = 0x666c6163;
126/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilelatminloastype?language=objc)
127pub const kAudioFileLATMInLOASType: AudioFileTypeID = 0x6c6f6173;
128
129/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileunspecifiederror?language=objc)
130pub const kAudioFileUnspecifiedError: OSStatus = 0x7768743f;
131/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileunsupportedfiletypeerror?language=objc)
132pub const kAudioFileUnsupportedFileTypeError: OSStatus = 0x7479703f;
133/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileunsupporteddataformaterror?language=objc)
134pub const kAudioFileUnsupportedDataFormatError: OSStatus = 0x666d743f;
135/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileunsupportedpropertyerror?language=objc)
136pub const kAudioFileUnsupportedPropertyError: OSStatus = 0x7074793f;
137/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilebadpropertysizeerror?language=objc)
138pub const kAudioFileBadPropertySizeError: OSStatus = 0x2173697a;
139/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepermissionserror?language=objc)
140pub const kAudioFilePermissionsError: OSStatus = 0x70726d3f;
141/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilenotoptimizederror?language=objc)
142pub const kAudioFileNotOptimizedError: OSStatus = 0x6f70746d;
143/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileinvalidchunkerror?language=objc)
144pub const kAudioFileInvalidChunkError: OSStatus = 0x63686b3f;
145/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofiledoesnotallow64bitdatasizeerror?language=objc)
146pub const kAudioFileDoesNotAllow64BitDataSizeError: OSStatus = 0x6f66663f;
147/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileinvalidpacketoffseterror?language=objc)
148pub const kAudioFileInvalidPacketOffsetError: OSStatus = 0x70636b3f;
149/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileinvalidpacketdependencyerror?language=objc)
150pub const kAudioFileInvalidPacketDependencyError: OSStatus = 0x6465703f;
151/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileinvalidfileerror?language=objc)
152pub const kAudioFileInvalidFileError: OSStatus = 0x6474613f;
153/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileoperationnotsupportederror?language=objc)
154pub const kAudioFileOperationNotSupportedError: OSStatus = 0x6F703F3F;
155/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilenotopenerror?language=objc)
156pub const kAudioFileNotOpenError: OSStatus = -38;
157/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileendoffileerror?language=objc)
158pub const kAudioFileEndOfFileError: OSStatus = -39;
159/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepositionerror?language=objc)
160pub const kAudioFilePositionError: OSStatus = -40;
161/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilefilenotfounderror?language=objc)
162pub const kAudioFileFileNotFoundError: OSStatus = -43;
163
164/// These are flags that can be used with the CreateURL API call
165///
166/// If set, then the CreateURL call will erase the contents of an existing file
167/// If not set, then the CreateURL call will fail if the file already exists
168///
169/// Normally, newly created and optimized files will have padding added in order to page align
170/// the data to 4KB boundaries. This makes reading the data more efficient.
171/// When disk space is a concern, this flag can be set so that the padding will not be added.
172///
173/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileflags?language=objc)
174// NS_OPTIONS
175#[repr(transparent)]
176#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
177pub struct AudioFileFlags(pub u32);
178bitflags::bitflags! {
179    impl AudioFileFlags: u32 {
180        #[doc(alias = "kAudioFileFlags_EraseFile")]
181        const EraseFile = 1;
182        #[doc(alias = "kAudioFileFlags_DontPageAlignAudioData")]
183        const DontPageAlignAudioData = 2;
184    }
185}
186
187unsafe impl Encode for AudioFileFlags {
188    const ENCODING: Encoding = u32::ENCODING;
189}
190
191unsafe impl RefEncode for AudioFileFlags {
192    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
193}
194
195/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilepermissions?language=objc)
196// NS_ENUM
197#[repr(transparent)]
198#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
199pub struct AudioFilePermissions(pub i8);
200impl AudioFilePermissions {
201    #[doc(alias = "kAudioFileReadPermission")]
202    pub const ReadPermission: Self = Self(0x01);
203    #[doc(alias = "kAudioFileWritePermission")]
204    pub const WritePermission: Self = Self(0x02);
205    #[doc(alias = "kAudioFileReadWritePermission")]
206    pub const ReadWritePermission: Self = Self(0x03);
207}
208
209unsafe impl Encode for AudioFilePermissions {
210    const ENCODING: Encoding = i8::ENCODING;
211}
212
213unsafe impl RefEncode for AudioFilePermissions {
214    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
215}
216
217/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/opaqueaudiofileid?language=objc)
218#[repr(C)]
219#[derive(Debug)]
220pub struct OpaqueAudioFileID {
221    inner: [u8; 0],
222    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
223}
224
225unsafe impl RefEncode for OpaqueAudioFileID {
226    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("OpaqueAudioFileID", &[]));
227}
228
229/// An opaque reference to an AudioFile object.
230///
231/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileid?language=objc)
232pub type AudioFileID = *mut OpaqueAudioFileID;
233
234/// A constant for an AudioFile property.
235///
236/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilepropertyid?language=objc)
237pub type AudioFilePropertyID = u32;
238
239/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileloopdirection_nolooping?language=objc)
240pub const kAudioFileLoopDirection_NoLooping: u32 = 0;
241/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileloopdirection_forward?language=objc)
242pub const kAudioFileLoopDirection_Forward: u32 = 1;
243/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileloopdirection_forwardandbackward?language=objc)
244pub const kAudioFileLoopDirection_ForwardAndBackward: u32 = 2;
245/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileloopdirection_backward?language=objc)
246pub const kAudioFileLoopDirection_Backward: u32 = 3;
247
248/// A struct for describing a SMPTE time.
249///
250/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_smpte_time?language=objc)
251#[repr(C)]
252#[derive(Clone, Copy, Debug, PartialEq)]
253pub struct AudioFile_SMPTE_Time {
254    pub mHours: i8,
255    pub mMinutes: u8,
256    pub mSeconds: u8,
257    pub mFrames: u8,
258    pub mSubFrameSampleOffset: u32,
259}
260
261unsafe impl Encode for AudioFile_SMPTE_Time {
262    const ENCODING: Encoding = Encoding::Struct(
263        "AudioFile_SMPTE_Time",
264        &[
265            <i8>::ENCODING,
266            <u8>::ENCODING,
267            <u8>::ENCODING,
268            <u8>::ENCODING,
269            <u32>::ENCODING,
270        ],
271    );
272}
273
274unsafe impl RefEncode for AudioFile_SMPTE_Time {
275    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
276}
277
278/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilemarkertype_generic?language=objc)
279pub const kAudioFileMarkerType_Generic: u32 = 0;
280
281/// A marker annotates a position in an audio file with additional information.
282///
283/// (description)
284///
285/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilemarker?language=objc)
286#[cfg(feature = "objc2-core-foundation")]
287#[repr(C)]
288#[derive(Clone, Copy, Debug, PartialEq)]
289pub struct AudioFileMarker {
290    pub mFramePosition: f64,
291    pub mName: *const CFString,
292    pub mMarkerID: i32,
293    pub mSMPTETime: AudioFile_SMPTE_Time,
294    pub mType: u32,
295    pub mReserved: u16,
296    pub mChannel: u16,
297}
298
299#[cfg(feature = "objc2-core-foundation")]
300unsafe impl Encode for AudioFileMarker {
301    const ENCODING: Encoding = Encoding::Struct(
302        "AudioFileMarker",
303        &[
304            <f64>::ENCODING,
305            <*const CFString>::ENCODING,
306            <i32>::ENCODING,
307            <AudioFile_SMPTE_Time>::ENCODING,
308            <u32>::ENCODING,
309            <u16>::ENCODING,
310            <u16>::ENCODING,
311        ],
312    );
313}
314
315#[cfg(feature = "objc2-core-foundation")]
316unsafe impl RefEncode for AudioFileMarker {
317    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
318}
319
320/// A list of AudioFileMarker.
321///
322/// This defines the SMPTE timing scheme used in the marker list. See CAFFile.h for the values used here.
323///
324/// The number of markers in the mMarkers list.
325///
326/// A list of AudioFileMarker.
327///
328/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilemarkerlist?language=objc)
329#[cfg(feature = "objc2-core-foundation")]
330#[repr(C)]
331#[derive(Clone, Copy, Debug, PartialEq)]
332pub struct AudioFileMarkerList {
333    pub mSMPTE_TimeType: u32,
334    pub mNumberMarkers: u32,
335    pub mMarkers: [AudioFileMarker; 1],
336}
337
338#[cfg(feature = "objc2-core-foundation")]
339unsafe impl Encode for AudioFileMarkerList {
340    const ENCODING: Encoding = Encoding::Struct(
341        "AudioFileMarkerList",
342        &[
343            <u32>::ENCODING,
344            <u32>::ENCODING,
345            <[AudioFileMarker; 1]>::ENCODING,
346        ],
347    );
348}
349
350#[cfg(feature = "objc2-core-foundation")]
351unsafe impl RefEncode for AudioFileMarkerList {
352    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
353}
354
355// TODO: pub fn NumBytesToNumAudioFileMarkers(in_num_bytes: usize,) -> usize;
356
357// TODO: pub fn NumAudioFileMarkersToNumBytes(in_num_markers: usize,) -> usize;
358
359/// These are flags for an AudioFileRegion that specify a playback direction.
360///
361/// One or multiple of these flags can be set. For example, if both kAudioFileRegionFlag_LoopEnable and
362/// kAudioFileRegionFlag_PlayForward are set, then the region will play as a forward loop. If only
363/// kAudioFileRegionFlag_PlayForward is set, then the region will be played forward once.
364///
365/// If this flag is set, the region will be looped. One or both of the following must also be set.
366///
367/// If this flag is set, the region will be played forward.
368///
369/// If this flag is set, the region will be played backward.
370///
371/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileregionflags?language=objc)
372// NS_OPTIONS
373#[repr(transparent)]
374#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
375pub struct AudioFileRegionFlags(pub u32);
376bitflags::bitflags! {
377    impl AudioFileRegionFlags: u32 {
378        #[doc(alias = "kAudioFileRegionFlag_LoopEnable")]
379        const LoopEnable = 1;
380        #[doc(alias = "kAudioFileRegionFlag_PlayForward")]
381        const PlayForward = 2;
382        #[doc(alias = "kAudioFileRegionFlag_PlayBackward")]
383        const PlayBackward = 4;
384    }
385}
386
387unsafe impl Encode for AudioFileRegionFlags {
388    const ENCODING: Encoding = u32::ENCODING;
389}
390
391unsafe impl RefEncode for AudioFileRegionFlags {
392    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
393}
394
395/// An AudioFileRegion specifies a segment of audio data.
396///
397/// Generally a region consists of at least two markers marking the beginning and end of the segment.
398/// There may also be other markers defining other meta information such as sync point.
399///
400/// each region must have a unique ID.
401///
402/// The name of the region.
403///
404/// AudioFileRegionFlags.
405///
406/// The number of markers in the mMarkers array.
407///
408/// A variable length array of AudioFileMarkers.
409///
410/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileregion?language=objc)
411#[cfg(feature = "objc2-core-foundation")]
412#[repr(C)]
413#[derive(Clone, Copy, Debug, PartialEq)]
414pub struct AudioFileRegion {
415    pub mRegionID: u32,
416    pub mName: NonNull<CFString>,
417    pub mFlags: AudioFileRegionFlags,
418    pub mNumberMarkers: u32,
419    pub mMarkers: [AudioFileMarker; 1],
420}
421
422#[cfg(feature = "objc2-core-foundation")]
423unsafe impl Encode for AudioFileRegion {
424    const ENCODING: Encoding = Encoding::Struct(
425        "AudioFileRegion",
426        &[
427            <u32>::ENCODING,
428            <NonNull<CFString>>::ENCODING,
429            <AudioFileRegionFlags>::ENCODING,
430            <u32>::ENCODING,
431            <[AudioFileMarker; 1]>::ENCODING,
432        ],
433    );
434}
435
436#[cfg(feature = "objc2-core-foundation")]
437unsafe impl RefEncode for AudioFileRegion {
438    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
439}
440
441/// A list of the AudioFileRegions in a file.
442///
443/// This is the struct used by the kAudioFilePropertyRegionList property.
444///
445/// This defines the SMPTE timing scheme used in the file. See CAFFile.h for the values used here.
446///
447/// The number of regions in the mRegions list.
448///
449/// A list of AudioFileRegions. Note that AudioFileMarkers are variable length, so this list cannot
450/// be accessed as an array. Use the NextAudioFileRegion macro for traversing the list instead.
451///
452/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileregionlist?language=objc)
453#[cfg(feature = "objc2-core-foundation")]
454#[repr(C)]
455#[derive(Clone, Copy, Debug, PartialEq)]
456pub struct AudioFileRegionList {
457    pub mSMPTE_TimeType: u32,
458    pub mNumberRegions: u32,
459    pub mRegions: [AudioFileRegion; 1],
460}
461
462#[cfg(feature = "objc2-core-foundation")]
463unsafe impl Encode for AudioFileRegionList {
464    const ENCODING: Encoding = Encoding::Struct(
465        "AudioFileRegionList",
466        &[
467            <u32>::ENCODING,
468            <u32>::ENCODING,
469            <[AudioFileRegion; 1]>::ENCODING,
470        ],
471    );
472}
473
474#[cfg(feature = "objc2-core-foundation")]
475unsafe impl RefEncode for AudioFileRegionList {
476    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
477}
478
479// TODO: pub fn NextAudioFileRegion(in_af_region_ptr: NonNull<AudioFileRegion>,)-> Option<NonNull<AudioFileRegion>>;
480
481/// used for properties kAudioFilePropertyPacketToFrame and kAudioFilePropertyFrameToPacket
482///
483/// See description of kAudioFilePropertyPacketToFrame and kAudioFilePropertyFrameToPacket
484///
485/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audioframepackettranslation?language=objc)
486#[repr(C)]
487#[derive(Clone, Copy, Debug, PartialEq)]
488pub struct AudioFramePacketTranslation {
489    pub mFrame: i64,
490    pub mPacket: i64,
491    pub mFrameOffsetInPacket: u32,
492}
493
494unsafe impl Encode for AudioFramePacketTranslation {
495    const ENCODING: Encoding = Encoding::Struct(
496        "AudioFramePacketTranslation",
497        &[<i64>::ENCODING, <i64>::ENCODING, <u32>::ENCODING],
498    );
499}
500
501unsafe impl RefEncode for AudioFramePacketTranslation {
502    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
503}
504
505/// flags for the AudioBytePacketTranslation mFlags field
506///
507/// There is currently only one flag.
508///
509///
510/// If the set then the result value is an estimate.
511///
512/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiobytepackettranslationflags?language=objc)
513// NS_OPTIONS
514#[repr(transparent)]
515#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
516pub struct AudioBytePacketTranslationFlags(pub u32);
517bitflags::bitflags! {
518    impl AudioBytePacketTranslationFlags: u32 {
519        #[doc(alias = "kBytePacketTranslationFlag_IsEstimate")]
520        const BytePacketTranslationFlag_IsEstimate = 1;
521    }
522}
523
524unsafe impl Encode for AudioBytePacketTranslationFlags {
525    const ENCODING: Encoding = u32::ENCODING;
526}
527
528unsafe impl RefEncode for AudioBytePacketTranslationFlags {
529    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
530}
531
532/// used for properties kAudioFileByteToPacket and kAudioFilePacketToByte
533///
534/// See description of kAudioFileByteToPacket and kAudioFilePacketToByte
535///
536/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiobytepackettranslation?language=objc)
537#[repr(C)]
538#[derive(Clone, Copy, Debug, PartialEq)]
539pub struct AudioBytePacketTranslation {
540    pub mByte: i64,
541    pub mPacket: i64,
542    pub mByteOffsetInPacket: u32,
543    pub mFlags: AudioBytePacketTranslationFlags,
544}
545
546unsafe impl Encode for AudioBytePacketTranslation {
547    const ENCODING: Encoding = Encoding::Struct(
548        "AudioBytePacketTranslation",
549        &[
550            <i64>::ENCODING,
551            <i64>::ENCODING,
552            <u32>::ENCODING,
553            <AudioBytePacketTranslationFlags>::ENCODING,
554        ],
555    );
556}
557
558unsafe impl RefEncode for AudioBytePacketTranslation {
559    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
560}
561
562/// This contains information about the number of valid frames in a file and where they begin and end.
563///
564/// Some data formats may have packets whose contents are not completely valid, but represent priming or remainder
565/// frames that are not meant to be played. For example a file with 100 packets of AAC is nominally 1024 * 100 = 102400 frames
566/// of data. However the first 2112 frames of that may be priming frames and there may be some
567/// number of remainder frames added to pad out to a full packet of 1024 frames. The priming and remainder frames should be
568/// discarded. The total number of packets in the file times the frames per packet (or counting each packet's frames
569/// individually for a variable frames per packet format) minus mPrimingFrames, minus mRemainderFrames, should
570/// equal mNumberValidFrames.
571///
572/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilepackettableinfo?language=objc)
573#[repr(C)]
574#[derive(Clone, Copy, Debug, PartialEq)]
575pub struct AudioFilePacketTableInfo {
576    pub mNumberValidFrames: i64,
577    pub mPrimingFrames: i32,
578    pub mRemainderFrames: i32,
579}
580
581unsafe impl Encode for AudioFilePacketTableInfo {
582    const ENCODING: Encoding = Encoding::Struct(
583        "AudioFilePacketTableInfo",
584        &[<i64>::ENCODING, <i32>::ENCODING, <i32>::ENCODING],
585    );
586}
587
588unsafe impl RefEncode for AudioFilePacketTableInfo {
589    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
590}
591
592/// used for property kAudioFilePropertyPacketRangeByteCountUpperBound
593///
594/// See description of kAudioFilePropertyPacketRangeByteCountUpperBound
595///
596/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiopacketrangebytecounttranslation?language=objc)
597#[repr(C)]
598#[derive(Clone, Copy, Debug, PartialEq)]
599pub struct AudioPacketRangeByteCountTranslation {
600    pub mPacket: i64,
601    pub mPacketCount: i64,
602    pub mByteCountUpperBound: i64,
603}
604
605unsafe impl Encode for AudioPacketRangeByteCountTranslation {
606    const ENCODING: Encoding = Encoding::Struct(
607        "AudioPacketRangeByteCountTranslation",
608        &[<i64>::ENCODING, <i64>::ENCODING, <i64>::ENCODING],
609    );
610}
611
612unsafe impl RefEncode for AudioPacketRangeByteCountTranslation {
613    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
614}
615
616/// used for property kAudioFilePropertyPacketToRollDistance
617///
618/// See descriptions of kAudioFilePropertyPacketToRollDistance and kAudioFilePropertyRestrictsRandomAccess
619///
620/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiopacketrolldistancetranslation?language=objc)
621#[repr(C)]
622#[derive(Clone, Copy, Debug, PartialEq)]
623pub struct AudioPacketRollDistanceTranslation {
624    pub mPacket: i64,
625    pub mRollDistance: i64,
626}
627
628unsafe impl Encode for AudioPacketRollDistanceTranslation {
629    const ENCODING: Encoding = Encoding::Struct(
630        "AudioPacketRollDistanceTranslation",
631        &[<i64>::ENCODING, <i64>::ENCODING],
632    );
633}
634
635unsafe impl RefEncode for AudioPacketRollDistanceTranslation {
636    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
637}
638
639/// used for property kAudioFilePropertyPreviousIndependentPacket and kAudioFilePropertyNextIndependentPacket
640///
641/// See descriptions of kAudioFilePropertyPreviousIndependentPacket and kAudioFilePropertyNextIndependentPacket
642///
643/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audioindependentpackettranslation?language=objc)
644#[repr(C)]
645#[derive(Clone, Copy, Debug, PartialEq)]
646pub struct AudioIndependentPacketTranslation {
647    pub mPacket: i64,
648    pub mIndependentlyDecodablePacket: i64,
649}
650
651unsafe impl Encode for AudioIndependentPacketTranslation {
652    const ENCODING: Encoding = Encoding::Struct(
653        "AudioIndependentPacketTranslation",
654        &[<i64>::ENCODING, <i64>::ENCODING],
655    );
656}
657
658unsafe impl RefEncode for AudioIndependentPacketTranslation {
659    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
660}
661
662/// used for property kAudioFilePropertyPacketToDependencyInfo
663///
664/// See descriptions of kAudioFilePropertyPacketToDependencyInfo and kAudioFilePropertyRestrictsRandomAccess
665///
666/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiopacketdependencyinfotranslation?language=objc)
667#[repr(C)]
668#[derive(Clone, Copy, Debug, PartialEq)]
669pub struct AudioPacketDependencyInfoTranslation {
670    pub mPacket: i64,
671    pub mIsIndependentlyDecodable: u32,
672    pub mNumberPrerollPackets: u32,
673}
674
675unsafe impl Encode for AudioPacketDependencyInfoTranslation {
676    const ENCODING: Encoding = Encoding::Struct(
677        "AudioPacketDependencyInfoTranslation",
678        &[<i64>::ENCODING, <u32>::ENCODING, <u32>::ENCODING],
679    );
680}
681
682unsafe impl RefEncode for AudioPacketDependencyInfoTranslation {
683    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
684}
685
686extern "C-unwind" {
687    /// creates a new audio file (or initialises an existing file)
688    ///
689    /// creates a new (or initialises an existing) audio file specified by the URL.
690    /// Upon success, an AudioFileID is returned which can be used for subsequent calls
691    /// to the AudioFile APIs.
692    ///
693    /// Parameter `inFileRef`: an CFURLRef fully specifying the path of the file to create/initialise
694    ///
695    /// Parameter `inFileType`: an AudioFileTypeID indicating the type of audio file to create.
696    ///
697    /// Parameter `inFormat`: an AudioStreamBasicDescription describing the data format that will be
698    /// added to the audio file.
699    ///
700    /// Parameter `inFlags`: relevant flags for creating/opening the file.
701    /// if kAudioFileFlags_EraseFile is set, it will erase an existing file
702    /// if not set, then the Create call will fail if the URL is an existing file
703    ///
704    /// Parameter `outAudioFile`: if successful, an AudioFileID that can be used for subsequent AudioFile calls.
705    ///
706    /// Returns: returns noErr if successful.
707    #[cfg(all(feature = "objc2-core-audio-types", feature = "objc2-core-foundation"))]
708    pub fn AudioFileCreateWithURL(
709        in_file_ref: &CFURL,
710        in_file_type: AudioFileTypeID,
711        in_format: NonNull<AudioStreamBasicDescription>,
712        in_flags: AudioFileFlags,
713        out_audio_file: NonNull<AudioFileID>,
714    ) -> OSStatus;
715}
716
717extern "C-unwind" {
718    /// Open an existing audio file.
719    ///
720    /// Open an existing audio file for reading or reading and writing.
721    ///
722    /// Parameter `inFileRef`: the CFURLRef of an existing audio file.
723    ///
724    /// Parameter `inPermissions`: use the permission constants
725    ///
726    /// Parameter `inFileTypeHint`: For files which have no filename extension and whose type cannot be easily or
727    /// uniquely determined from the data (ADTS,AC3), this hint can be used to indicate the file type.
728    /// Otherwise you can pass zero for this. The hint is only used on OS versions 10.3.1 or greater.
729    /// For OS versions prior to that, opening files of the above description will fail.
730    ///
731    /// Parameter `outAudioFile`: upon success, an AudioFileID that can be used for subsequent
732    /// AudioFile calls.
733    ///
734    /// Returns: returns noErr if successful.
735    #[cfg(feature = "objc2-core-foundation")]
736    pub fn AudioFileOpenURL(
737        in_file_ref: &CFURL,
738        in_permissions: AudioFilePermissions,
739        in_file_type_hint: AudioFileTypeID,
740        out_audio_file: NonNull<AudioFileID>,
741    ) -> OSStatus;
742}
743
744/// A callback for reading data. used with AudioFileOpenWithCallbacks or AudioFileInitializeWithCallbacks.
745///
746/// a function that will be called when AudioFile needs to read data.
747///
748/// Parameter `inClientData`: A pointer to the client data as set in the inClientData parameter to AudioFileXXXWithCallbacks.
749///
750/// Parameter `inPosition`: An offset into the data from which to read.
751///
752/// Parameter `requestCount`: The number of bytes to read.
753///
754/// Parameter `buffer`: The buffer in which to put the data read.
755///
756/// Parameter `actualCount`: The callback should set this to the number of bytes successfully read.
757///
758/// Returns: The callback should return noErr on success, or an appropriate error code on failure.
759///
760/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_readproc?language=objc)
761pub type AudioFile_ReadProc = Option<
762    unsafe extern "C-unwind" fn(
763        NonNull<c_void>,
764        i64,
765        u32,
766        NonNull<c_void>,
767        NonNull<u32>,
768    ) -> OSStatus,
769>;
770
771/// A callback for writing data. used with AudioFileOpenWithCallbacks or AudioFileInitializeWithCallbacks.
772///
773/// a function that will be called when AudioFile needs to write data.
774///
775/// Parameter `inClientData`: A pointer to the client data as set in the inClientData parameter to AudioFileXXXWithCallbacks.
776///
777/// Parameter `inPosition`: An offset into the data from which to read.
778///
779/// Parameter `requestCount`: The number of bytes to write.
780///
781/// Parameter `buffer`: The buffer containing the data to write.
782///
783/// Parameter `actualCount`: The callback should set this to the number of bytes successfully written.
784///
785/// Returns: The callback should return noErr on success, or an appropriate error code on failure.
786///
787/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_writeproc?language=objc)
788pub type AudioFile_WriteProc = Option<
789    unsafe extern "C-unwind" fn(
790        NonNull<c_void>,
791        i64,
792        u32,
793        NonNull<c_void>,
794        NonNull<u32>,
795    ) -> OSStatus,
796>;
797
798/// A callback for getting the size of the file data. used with AudioFileOpenWithCallbacks or AudioFileInitializeWithCallbacks.
799///
800/// a function that will be called when AudioFile needs to determine the size of the file data. This size is for all of the
801/// data in the file, not just the audio data.
802///
803/// Parameter `inClientData`: A pointer to the client data as set in the inClientData parameter to AudioFileXXXWithCallbacks.
804///
805/// Returns: The callback should return the size of the data.
806///
807/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_getsizeproc?language=objc)
808pub type AudioFile_GetSizeProc = Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> i64>;
809
810/// A callback for setting the size of the file data. used with AudioFileOpenWithCallbacks or AudioFileInitializeWithCallbacks.
811///
812/// a function that will be called when AudioFile needs to set the size of the file data. This size is for all of the
813/// data in the file, not just the audio data. This will only be called if the file is written to.
814///
815/// Parameter `inClientData`: A pointer to the client data as set in the inClientData parameter to AudioFileXXXWithCallbacks.
816///
817/// Returns: The callback should return the size of the data.
818///
819/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_setsizeproc?language=objc)
820pub type AudioFile_SetSizeProc =
821    Option<unsafe extern "C-unwind" fn(NonNull<c_void>, i64) -> OSStatus>;
822
823extern "C-unwind" {
824    /// Wipe clean an existing file. You provide callbacks that the AudioFile API
825    /// will use to get the data.
826    ///
827    /// Parameter `inClientData`: a constant that will be passed to your callbacks.
828    ///
829    /// Parameter `inReadFunc`: a function that will be called when AudioFile needs to read data.
830    ///
831    /// Parameter `inWriteFunc`: a function that will be called when AudioFile needs to write data.
832    ///
833    /// Parameter `inGetSizeFunc`: a function that will be called when AudioFile needs to know the file size.
834    ///
835    /// Parameter `inSetSizeFunc`: a function that will be called when AudioFile needs to set the file size.
836    ///
837    ///
838    /// Parameter `inFileType`: an AudioFileTypeID indicating the type of audio file to which to initialize the file.
839    ///
840    /// Parameter `inFormat`: an AudioStreamBasicDescription describing the data format that will be
841    /// added to the audio file.
842    ///
843    /// Parameter `inFlags`: flags for creating/opening the file. Currently zero.
844    ///
845    /// Parameter `outAudioFile`: upon success, an AudioFileID that can be used for subsequent
846    /// AudioFile calls.
847    ///
848    /// Returns: returns noErr if successful.
849    #[cfg(feature = "objc2-core-audio-types")]
850    pub fn AudioFileInitializeWithCallbacks(
851        in_client_data: NonNull<c_void>,
852        in_read_func: AudioFile_ReadProc,
853        in_write_func: AudioFile_WriteProc,
854        in_get_size_func: AudioFile_GetSizeProc,
855        in_set_size_func: AudioFile_SetSizeProc,
856        in_file_type: AudioFileTypeID,
857        in_format: NonNull<AudioStreamBasicDescription>,
858        in_flags: AudioFileFlags,
859        out_audio_file: NonNull<AudioFileID>,
860    ) -> OSStatus;
861}
862
863extern "C-unwind" {
864    /// Open an existing file. You provide callbacks that the AudioFile API
865    /// will use to get the data.
866    ///
867    /// Parameter `inClientData`: a constant that will be passed to your callbacks.
868    ///
869    /// Parameter `inReadFunc`: a function that will be called when AudioFile needs to read data.
870    ///
871    /// Parameter `inWriteFunc`: a function that will be called when AudioFile needs to write data.
872    ///
873    /// Parameter `inGetSizeFunc`: a function that will be called when AudioFile needs to know the total file size.
874    ///
875    /// Parameter `inSetSizeFunc`: a function that will be called when AudioFile needs to set the file size.
876    ///
877    ///
878    /// Parameter `inFileTypeHint`: For files which have no filename extension and whose type cannot be easily or
879    /// uniquely determined from the data (ADTS,AC3), this hint can be used to indicate the file type.
880    /// Otherwise you can pass zero for this. The hint is only used on OS versions 10.3.1 or greater.
881    /// For OS versions prior to that, opening files of the above description will fail.
882    ///
883    /// Parameter `outAudioFile`: upon success, an AudioFileID that can be used for subsequent
884    /// AudioFile calls.
885    ///
886    /// Returns: returns noErr if successful.
887    pub fn AudioFileOpenWithCallbacks(
888        in_client_data: NonNull<c_void>,
889        in_read_func: AudioFile_ReadProc,
890        in_write_func: AudioFile_WriteProc,
891        in_get_size_func: AudioFile_GetSizeProc,
892        in_set_size_func: AudioFile_SetSizeProc,
893        in_file_type_hint: AudioFileTypeID,
894        out_audio_file: NonNull<AudioFileID>,
895    ) -> OSStatus;
896}
897
898extern "C-unwind" {
899    /// Close an existing audio file.
900    ///
901    /// Parameter `inAudioFile`: an AudioFileID.
902    ///
903    /// Returns: returns noErr if successful.
904    pub fn AudioFileClose(in_audio_file: AudioFileID) -> OSStatus;
905}
906
907extern "C-unwind" {
908    /// Move the audio data to the end of the file and other internal optimizations of the file structure.
909    ///
910    /// Optimize the file so additional audio data can be appended to
911    /// the existing data. Generally, this will place the audio data at
912    /// the end of the file so additional writes can be placed to the
913    /// file end. This can be a potentially expensive and time-consuming operation
914    /// and should not be used during time critical operations. There is
915    /// a kAudioFilePropertyIsOptimized property for checking on the optimized state
916    /// of the file.
917    ///
918    /// Parameter `inAudioFile`: an AudioFileID.
919    ///
920    /// Returns: returns noErr if successful.
921    pub fn AudioFileOptimize(in_audio_file: AudioFileID) -> OSStatus;
922}
923
924/// Read bytes of audio data from the audio file.
925///
926///
927/// Returns kAudioFileEndOfFileError when read encounters end of file.
928///
929/// Parameter `inAudioFile`: an AudioFileID.
930///
931/// Parameter `inUseCache`: true if it is desired to cache the data upon read, else false
932///
933/// Parameter `inStartingByte`: the byte offset of the audio data desired to be returned
934///
935/// Parameter `ioNumBytes`: on input, the number of bytes to read, on output, the number of
936/// bytes actually read.
937///
938/// Parameter `outBuffer`: outBuffer should be a void * to user allocated memory large enough for the requested bytes.
939///
940/// Returns: returns noErr if successful.
941#[inline]
942pub unsafe extern "C-unwind" fn AudioFileReadBytes(
943    in_audio_file: AudioFileID,
944    in_use_cache: bool,
945    in_starting_byte: i64,
946    io_num_bytes: NonNull<u32>,
947    out_buffer: NonNull<c_void>,
948) -> OSStatus {
949    extern "C-unwind" {
950        fn AudioFileReadBytes(
951            in_audio_file: AudioFileID,
952            in_use_cache: Boolean,
953            in_starting_byte: i64,
954            io_num_bytes: NonNull<u32>,
955            out_buffer: NonNull<c_void>,
956        ) -> OSStatus;
957    }
958    unsafe {
959        AudioFileReadBytes(
960            in_audio_file,
961            in_use_cache as _,
962            in_starting_byte,
963            io_num_bytes,
964            out_buffer,
965        )
966    }
967}
968
969/// Write bytes of audio data to the audio file.
970///
971/// Parameter `inAudioFile`: an AudioFileID.
972///
973/// Parameter `inUseCache`: true if it is desired to cache the data upon write, else false
974///
975/// Parameter `inStartingByte`: the byte offset where the audio data should be written
976///
977/// Parameter `ioNumBytes`: on input, the number of bytes to write, on output, the number of
978/// bytes actually written.
979///
980/// Parameter `inBuffer`: inBuffer should be a void * containing the bytes to be written
981///
982/// Returns: returns noErr if successful.
983#[inline]
984pub unsafe extern "C-unwind" fn AudioFileWriteBytes(
985    in_audio_file: AudioFileID,
986    in_use_cache: bool,
987    in_starting_byte: i64,
988    io_num_bytes: NonNull<u32>,
989    in_buffer: NonNull<c_void>,
990) -> OSStatus {
991    extern "C-unwind" {
992        fn AudioFileWriteBytes(
993            in_audio_file: AudioFileID,
994            in_use_cache: Boolean,
995            in_starting_byte: i64,
996            io_num_bytes: NonNull<u32>,
997            in_buffer: NonNull<c_void>,
998        ) -> OSStatus;
999    }
1000    unsafe {
1001        AudioFileWriteBytes(
1002            in_audio_file,
1003            in_use_cache as _,
1004            in_starting_byte,
1005            io_num_bytes,
1006            in_buffer,
1007        )
1008    }
1009}
1010
1011/// Read packets of audio data from the audio file.
1012///
1013/// AudioFileReadPacketData reads as many of the requested number of packets
1014/// as will fit in the buffer size given by ioNumPackets.
1015/// Unlike the deprecated AudioFileReadPackets, ioNumPackets must be initialized.
1016/// If the byte size of the number packets requested is
1017/// less than the buffer size, ioNumBytes will be reduced.
1018/// If the buffer is too small for the number of packets
1019/// requested, ioNumPackets and ioNumBytes will be reduced
1020/// to the number of packets that can be accommodated and their byte size.
1021/// Returns kAudioFileEndOfFileError when read encounters end of file.
1022/// For all uncompressed formats, packets == frames.
1023///
1024///
1025/// Parameter `inAudioFile`: an AudioFileID.
1026///
1027/// Parameter `inUseCache`: true if it is desired to cache the data upon read, else false
1028///
1029/// Parameter `ioNumBytes`: on input the size of outBuffer in bytes.
1030/// on output, the number of bytes actually returned.
1031///
1032/// Parameter `outPacketDescriptions`: An array of packet descriptions describing the packets being returned.
1033/// The size of the array must be greater or equal to the number of packets requested.
1034/// On return the packet description will be filled out with the packet offsets and sizes.
1035/// Packet descriptions are ignored for CBR data.
1036///
1037/// Parameter `inStartingPacket`: The packet index of the first packet desired to be returned
1038///
1039/// Parameter `ioNumPackets`: on input, the number of packets to read, on output, the number of
1040/// packets actually read.
1041///
1042/// Parameter `outBuffer`: outBuffer should be a pointer to user allocated memory.
1043///
1044/// Returns: returns noErr if successful.
1045#[cfg(feature = "objc2-core-audio-types")]
1046#[inline]
1047pub unsafe extern "C-unwind" fn AudioFileReadPacketData(
1048    in_audio_file: AudioFileID,
1049    in_use_cache: bool,
1050    io_num_bytes: NonNull<u32>,
1051    out_packet_descriptions: *mut AudioStreamPacketDescription,
1052    in_starting_packet: i64,
1053    io_num_packets: NonNull<u32>,
1054    out_buffer: *mut c_void,
1055) -> OSStatus {
1056    extern "C-unwind" {
1057        fn AudioFileReadPacketData(
1058            in_audio_file: AudioFileID,
1059            in_use_cache: Boolean,
1060            io_num_bytes: NonNull<u32>,
1061            out_packet_descriptions: *mut AudioStreamPacketDescription,
1062            in_starting_packet: i64,
1063            io_num_packets: NonNull<u32>,
1064            out_buffer: *mut c_void,
1065        ) -> OSStatus;
1066    }
1067    unsafe {
1068        AudioFileReadPacketData(
1069            in_audio_file,
1070            in_use_cache as _,
1071            io_num_bytes,
1072            out_packet_descriptions,
1073            in_starting_packet,
1074            io_num_packets,
1075            out_buffer,
1076        )
1077    }
1078}
1079
1080/// Read packets of audio data from the audio file.
1081///
1082/// AudioFileReadPackets is DEPRECATED. Use AudioFileReadPacketData instead.
1083/// READ THE HEADER DOC FOR AudioFileReadPacketData. It is not a drop-in replacement.
1084/// In particular, for AudioFileReadPacketData ioNumBytes must be initialized to the buffer size.
1085/// AudioFileReadPackets assumes you have allocated your buffer to ioNumPackets times the maximum packet size.
1086/// For many compressed formats this will only use a portion of the buffer since the ratio of the maximum
1087/// packet size to the typical packet size can be large. Use AudioFileReadPacketData instead.
1088///
1089///
1090/// Parameter `inAudioFile`: an AudioFileID.
1091///
1092/// Parameter `inUseCache`: true if it is desired to cache the data upon read, else false
1093///
1094/// Parameter `outNumBytes`: on output, the number of bytes actually returned
1095///
1096/// Parameter `outPacketDescriptions`: on output, an array of packet descriptions describing
1097/// the packets being returned. NULL may be passed for this
1098/// parameter. Nothing will be returned for linear pcm data.
1099///
1100/// Parameter `inStartingPacket`: the packet index of the first packet desired to be returned
1101///
1102/// Parameter `ioNumPackets`: on input, the number of packets to read, on output, the number of
1103/// packets actually read.
1104///
1105/// Parameter `outBuffer`: outBuffer should be a pointer to user allocated memory of size:
1106/// number of packets requested times file's maximum (or upper bound on)
1107/// packet size.
1108///
1109/// Returns: returns noErr if successful.
1110#[cfg(feature = "objc2-core-audio-types")]
1111#[deprecated = "no longer supported"]
1112#[inline]
1113pub unsafe extern "C-unwind" fn AudioFileReadPackets(
1114    in_audio_file: AudioFileID,
1115    in_use_cache: bool,
1116    out_num_bytes: NonNull<u32>,
1117    out_packet_descriptions: *mut AudioStreamPacketDescription,
1118    in_starting_packet: i64,
1119    io_num_packets: NonNull<u32>,
1120    out_buffer: *mut c_void,
1121) -> OSStatus {
1122    extern "C-unwind" {
1123        fn AudioFileReadPackets(
1124            in_audio_file: AudioFileID,
1125            in_use_cache: Boolean,
1126            out_num_bytes: NonNull<u32>,
1127            out_packet_descriptions: *mut AudioStreamPacketDescription,
1128            in_starting_packet: i64,
1129            io_num_packets: NonNull<u32>,
1130            out_buffer: *mut c_void,
1131        ) -> OSStatus;
1132    }
1133    unsafe {
1134        AudioFileReadPackets(
1135            in_audio_file,
1136            in_use_cache as _,
1137            out_num_bytes,
1138            out_packet_descriptions,
1139            in_starting_packet,
1140            io_num_packets,
1141            out_buffer,
1142        )
1143    }
1144}
1145
1146/// Write packets of audio data to the audio file.
1147///
1148/// For all uncompressed formats, packets == frames.
1149///
1150/// Parameter `inAudioFile`: an AudioFileID.
1151///
1152/// Parameter `inUseCache`: true if it is desired to cache the data upon write, else false
1153///
1154/// Parameter `inNumBytes`: the number of bytes being provided for write
1155///
1156/// Parameter `inPacketDescriptions`: an array of packet descriptions describing the packets being
1157/// provided. Not all formats require packet descriptions to be
1158/// provided. NULL may be passed if no descriptions are required.
1159///
1160/// Parameter `inStartingPacket`: the packet index of where the first packet provided should be placed.
1161///
1162/// Parameter `ioNumPackets`: on input, the number of packets to write, on output, the number of
1163/// packets actually written.
1164///
1165/// Parameter `inBuffer`: a void * to user allocated memory containing the packets to write.
1166///
1167/// Returns: returns noErr if successful.
1168#[cfg(feature = "objc2-core-audio-types")]
1169#[inline]
1170pub unsafe extern "C-unwind" fn AudioFileWritePackets(
1171    in_audio_file: AudioFileID,
1172    in_use_cache: bool,
1173    in_num_bytes: u32,
1174    in_packet_descriptions: *const AudioStreamPacketDescription,
1175    in_starting_packet: i64,
1176    io_num_packets: NonNull<u32>,
1177    in_buffer: NonNull<c_void>,
1178) -> OSStatus {
1179    extern "C-unwind" {
1180        fn AudioFileWritePackets(
1181            in_audio_file: AudioFileID,
1182            in_use_cache: Boolean,
1183            in_num_bytes: u32,
1184            in_packet_descriptions: *const AudioStreamPacketDescription,
1185            in_starting_packet: i64,
1186            io_num_packets: NonNull<u32>,
1187            in_buffer: NonNull<c_void>,
1188        ) -> OSStatus;
1189    }
1190    unsafe {
1191        AudioFileWritePackets(
1192            in_audio_file,
1193            in_use_cache as _,
1194            in_num_bytes,
1195            in_packet_descriptions,
1196            in_starting_packet,
1197            io_num_packets,
1198            in_buffer,
1199        )
1200    }
1201}
1202
1203extern "C-unwind" {
1204    /// Get the number of user data items with a certain ID in the file
1205    ///
1206    /// "User Data" refers to chunks in AIFF, CAF and WAVE files, or resources
1207    /// in Sound Designer II files, and possibly other things in other files.
1208    /// For simplicity, referred to below as "chunks".
1209    ///
1210    /// Parameter `inAudioFile`: an AudioFileID.
1211    ///
1212    /// Parameter `inUserDataID`: the four char code of the chunk.
1213    ///
1214    /// Parameter `outNumberItems`: on output, if successful, number of chunks of this type in the file.
1215    ///
1216    /// Returns: returns noErr if successful.
1217    pub fn AudioFileCountUserData(
1218        in_audio_file: AudioFileID,
1219        in_user_data_id: u32,
1220        out_number_items: NonNull<u32>,
1221    ) -> OSStatus;
1222}
1223
1224extern "C-unwind" {
1225    /// Get the size of user data in a file
1226    ///
1227    /// Parameter `inAudioFile`: an AudioFileID.
1228    ///
1229    /// Parameter `inUserDataID`: the four char code of the chunk.
1230    ///
1231    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1232    ///
1233    /// Parameter `outUserDataSize`: on output, if successful, the size of the user data chunk.
1234    ///
1235    /// Returns: returns noErr if successful.
1236    pub fn AudioFileGetUserDataSize(
1237        in_audio_file: AudioFileID,
1238        in_user_data_id: u32,
1239        in_index: u32,
1240        out_user_data_size: NonNull<u32>,
1241    ) -> OSStatus;
1242}
1243
1244extern "C-unwind" {
1245    /// Get the 64-bit size of user data in a file
1246    ///
1247    /// Parameter `inAudioFile`: an AudioFileID.
1248    ///
1249    /// Parameter `inUserDataID`: the four char code of the chunk.
1250    ///
1251    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1252    ///
1253    /// Parameter `outUserDataSize`: on output, if successful, the size of the user data chunk.
1254    ///
1255    /// Returns: returns noErr if successful.
1256    pub fn AudioFileGetUserDataSize64(
1257        in_audio_file: AudioFileID,
1258        in_user_data_id: u32,
1259        in_index: u32,
1260        out_user_data_size: NonNull<u64>,
1261    ) -> OSStatus;
1262}
1263
1264extern "C-unwind" {
1265    /// Get the data of a chunk in a file.
1266    ///
1267    /// Parameter `inAudioFile`: an AudioFileID.
1268    ///
1269    /// Parameter `inUserDataID`: the four char code of the chunk.
1270    ///
1271    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1272    ///
1273    /// Parameter `ioUserDataSize`: the size of the buffer on input, size of bytes copied to buffer on output
1274    ///
1275    /// Parameter `outUserData`: a pointer to a buffer in which to copy the chunk data.
1276    ///
1277    /// Returns: returns noErr if successful.
1278    pub fn AudioFileGetUserData(
1279        in_audio_file: AudioFileID,
1280        in_user_data_id: u32,
1281        in_index: u32,
1282        io_user_data_size: NonNull<u32>,
1283        out_user_data: NonNull<c_void>,
1284    ) -> OSStatus;
1285}
1286
1287extern "C-unwind" {
1288    /// Get a part of the data of a chunk in a file.
1289    ///
1290    /// Parameter `inAudioFile`: an AudioFileID.
1291    ///
1292    /// Parameter `inUserDataID`: the four char code of the chunk.
1293    ///
1294    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1295    ///
1296    /// Parameter `inOffset`: offset from the first byte of the chunk to the first byte to get.
1297    ///
1298    /// Parameter `ioUserDataSize`: the size of the buffer on input, size of bytes copied to buffer on output
1299    ///
1300    /// Parameter `outUserData`: a pointer to a buffer in which to copy the chunk data.
1301    ///
1302    /// Returns: returns noErr if successful.
1303    pub fn AudioFileGetUserDataAtOffset(
1304        in_audio_file: AudioFileID,
1305        in_user_data_id: u32,
1306        in_index: u32,
1307        in_offset: i64,
1308        io_user_data_size: NonNull<u32>,
1309        out_user_data: NonNull<c_void>,
1310    ) -> OSStatus;
1311}
1312
1313extern "C-unwind" {
1314    /// Set the data of a chunk in a file.
1315    ///
1316    /// Parameter `inAudioFile`: an AudioFileID.
1317    ///
1318    /// Parameter `inUserDataID`: the four char code of the chunk.
1319    ///
1320    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1321    ///
1322    /// Parameter `inUserDataSize`: on input the size of the data to copy, on output, size of bytes copied from the buffer
1323    ///
1324    /// Parameter `inUserData`: a pointer to a buffer from which to copy the chunk data
1325    /// (only the contents of the chunk, not including the chunk header).
1326    ///
1327    /// Returns: returns noErr if successful.
1328    pub fn AudioFileSetUserData(
1329        in_audio_file: AudioFileID,
1330        in_user_data_id: u32,
1331        in_index: u32,
1332        in_user_data_size: u32,
1333        in_user_data: NonNull<c_void>,
1334    ) -> OSStatus;
1335}
1336
1337extern "C-unwind" {
1338    /// Remove a user chunk in a file.
1339    ///
1340    /// Parameter `inAudioFile`: an AudioFileID.
1341    ///
1342    /// Parameter `inUserDataID`: the four char code of the chunk.
1343    ///
1344    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1345    ///
1346    /// Returns: returns noErr if successful.
1347    pub fn AudioFileRemoveUserData(
1348        in_audio_file: AudioFileID,
1349        in_user_data_id: u32,
1350        in_index: u32,
1351    ) -> OSStatus;
1352}
1353
1354/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyfileformat?language=objc)
1355pub const kAudioFilePropertyFileFormat: AudioFilePropertyID = 0x66666d74;
1356/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertydataformat?language=objc)
1357pub const kAudioFilePropertyDataFormat: AudioFilePropertyID = 0x64666d74;
1358/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyisoptimized?language=objc)
1359pub const kAudioFilePropertyIsOptimized: AudioFilePropertyID = 0x6f70746d;
1360/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertymagiccookiedata?language=objc)
1361pub const kAudioFilePropertyMagicCookieData: AudioFilePropertyID = 0x6d676963;
1362/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyaudiodatabytecount?language=objc)
1363pub const kAudioFilePropertyAudioDataByteCount: AudioFilePropertyID = 0x62636e74;
1364/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyaudiodatapacketcount?language=objc)
1365pub const kAudioFilePropertyAudioDataPacketCount: AudioFilePropertyID = 0x70636e74;
1366/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertymaximumpacketsize?language=objc)
1367pub const kAudioFilePropertyMaximumPacketSize: AudioFilePropertyID = 0x70737a65;
1368/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertydataoffset?language=objc)
1369pub const kAudioFilePropertyDataOffset: AudioFilePropertyID = 0x646f6666;
1370/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertychannellayout?language=objc)
1371pub const kAudioFilePropertyChannelLayout: AudioFilePropertyID = 0x636d6170;
1372/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertydefersizeupdates?language=objc)
1373pub const kAudioFilePropertyDeferSizeUpdates: AudioFilePropertyID = 0x64737a75;
1374/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertydataformatname?language=objc)
1375pub const kAudioFilePropertyDataFormatName: AudioFilePropertyID = 0x666e6d65;
1376/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertymarkerlist?language=objc)
1377pub const kAudioFilePropertyMarkerList: AudioFilePropertyID = 0x6d6b6c73;
1378/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyregionlist?language=objc)
1379pub const kAudioFilePropertyRegionList: AudioFilePropertyID = 0x72676c73;
1380/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettoframe?language=objc)
1381pub const kAudioFilePropertyPacketToFrame: AudioFilePropertyID = 0x706b6672;
1382/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyframetopacket?language=objc)
1383pub const kAudioFilePropertyFrameToPacket: AudioFilePropertyID = 0x6672706b;
1384/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyrestrictsrandomaccess?language=objc)
1385pub const kAudioFilePropertyRestrictsRandomAccess: AudioFilePropertyID = 0x72726170;
1386/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettorolldistance?language=objc)
1387pub const kAudioFilePropertyPacketToRollDistance: AudioFilePropertyID = 0x706b726c;
1388/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypreviousindependentpacket?language=objc)
1389pub const kAudioFilePropertyPreviousIndependentPacket: AudioFilePropertyID = 0x70696e64;
1390/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertynextindependentpacket?language=objc)
1391pub const kAudioFilePropertyNextIndependentPacket: AudioFilePropertyID = 0x6e696e64;
1392/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettodependencyinfo?language=objc)
1393pub const kAudioFilePropertyPacketToDependencyInfo: AudioFilePropertyID = 0x706b6470;
1394/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettobyte?language=objc)
1395pub const kAudioFilePropertyPacketToByte: AudioFilePropertyID = 0x706b6279;
1396/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertybytetopacket?language=objc)
1397pub const kAudioFilePropertyByteToPacket: AudioFilePropertyID = 0x6279706b;
1398/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertychunkids?language=objc)
1399pub const kAudioFilePropertyChunkIDs: AudioFilePropertyID = 0x63686964;
1400/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyinfodictionary?language=objc)
1401pub const kAudioFilePropertyInfoDictionary: AudioFilePropertyID = 0x696e666f;
1402/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettableinfo?language=objc)
1403pub const kAudioFilePropertyPacketTableInfo: AudioFilePropertyID = 0x706e666f;
1404/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyformatlist?language=objc)
1405pub const kAudioFilePropertyFormatList: AudioFilePropertyID = 0x666c7374;
1406/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypacketsizeupperbound?language=objc)
1407pub const kAudioFilePropertyPacketSizeUpperBound: AudioFilePropertyID = 0x706b7562;
1408/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypacketrangebytecountupperbound?language=objc)
1409pub const kAudioFilePropertyPacketRangeByteCountUpperBound: AudioFilePropertyID = 0x70727562;
1410/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyreserveduration?language=objc)
1411pub const kAudioFilePropertyReserveDuration: AudioFilePropertyID = 0x72737276;
1412/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyestimatedduration?language=objc)
1413pub const kAudioFilePropertyEstimatedDuration: AudioFilePropertyID = 0x65647572;
1414/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertybitrate?language=objc)
1415pub const kAudioFilePropertyBitRate: AudioFilePropertyID = 0x62726174;
1416/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyid3tag?language=objc)
1417pub const kAudioFilePropertyID3Tag: AudioFilePropertyID = 0x69643374;
1418/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyid3tagoffset?language=objc)
1419pub const kAudioFilePropertyID3TagOffset: AudioFilePropertyID = 0x6964336f;
1420/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertysourcebitdepth?language=objc)
1421pub const kAudioFilePropertySourceBitDepth: AudioFilePropertyID = 0x73627464;
1422/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyalbumartwork?language=objc)
1423pub const kAudioFilePropertyAlbumArtwork: AudioFilePropertyID = 0x61617274;
1424/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyaudiotrackcount?language=objc)
1425pub const kAudioFilePropertyAudioTrackCount: AudioFilePropertyID = 0x61746374;
1426/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyuseaudiotrack?language=objc)
1427pub const kAudioFilePropertyUseAudioTrack: AudioFilePropertyID = 0x7561746b;
1428
1429extern "C-unwind" {
1430    /// Get information about the size of a property of an AudioFile  and whether it can be set.
1431    ///
1432    /// Parameter `inAudioFile`: an AudioFileID.
1433    ///
1434    /// Parameter `inPropertyID`: an AudioFileProperty constant.
1435    ///
1436    /// Parameter `outDataSize`: the size in bytes of the current value of the property. In order to get the property value,
1437    /// you will need a buffer of this size.
1438    ///
1439    /// Parameter `isWritable`: will be set to 1 if writable, or 0 if read only.
1440    ///
1441    /// Returns: returns noErr if successful.
1442    pub fn AudioFileGetPropertyInfo(
1443        in_audio_file: AudioFileID,
1444        in_property_id: AudioFilePropertyID,
1445        out_data_size: *mut u32,
1446        is_writable: *mut u32,
1447    ) -> OSStatus;
1448}
1449
1450extern "C-unwind" {
1451    /// Copies the value for a property of an AudioFile into a buffer.
1452    ///
1453    /// Parameter `inAudioFile`: an AudioFileID.
1454    ///
1455    /// Parameter `inPropertyID`: an AudioFileProperty constant.
1456    ///
1457    /// Parameter `ioDataSize`: on input the size of the outPropertyData buffer. On output the number of bytes written to the buffer.
1458    ///
1459    /// Parameter `outPropertyData`: the buffer in which to write the property data.
1460    ///
1461    /// Returns: returns noErr if successful.
1462    pub fn AudioFileGetProperty(
1463        in_audio_file: AudioFileID,
1464        in_property_id: AudioFilePropertyID,
1465        io_data_size: NonNull<u32>,
1466        out_property_data: NonNull<c_void>,
1467    ) -> OSStatus;
1468}
1469
1470extern "C-unwind" {
1471    /// Sets the value for a property of an AudioFile .
1472    ///
1473    /// Parameter `inAudioFile`: an AudioFileID.
1474    ///
1475    /// Parameter `inPropertyID`: an AudioFileProperty constant.
1476    ///
1477    /// Parameter `inDataSize`: the size of the property data.
1478    ///
1479    /// Parameter `inPropertyData`: the buffer containing the property data.
1480    ///
1481    /// Returns: returns noErr if successful.
1482    pub fn AudioFileSetProperty(
1483        in_audio_file: AudioFileID,
1484        in_property_id: AudioFilePropertyID,
1485        in_data_size: u32,
1486        in_property_data: NonNull<c_void>,
1487    ) -> OSStatus;
1488}
1489
1490/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_readabletypes?language=objc)
1491pub const kAudioFileGlobalInfo_ReadableTypes: AudioFilePropertyID = 0x61667266;
1492/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_writabletypes?language=objc)
1493pub const kAudioFileGlobalInfo_WritableTypes: AudioFilePropertyID = 0x61667766;
1494/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_filetypename?language=objc)
1495pub const kAudioFileGlobalInfo_FileTypeName: AudioFilePropertyID = 0x66746e6d;
1496/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_availablestreamdescriptionsforformat?language=objc)
1497pub const kAudioFileGlobalInfo_AvailableStreamDescriptionsForFormat: AudioFilePropertyID =
1498    0x73646964;
1499/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_availableformatids?language=objc)
1500pub const kAudioFileGlobalInfo_AvailableFormatIDs: AudioFilePropertyID = 0x666d6964;
1501/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_allextensions?language=objc)
1502pub const kAudioFileGlobalInfo_AllExtensions: AudioFilePropertyID = 0x616c7874;
1503/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_allhfstypecodes?language=objc)
1504pub const kAudioFileGlobalInfo_AllHFSTypeCodes: AudioFilePropertyID = 0x61686673;
1505/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_allutis?language=objc)
1506pub const kAudioFileGlobalInfo_AllUTIs: AudioFilePropertyID = 0x61757469;
1507/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_allmimetypes?language=objc)
1508pub const kAudioFileGlobalInfo_AllMIMETypes: AudioFilePropertyID = 0x616d696d;
1509/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_extensionsfortype?language=objc)
1510pub const kAudioFileGlobalInfo_ExtensionsForType: AudioFilePropertyID = 0x66657874;
1511/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_hfstypecodesfortype?language=objc)
1512pub const kAudioFileGlobalInfo_HFSTypeCodesForType: AudioFilePropertyID = 0x66686673;
1513/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_utisfortype?language=objc)
1514pub const kAudioFileGlobalInfo_UTIsForType: AudioFilePropertyID = 0x66757469;
1515/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_mimetypesfortype?language=objc)
1516pub const kAudioFileGlobalInfo_MIMETypesForType: AudioFilePropertyID = 0x666d696d;
1517/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_typesformimetype?language=objc)
1518pub const kAudioFileGlobalInfo_TypesForMIMEType: AudioFilePropertyID = 0x746d696d;
1519/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_typesforuti?language=objc)
1520pub const kAudioFileGlobalInfo_TypesForUTI: AudioFilePropertyID = 0x74757469;
1521/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_typesforhfstypecode?language=objc)
1522pub const kAudioFileGlobalInfo_TypesForHFSTypeCode: AudioFilePropertyID = 0x74686673;
1523/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_typesforextension?language=objc)
1524pub const kAudioFileGlobalInfo_TypesForExtension: AudioFilePropertyID = 0x74657874;
1525
1526/// This is used as a specifier for kAudioFileGlobalInfo_AvailableStreamDescriptions
1527///
1528/// This struct is used to specify a desired audio file type and data format ID  so
1529/// that a list of stream descriptions of available formats can be obtained.
1530///
1531/// a four char code for the file type such as kAudioFileAIFFType, kAudioFileCAFType, etc.
1532///
1533/// a four char code for the format ID such as kAudioFormatLinearPCM, kAudioFormatMPEG4AAC, etc.
1534///
1535/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofiletypeandformatid?language=objc)
1536#[repr(C)]
1537#[derive(Clone, Copy, Debug, PartialEq)]
1538pub struct AudioFileTypeAndFormatID {
1539    pub mFileType: AudioFileTypeID,
1540    pub mFormatID: u32,
1541}
1542
1543unsafe impl Encode for AudioFileTypeAndFormatID {
1544    const ENCODING: Encoding = Encoding::Struct(
1545        "AudioFileTypeAndFormatID",
1546        &[<AudioFileTypeID>::ENCODING, <u32>::ENCODING],
1547    );
1548}
1549
1550unsafe impl RefEncode for AudioFileTypeAndFormatID {
1551    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1552}
1553
1554extern "C-unwind" {
1555    /// Get the size of a global property.
1556    ///
1557    /// Parameter `inPropertyID`: an AudioFileGlobalInfo property constant.
1558    ///
1559    /// Parameter `inSpecifierSize`: The size of the specifier data.
1560    ///
1561    /// Parameter `inSpecifier`: A specifier is a buffer of data used as an input argument to some of the global info properties.
1562    ///
1563    /// Parameter `outDataSize`: the size in bytes of the current value of the property. In order to get the property value,
1564    /// you will need a buffer of this size.
1565    ///
1566    /// Returns: returns noErr if successful.
1567    pub fn AudioFileGetGlobalInfoSize(
1568        in_property_id: AudioFilePropertyID,
1569        in_specifier_size: u32,
1570        in_specifier: *mut c_void,
1571        out_data_size: NonNull<u32>,
1572    ) -> OSStatus;
1573}
1574
1575extern "C-unwind" {
1576    /// Copies the value for a global property into a buffer.
1577    ///
1578    /// Parameter `inPropertyID`: an AudioFileGlobalInfo property constant.
1579    ///
1580    /// Parameter `inSpecifierSize`: The size of the specifier data.
1581    ///
1582    /// Parameter `inSpecifier`: A specifier is a buffer of data used as an input argument to some of the global info properties.
1583    ///
1584    /// Parameter `ioDataSize`: on input the size of the outPropertyData buffer. On output the number of bytes written to the buffer.
1585    ///
1586    /// Parameter `outPropertyData`: the buffer in which to write the property data.
1587    ///
1588    /// Returns: returns noErr if successful.
1589    pub fn AudioFileGetGlobalInfo(
1590        in_property_id: AudioFilePropertyID,
1591        in_specifier_size: u32,
1592        in_specifier: *mut c_void,
1593        io_data_size: NonNull<u32>,
1594        out_property_data: NonNull<c_void>,
1595    ) -> OSStatus;
1596}