// Automatically generated by clay-bindgen
// language: c

import libc.*;
import unix.*;
import cocoa.corefoundation.*;
import cocoa.coreaudio.*;

private alias OpaquePointer = RawPointer;
private alias UnknownType = Int;
private alias AUnionType = Int;


alias kAudioFileAIFFType = 1095321158;
alias kAudioFileAIFCType = 1095321155;
alias kAudioFileWAVEType = 1463899717;
alias kAudioFileSoundDesigner2Type = 1399075430;
alias kAudioFileNextType = 1315264596;
alias kAudioFileMP3Type = 1297106739;
alias kAudioFileMP2Type = 1297106738;
alias kAudioFileMP1Type = 1297106737;
alias kAudioFileAC3Type = 1633889587;
alias kAudioFileAAC_ADTSType = 1633973363;
alias kAudioFileMPEG4Type = 1836069990;
alias kAudioFileM4AType = 1832149350;
alias kAudioFileCAFType = 1667327590;
alias kAudioFile3GPType = 862417008;
alias kAudioFile3GP2Type = 862416946;
alias kAudioFileAMRType = 1634562662;

alias AudioFileTypeID = CULong;

alias kAudioFileUnspecifiedError = 2003334207;
alias kAudioFileUnsupportedFileTypeError = 1954115647;
alias kAudioFileUnsupportedDataFormatError = 1718449215;
alias kAudioFileUnsupportedPropertyError = 1886681407;
alias kAudioFileBadPropertySizeError = 561211770;
alias kAudioFilePermissionsError = 1886547263;
alias kAudioFileNotOptimizedError = 1869640813;
alias kAudioFileInvalidChunkError = 1667787583;
alias kAudioFileDoesNotAllow64BitDataSizeError = 1868981823;
alias kAudioFileInvalidPacketOffsetError = 1885563711;
alias kAudioFileInvalidFileError = 1685348671;
alias kAudioFileOperationNotSupportedError = 1869627199;
alias kAudioFileEndOfFileError = 4294967257;
alias kAudioFilePositionError = 4294967256;
alias kAudioFileFileNotFoundError = 4294967253;

alias kAudioFileFlags_EraseFile = 1;
alias kAudioFileFlags_DontPageAlignAudioData = 2;

alias kAudioFileReadPermission = 1;
alias kAudioFileWritePermission = 2;
alias kAudioFileReadWritePermission = 3;

alias AudioFileID = OpaquePointer;

alias AudioFilePropertyID = CULong;

alias kAudioFileLoopDirection_NoLooping = 0;
alias kAudioFileLoopDirection_Forward = 1;
alias kAudioFileLoopDirection_ForwardAndBackward = 2;
alias kAudioFileLoopDirection_Backward = 3;

record Struct_AudioFile_SMPTE_Time (
    mHours : CChar,
    mMinutes : CUChar,
    mSeconds : CUChar,
    mFrames : CUChar,
    mSubFrameSampleOffset : CULong,
);

alias AudioFile_SMPTE_Time = Struct_AudioFile_SMPTE_Time;

alias kAudioFileMarkerType_Generic = 0;

record Struct_AudioFileMarker (
    mFramePosition : Double,
    mName : CFStringRef,
    mMarkerID : CLong,
    mSMPTETime : AudioFile_SMPTE_Time,
    mType : CULong,
    mReserved : UShort,
    mChannel : UShort,
);

alias AudioFileMarker = Struct_AudioFileMarker;

record Struct_AudioFileMarkerList (
    mSMPTE_TimeType : CULong,
    mNumberMarkers : CULong,
    mMarkers : Array[AudioFileMarker,1],
);

alias AudioFileMarkerList = Struct_AudioFileMarkerList;

alias kAudioFileRegionFlag_LoopEnable = 1;
alias kAudioFileRegionFlag_PlayForward = 2;
alias kAudioFileRegionFlag_PlayBackward = 4;

record Struct_AudioFileRegion (
    mRegionID : CULong,
    mName : CFStringRef,
    mFlags : CULong,
    mNumberMarkers : CULong,
    mMarkers : Array[AudioFileMarker,1],
);

alias AudioFileRegion = Struct_AudioFileRegion;

record Struct_AudioFileRegionList (
    mSMPTE_TimeType : CULong,
    mNumberRegions : CULong,
    mRegions : Array[AudioFileRegion,1],
);

alias AudioFileRegionList = Struct_AudioFileRegionList;

record Struct_AudioFramePacketTranslation (
    mFrame : Int64,
    mPacket : Int64,
    mFrameOffsetInPacket : CULong,
);

alias AudioFramePacketTranslation = Struct_AudioFramePacketTranslation;

alias kBytePacketTranslationFlag_IsEstimate = 1;

record Struct_AudioBytePacketTranslation (
    mByte : Int64,
    mPacket : Int64,
    mByteOffsetInPacket : CULong,
    mFlags : CULong,
);

alias AudioBytePacketTranslation = Struct_AudioBytePacketTranslation;

record Struct_AudioFilePacketTableInfo (
    mNumberValidFrames : Int64,
    mPrimingFrames : CLong,
    mRemainderFrames : CLong,
);

alias AudioFilePacketTableInfo = Struct_AudioFilePacketTableInfo;

external AudioFileCreateWithURL(
    inFileRef : CFURLRef,
    inFileType : CULong,
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : CULong,
    outAudioFile : Pointer[AudioFileID]) : CLong;

external AudioFileOpenURL(
    inFileRef : CFURLRef,
    inPermissions : CChar,
    inFileTypeHint : CULong,
    outAudioFile : Pointer[AudioFileID]) : CLong;

alias AudioFile_ReadProc = CCodePointer[[RawPointer,Int64,CULong,RawPointer,Pointer[CULong]],[CLong]];

alias AudioFile_WriteProc = CCodePointer[[RawPointer,Int64,CULong,RawPointer,Pointer[CULong]],[CLong]];

alias AudioFile_GetSizeProc = CCodePointer[[RawPointer],[Int64]];

alias AudioFile_SetSizeProc = CCodePointer[[RawPointer,Int64],[CLong]];

external AudioFileInitializeWithCallbacks(
    inClientData : RawPointer,
    inReadFunc : AudioFile_ReadProc,
    inWriteFunc : AudioFile_WriteProc,
    inGetSizeFunc : AudioFile_GetSizeProc,
    inSetSizeFunc : AudioFile_SetSizeProc,
    inFileType : CULong,
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : CULong,
    outAudioFile : Pointer[AudioFileID]) : CLong;

external AudioFileOpenWithCallbacks(
    inClientData : RawPointer,
    inReadFunc : AudioFile_ReadProc,
    inWriteFunc : AudioFile_WriteProc,
    inGetSizeFunc : AudioFile_GetSizeProc,
    inSetSizeFunc : AudioFile_SetSizeProc,
    inFileTypeHint : CULong,
    outAudioFile : Pointer[AudioFileID]) : CLong;

external AudioFileClose(
    inAudioFile : AudioFileID) : CLong;

external AudioFileOptimize(
    inAudioFile : AudioFileID) : CLong;

external AudioFileReadBytes(
    inAudioFile : AudioFileID,
    inUseCache : CUChar,
    inStartingByte : Int64,
    ioNumBytes : Pointer[CULong],
    outBuffer : RawPointer) : CLong;

external AudioFileWriteBytes(
    inAudioFile : AudioFileID,
    inUseCache : CUChar,
    inStartingByte : Int64,
    ioNumBytes : Pointer[CULong],
    inBuffer : RawPointer) : CLong;

external AudioFileReadPacketData(
    inAudioFile : AudioFileID,
    inUseCache : CUChar,
    ioNumBytes : Pointer[CULong],
    outPacketDescriptions : Pointer[AudioStreamPacketDescription],
    inStartingPacket : Int64,
    ioNumPackets : Pointer[CULong],
    outBuffer : RawPointer) : CLong;

external AudioFileReadPackets(
    inAudioFile : AudioFileID,
    inUseCache : CUChar,
    outNumBytes : Pointer[CULong],
    outPacketDescriptions : Pointer[AudioStreamPacketDescription],
    inStartingPacket : Int64,
    ioNumPackets : Pointer[CULong],
    outBuffer : RawPointer) : CLong;

external AudioFileWritePackets(
    inAudioFile : AudioFileID,
    inUseCache : CUChar,
    inNumBytes : CULong,
    inPacketDescriptions : Pointer[AudioStreamPacketDescription],
    inStartingPacket : Int64,
    ioNumPackets : Pointer[CULong],
    inBuffer : RawPointer) : CLong;

external AudioFileCountUserData(
    inAudioFile : AudioFileID,
    inUserDataID : CULong,
    outNumberItems : Pointer[CULong]) : CLong;

external AudioFileGetUserDataSize(
    inAudioFile : AudioFileID,
    inUserDataID : CULong,
    inIndex : CULong,
    outUserDataSize : Pointer[CULong]) : CLong;

external AudioFileGetUserData(
    inAudioFile : AudioFileID,
    inUserDataID : CULong,
    inIndex : CULong,
    ioUserDataSize : Pointer[CULong],
    outUserData : RawPointer) : CLong;

external AudioFileSetUserData(
    inAudioFile : AudioFileID,
    inUserDataID : CULong,
    inIndex : CULong,
    inUserDataSize : CULong,
    inUserData : RawPointer) : CLong;

external AudioFileRemoveUserData(
    inAudioFile : AudioFileID,
    inUserDataID : CULong,
    inIndex : CULong) : CLong;

alias kAudioFilePropertyFileFormat = 1717988724;
alias kAudioFilePropertyDataFormat = 1684434292;
alias kAudioFilePropertyIsOptimized = 1869640813;
alias kAudioFilePropertyMagicCookieData = 1835493731;
alias kAudioFilePropertyAudioDataByteCount = 1650683508;
alias kAudioFilePropertyAudioDataPacketCount = 1885564532;
alias kAudioFilePropertyMaximumPacketSize = 1886616165;
alias kAudioFilePropertyDataOffset = 1685022310;
alias kAudioFilePropertyChannelLayout = 1668112752;
alias kAudioFilePropertyDeferSizeUpdates = 1685289589;
alias kAudioFilePropertyDataFormatName = 1718512997;
alias kAudioFilePropertyMarkerList = 1835756659;
alias kAudioFilePropertyRegionList = 1919380595;
alias kAudioFilePropertyPacketToFrame = 1886086770;
alias kAudioFilePropertyFrameToPacket = 1718775915;
alias kAudioFilePropertyPacketToByte = 1886085753;
alias kAudioFilePropertyByteToPacket = 1652125803;
alias kAudioFilePropertyChunkIDs = 1667787108;
alias kAudioFilePropertyInfoDictionary = 1768842863;
alias kAudioFilePropertyPacketTableInfo = 1886283375;
alias kAudioFilePropertyFormatList = 1718383476;
alias kAudioFilePropertyPacketSizeUpperBound = 1886090594;
alias kAudioFilePropertyReserveDuration = 1920168566;
alias kAudioFilePropertyEstimatedDuration = 1701082482;
alias kAudioFilePropertyBitRate = 1651663220;
alias kAudioFilePropertyID3Tag = 1768174452;

external AudioFileGetPropertyInfo(
    inAudioFile : AudioFileID,
    inPropertyID : CULong,
    outDataSize : Pointer[CULong],
    isWritable : Pointer[CULong]) : CLong;

external AudioFileGetProperty(
    inAudioFile : AudioFileID,
    inPropertyID : CULong,
    ioDataSize : Pointer[CULong],
    outPropertyData : RawPointer) : CLong;

external AudioFileSetProperty(
    inAudioFile : AudioFileID,
    inPropertyID : CULong,
    inDataSize : CULong,
    inPropertyData : RawPointer) : CLong;

alias kAudioFileGlobalInfo_ReadableTypes = 1634103910;
alias kAudioFileGlobalInfo_WritableTypes = 1634105190;
alias kAudioFileGlobalInfo_FileTypeName = 1718906477;
alias kAudioFileGlobalInfo_AvailableStreamDescriptionsForFormat = 1935960420;
alias kAudioFileGlobalInfo_AvailableFormatIDs = 1718446436;
alias kAudioFileGlobalInfo_AllExtensions = 1634498676;
alias kAudioFileGlobalInfo_AllHFSTypeCodes = 1634231923;
alias kAudioFileGlobalInfo_AllUTIs = 1635087465;
alias kAudioFileGlobalInfo_AllMIMETypes = 1634560365;
alias kAudioFileGlobalInfo_ExtensionsForType = 1717926004;
alias kAudioFileGlobalInfo_HFSTypeCodesForType = 1718118003;
alias kAudioFileGlobalInfo_UTIsForType = 1718973545;
alias kAudioFileGlobalInfo_MIMETypesForType = 1718446445;
alias kAudioFileGlobalInfo_TypesForMIMEType = 1953327469;
alias kAudioFileGlobalInfo_TypesForUTI = 1953854569;
alias kAudioFileGlobalInfo_TypesForHFSTypeCode = 1952999027;
alias kAudioFileGlobalInfo_TypesForExtension = 1952807028;

record Struct_AudioFileTypeAndFormatID (
    mFileType : CULong,
    mFormatID : CULong,
);

alias AudioFileTypeAndFormatID = Struct_AudioFileTypeAndFormatID;

external AudioFileGetGlobalInfoSize(
    inPropertyID : CULong,
    inSpecifierSize : CULong,
    inSpecifier : RawPointer,
    outDataSize : Pointer[CULong]) : CLong;

external AudioFileGetGlobalInfo(
    inPropertyID : CULong,
    inSpecifierSize : CULong,
    inSpecifier : RawPointer,
    ioDataSize : Pointer[CULong],
    outPropertyData : RawPointer) : CLong;

alias AudioFileStreamPropertyID = CULong;

alias AudioFileStreamID = OpaquePointer;

alias AudioFileStream_PropertyListenerProc = CCodePointer[[RawPointer,OpaquePointer,CULong,Pointer[CULong]],[]];

alias AudioFileStream_PacketsProc = CCodePointer[[RawPointer,CULong,CULong,RawPointer,Pointer[Struct_AudioStreamPacketDescription]],[]];

alias kAudioFileStreamPropertyFlag_PropertyIsCached = 1;
alias kAudioFileStreamPropertyFlag_CacheProperty = 2;
alias kAudioFileStreamParseFlag_Discontinuity = 1;
alias kAudioFileStreamSeekFlag_OffsetIsEstimated = 1;

alias kAudioFileStreamError_UnsupportedFileType = 1954115647;
alias kAudioFileStreamError_UnsupportedDataFormat = 1718449215;
alias kAudioFileStreamError_UnsupportedProperty = 1886681407;
alias kAudioFileStreamError_BadPropertySize = 561211770;
alias kAudioFileStreamError_NotOptimized = 1869640813;
alias kAudioFileStreamError_InvalidPacketOffset = 1885563711;
alias kAudioFileStreamError_InvalidFile = 1685348671;
alias kAudioFileStreamError_ValueUnknown = 1970170687;
alias kAudioFileStreamError_DataUnavailable = 1836020325;
alias kAudioFileStreamError_IllegalOperation = 1852797029;
alias kAudioFileStreamError_UnspecifiedError = 2003334207;
alias kAudioFileStreamError_DiscontinuityCantRecover = 1685283617;

alias kAudioFileStreamProperty_ReadyToProducePackets = 1919247481;
alias kAudioFileStreamProperty_FileFormat = 1717988724;
alias kAudioFileStreamProperty_DataFormat = 1684434292;
alias kAudioFileStreamProperty_FormatList = 1718383476;
alias kAudioFileStreamProperty_MagicCookieData = 1835493731;
alias kAudioFileStreamProperty_AudioDataByteCount = 1650683508;
alias kAudioFileStreamProperty_AudioDataPacketCount = 1885564532;
alias kAudioFileStreamProperty_MaximumPacketSize = 1886616165;
alias kAudioFileStreamProperty_DataOffset = 1685022310;
alias kAudioFileStreamProperty_ChannelLayout = 1668112752;
alias kAudioFileStreamProperty_PacketToFrame = 1886086770;
alias kAudioFileStreamProperty_FrameToPacket = 1718775915;
alias kAudioFileStreamProperty_PacketToByte = 1886085753;
alias kAudioFileStreamProperty_ByteToPacket = 1652125803;
alias kAudioFileStreamProperty_PacketTableInfo = 1886283375;
alias kAudioFileStreamProperty_PacketSizeUpperBound = 1886090594;
alias kAudioFileStreamProperty_AverageBytesPerPacket = 1633841264;
alias kAudioFileStreamProperty_BitRate = 1651663220;

external AudioFileStreamOpen(
    inClientData : RawPointer,
    inPropertyListenerProc : AudioFileStream_PropertyListenerProc,
    inPacketsProc : AudioFileStream_PacketsProc,
    inFileTypeHint : CULong,
    outAudioFileStream : Pointer[AudioFileStreamID]) : CLong;

external AudioFileStreamParseBytes(
    inAudioFileStream : AudioFileStreamID,
    inDataByteSize : CULong,
    inData : RawPointer,
    inFlags : CULong) : CLong;

external AudioFileStreamSeek(
    inAudioFileStream : AudioFileStreamID,
    inPacketOffset : Int64,
    outDataByteOffset : Pointer[Int64],
    ioFlags : Pointer[CULong]) : CLong;

external AudioFileStreamGetPropertyInfo(
    inAudioFileStream : AudioFileStreamID,
    inPropertyID : CULong,
    outPropertyDataSize : Pointer[CULong],
    outWritable : Pointer[CUChar]) : CLong;

external AudioFileStreamGetProperty(
    inAudioFileStream : AudioFileStreamID,
    inPropertyID : CULong,
    ioPropertyDataSize : Pointer[CULong],
    outPropertyData : RawPointer) : CLong;

external AudioFileStreamSetProperty(
    inAudioFileStream : AudioFileStreamID,
    inPropertyID : CULong,
    inPropertyDataSize : CULong,
    inPropertyData : RawPointer) : CLong;

external AudioFileStreamClose(
    inAudioFileStream : AudioFileStreamID) : CLong;

alias AudioFormatPropertyID = CULong;

alias kPanningMode_SoundField = 3;
alias kPanningMode_VectorBasedPanning = 4;

record Struct_AudioPanningInfo (
    mPanningMode : CULong,
    mCoordinateFlags : CULong,
    mCoordinates : Array[Float,3],
    mGainScale : Float,
    mOutputChannelMap : Pointer[AudioChannelLayout],
);

alias AudioPanningInfo = Struct_AudioPanningInfo;

alias kAudioBalanceFadeType_MaxUnityGain = 0;
alias kAudioBalanceFadeType_EqualPower = 1;

record Struct_AudioBalanceFade (
    mLeftRightBalance : Float,
    mBackFrontFade : Float,
    mType : CULong,
    mChannelLayout : Pointer[AudioChannelLayout],
);

alias AudioBalanceFade = Struct_AudioBalanceFade;

record Struct_AudioFormatInfo (
    mASBD : AudioStreamBasicDescription,
    mMagicCookie : RawPointer,
    mMagicCookieSize : CULong,
);

alias AudioFormatInfo = Struct_AudioFormatInfo;

record Struct_AudioFormatListItem (
    mASBD : AudioStreamBasicDescription,
    mChannelLayoutTag : CULong,
);

alias AudioFormatListItem = Struct_AudioFormatListItem;

alias kAudioFormatProperty_FormatInfo = 1718449257;
alias kAudioFormatProperty_FormatName = 1718509933;
alias kAudioFormatProperty_EncodeFormatIDs = 1633906534;
alias kAudioFormatProperty_DecodeFormatIDs = 1633904998;
alias kAudioFormatProperty_FormatList = 1718383476;
alias kAudioFormatProperty_ASBDFromESDS = 1702064996;
alias kAudioFormatProperty_ChannelLayoutFromESDS = 1702060908;
alias kAudioFormatProperty_OutputFormatList = 1868983411;
alias kAudioFormatProperty_FirstPlayableFormatFromList = 1718642284;
alias kAudioFormatProperty_FormatIsVBR = 1719034482;
alias kAudioFormatProperty_FormatIsExternallyFramed = 1717925990;
alias kAudioFormatProperty_Encoders = 1635149166;
alias kAudioFormatProperty_Decoders = 1635148901;
alias kAudioFormatProperty_AvailableEncodeBitRates = 1634034290;
alias kAudioFormatProperty_AvailableEncodeSampleRates = 1634038642;
alias kAudioFormatProperty_AvailableEncodeChannelLayoutTags = 1634034540;
alias kAudioFormatProperty_AvailableEncodeNumberChannels = 1635151459;
alias kAudioFormatProperty_ASBDFromMPEGPacket = 1633971568;
alias kAudioFormatProperty_BitmapForLayoutTag = 1651340391;
alias kAudioFormatProperty_MatrixMixMap = 1835884912;
alias kAudioFormatProperty_ChannelMap = 1667788144;
alias kAudioFormatProperty_NumberOfChannelsForLayout = 1852008557;
alias kAudioFormatProperty_ValidateChannelLayout = 1986093932;
alias kAudioFormatProperty_ChannelLayoutForTag = 1668116588;
alias kAudioFormatProperty_TagForChannelLayout = 1668116596;
alias kAudioFormatProperty_ChannelLayoutName = 1819242093;
alias kAudioFormatProperty_ChannelLayoutForBitmap = 1668116578;
alias kAudioFormatProperty_ChannelName = 1668178285;
alias kAudioFormatProperty_ChannelShortName = 1668509293;
alias kAudioFormatProperty_TagsForNumberOfChannels = 1952540515;
alias kAudioFormatProperty_PanningMatrix = 1885433453;
alias kAudioFormatProperty_BalanceFade = 1650551910;
alias kAudioFormatProperty_ID3TagSize = 1768174451;
alias kAudioFormatProperty_ID3TagToDictionary = 1768174436;

alias kAudioFormatProperty_HardwareCodecCapabilities = 1752654691;

alias kAudioDecoderComponentType = 1633969507;
alias kAudioEncoderComponentType = 1634037347;

alias kAppleSoftwareAudioCodecManufacturer = 1634758764;
alias kAppleHardwareAudioCodecManufacturer = 1634756727;

external AudioFormatGetPropertyInfo(
    inPropertyID : CULong,
    inSpecifierSize : CULong,
    inSpecifier : RawPointer,
    outPropertyDataSize : Pointer[CULong]) : CLong;

external AudioFormatGetProperty(
    inPropertyID : CULong,
    inSpecifierSize : CULong,
    inSpecifier : RawPointer,
    ioPropertyDataSize : Pointer[CULong],
    outPropertyData : RawPointer) : CLong;

alias kAudioFormatUnspecifiedError = 2003329396;
alias kAudioFormatUnsupportedPropertyError = 1886547824;
alias kAudioFormatBadPropertySizeError = 561211770;
alias kAudioFormatBadSpecifierSizeError = 561213539;
alias kAudioFormatUnsupportedDataFormatError = 1718449215;
alias kAudioFormatUnknownFormatError = 560360820;

alias kAudioQueueErr_InvalidBuffer = 4294900609;
alias kAudioQueueErr_BufferEmpty = 4294900610;
alias kAudioQueueErr_DisposalPending = 4294900611;
alias kAudioQueueErr_InvalidProperty = 4294900612;
alias kAudioQueueErr_InvalidPropertySize = 4294900613;
alias kAudioQueueErr_InvalidParameter = 4294900614;
alias kAudioQueueErr_CannotStart = 4294900615;
alias kAudioQueueErr_InvalidDevice = 4294900616;
alias kAudioQueueErr_BufferInQueue = 4294900617;
alias kAudioQueueErr_InvalidRunState = 4294900618;
alias kAudioQueueErr_InvalidQueueType = 4294900619;
alias kAudioQueueErr_Permissions = 4294900620;
alias kAudioQueueErr_InvalidPropertyValue = 4294900621;
alias kAudioQueueErr_PrimeTimedOut = 4294900622;
alias kAudioQueueErr_CodecNotFound = 4294900623;
alias kAudioQueueErr_InvalidCodecAccess = 4294900624;
alias kAudioQueueErr_QueueInvalidated = 4294900625;
alias kAudioQueueErr_EnqueueDuringReset = 4294900664;
alias kAudioQueueErr_InvalidOfflineMode = 4294900670;

alias kAudioQueueProperty_IsRunning = 1634824814;
alias kAudioQueueDeviceProperty_SampleRate = 1634825074;
alias kAudioQueueDeviceProperty_NumberChannels = 1634821219;
alias kAudioQueueProperty_CurrentDevice = 1634820964;
alias kAudioQueueProperty_MagicCookie = 1634823523;
alias kAudioQueueProperty_MaximumOutputPacketSize = 2020569203;
alias kAudioQueueProperty_StreamDescription = 1634821748;
alias kAudioQueueProperty_ChannelLayout = 1634820972;
alias kAudioQueueProperty_EnableLevelMetering = 1634823525;
alias kAudioQueueProperty_CurrentLevelMeter = 1634823542;
alias kAudioQueueProperty_CurrentLevelMeterDB = 1634823524;
alias kAudioQueueProperty_DecodeBufferSizeFrames = 1684234854;

alias kAudioQueueProperty_HardwareCodecPolicy = 1634820976;

alias kAudioQueueHardwareCodecPolicy_Default = 0;
alias kAudioQueueHardwareCodecPolicy_UseSoftwareOnly = 1;
alias kAudioQueueHardwareCodecPolicy_UseHardwareOnly = 2;
alias kAudioQueueHardwareCodecPolicy_PreferSoftware = 3;
alias kAudioQueueHardwareCodecPolicy_PreferHardware = 4;

alias kAudioQueueParam_Volume = 1;
alias kAudioQueueParam_VolumeRampTime = 4;
alias kAudioQueueParam_Pan = 13;

alias AudioQueuePropertyID = CULong;

alias AudioQueueParameterID = CULong;

alias AudioQueueParameterValue = Float;

alias AudioQueueRef = OpaquePointer;

alias AudioQueueTimelineRef = OpaquePointer;

record Struct_AudioQueueBuffer (
    mAudioDataBytesCapacity : CULong,
    mAudioData : RawPointer,
    mAudioDataByteSize : CULong,
    mUserData : RawPointer,
    mPacketDescriptionCapacity : CULong,
    mPacketDescriptions : Pointer[AudioStreamPacketDescription],
    mPacketDescriptionCount : CULong,
);

alias AudioQueueBuffer = Struct_AudioQueueBuffer;

alias AudioQueueBufferRef = Pointer[AudioQueueBuffer];

record Struct_AudioQueueParameterEvent (
    mID : CULong,
    mValue : Float,
);

alias AudioQueueParameterEvent = Struct_AudioQueueParameterEvent;

record Struct_AudioQueueLevelMeterState (
    mAveragePower : Float,
    mPeakPower : Float,
);

alias AudioQueueLevelMeterState = Struct_AudioQueueLevelMeterState;

alias AudioQueueOutputCallback = CCodePointer[[RawPointer,OpaquePointer,Pointer[Struct_AudioQueueBuffer]],[]];

alias AudioQueueInputCallback = CCodePointer[[RawPointer,OpaquePointer,Pointer[Struct_AudioQueueBuffer],Pointer[Struct_AudioTimeStamp],CULong,Pointer[Struct_AudioStreamPacketDescription]],[]];

alias AudioQueuePropertyListenerProc = CCodePointer[[RawPointer,OpaquePointer,CULong],[]];

external AudioQueueNewOutput(
    inFormat : Pointer[AudioStreamBasicDescription],
    inCallbackProc : AudioQueueOutputCallback,
    inUserData : RawPointer,
    inCallbackRunLoop : CFRunLoopRef,
    inCallbackRunLoopMode : CFStringRef,
    inFlags : CULong,
    outAQ : Pointer[AudioQueueRef]) : CLong;

external AudioQueueNewInput(
    inFormat : Pointer[AudioStreamBasicDescription],
    inCallbackProc : AudioQueueInputCallback,
    inUserData : RawPointer,
    inCallbackRunLoop : CFRunLoopRef,
    inCallbackRunLoopMode : CFStringRef,
    inFlags : CULong,
    outAQ : Pointer[AudioQueueRef]) : CLong;

external AudioQueueDispose(
    inAQ : AudioQueueRef,
    inImmediate : CUChar) : CLong;

external AudioQueueAllocateBuffer(
    inAQ : AudioQueueRef,
    inBufferByteSize : CULong,
    outBuffer : Pointer[AudioQueueBufferRef]) : CLong;

external AudioQueueAllocateBufferWithPacketDescriptions(
    inAQ : AudioQueueRef,
    inBufferByteSize : CULong,
    inNumberPacketDescriptions : CULong,
    outBuffer : Pointer[AudioQueueBufferRef]) : CLong;

external AudioQueueFreeBuffer(
    inAQ : AudioQueueRef,
    inBuffer : AudioQueueBufferRef) : CLong;

external AudioQueueEnqueueBuffer(
    inAQ : AudioQueueRef,
    inBuffer : AudioQueueBufferRef,
    inNumPacketDescs : CULong,
    inPacketDescs : Pointer[AudioStreamPacketDescription]) : CLong;

external AudioQueueEnqueueBufferWithParameters(
    inAQ : AudioQueueRef,
    inBuffer : AudioQueueBufferRef,
    inNumPacketDescs : CULong,
    inPacketDescs : Pointer[AudioStreamPacketDescription],
    inTrimFramesAtStart : CULong,
    inTrimFramesAtEnd : CULong,
    inNumParamValues : CULong,
    inParamValues : Pointer[AudioQueueParameterEvent],
    inStartTime : Pointer[AudioTimeStamp],
    outActualStartTime : Pointer[AudioTimeStamp]) : CLong;

external AudioQueueStart(
    inAQ : AudioQueueRef,
    inStartTime : Pointer[AudioTimeStamp]) : CLong;

external AudioQueuePrime(
    inAQ : AudioQueueRef,
    inNumberOfFramesToPrepare : CULong,
    outNumberOfFramesPrepared : Pointer[CULong]) : CLong;

external AudioQueueStop(
    inAQ : AudioQueueRef,
    inImmediate : CUChar) : CLong;

external AudioQueuePause(
    inAQ : AudioQueueRef) : CLong;

external AudioQueueFlush(
    inAQ : AudioQueueRef) : CLong;

external AudioQueueReset(
    inAQ : AudioQueueRef) : CLong;

external AudioQueueGetParameter(
    inAQ : AudioQueueRef,
    inParamID : CULong,
    outValue : Pointer[Float]) : CLong;

external AudioQueueSetParameter(
    inAQ : AudioQueueRef,
    inParamID : CULong,
    inValue : Float) : CLong;

external AudioQueueGetProperty(
    inAQ : AudioQueueRef,
    inID : CULong,
    outData : RawPointer,
    ioDataSize : Pointer[CULong]) : CLong;

external AudioQueueSetProperty(
    inAQ : AudioQueueRef,
    inID : CULong,
    inData : RawPointer,
    inDataSize : CULong) : CLong;

external AudioQueueGetPropertySize(
    inAQ : AudioQueueRef,
    inID : CULong,
    outDataSize : Pointer[CULong]) : CLong;

external AudioQueueAddPropertyListener(
    inAQ : AudioQueueRef,
    inID : CULong,
    inProc : AudioQueuePropertyListenerProc,
    inUserData : RawPointer) : CLong;

external AudioQueueRemovePropertyListener(
    inAQ : AudioQueueRef,
    inID : CULong,
    inProc : AudioQueuePropertyListenerProc,
    inUserData : RawPointer) : CLong;

external AudioQueueCreateTimeline(
    inAQ : AudioQueueRef,
    outTimeline : Pointer[AudioQueueTimelineRef]) : CLong;

external AudioQueueDisposeTimeline(
    inAQ : AudioQueueRef,
    inTimeline : AudioQueueTimelineRef) : CLong;

external AudioQueueGetCurrentTime(
    inAQ : AudioQueueRef,
    inTimeline : AudioQueueTimelineRef,
    outTimeStamp : Pointer[AudioTimeStamp],
    outTimelineDiscontinuity : Pointer[CUChar]) : CLong;

external AudioQueueDeviceGetCurrentTime(
    inAQ : AudioQueueRef,
    outTimeStamp : Pointer[AudioTimeStamp]) : CLong;

external AudioQueueDeviceTranslateTime(
    inAQ : AudioQueueRef,
    inTime : Pointer[AudioTimeStamp],
    outTime : Pointer[AudioTimeStamp]) : CLong;

external AudioQueueDeviceGetNearestStartTime(
    inAQ : AudioQueueRef,
    ioRequestedStartTime : Pointer[AudioTimeStamp],
    inFlags : CULong) : CLong;

external AudioQueueSetOfflineRenderFormat(
    inAQ : AudioQueueRef,
    inFormat : Pointer[AudioStreamBasicDescription],
    inLayout : Pointer[AudioChannelLayout]) : CLong;

external AudioQueueOfflineRender(
    inAQ : AudioQueueRef,
    inTimestamp : Pointer[AudioTimeStamp],
    ioBuffer : AudioQueueBufferRef,
    inNumberFrames : CULong) : CLong;

alias kAudioServicesNoError = 0;
alias kAudioServicesUnsupportedPropertyError = 1886681407;
alias kAudioServicesBadPropertySizeError = 561211770;
alias kAudioServicesBadSpecifierSizeError = 561213539;
alias kAudioServicesSystemSoundUnspecifiedError = 4294965796;
alias kAudioServicesSystemSoundClientTimedOutError = 4294965795;

alias SystemSoundID = CULong;

alias AudioServicesPropertyID = CULong;

alias AudioServicesSystemSoundCompletionProc = CCodePointer[[CULong,RawPointer],[]];

alias kSystemSoundID_Vibrate = 4095;

alias kAudioServicesPropertyIsUISound = 1769174377;
alias kAudioServicesPropertyCompletePlaybackIfAppDies = 1768318057;

external AudioServicesPlayAlertSound(
    inSystemSoundID : CULong);

external AudioServicesPlaySystemSound(
    inSystemSoundID : CULong);

external AudioServicesCreateSystemSoundID(
    inFileURL : CFURLRef,
    outSystemSoundID : Pointer[CULong]) : CLong;

external AudioServicesDisposeSystemSoundID(
    inSystemSoundID : CULong) : CLong;

external AudioServicesAddSystemSoundCompletion(
    inSystemSoundID : CULong,
    inRunLoop : CFRunLoopRef,
    inRunLoopMode : CFStringRef,
    inCompletionRoutine : AudioServicesSystemSoundCompletionProc,
    inClientData : RawPointer) : CLong;

external AudioServicesRemoveSystemSoundCompletion(
    inSystemSoundID : CULong);

external AudioServicesGetPropertyInfo(
    inPropertyID : CULong,
    inSpecifierSize : CULong,
    inSpecifier : RawPointer,
    outPropertyDataSize : Pointer[CULong],
    outWritable : Pointer[CUChar]) : CLong;

external AudioServicesGetProperty(
    inPropertyID : CULong,
    inSpecifierSize : CULong,
    inSpecifier : RawPointer,
    ioPropertyDataSize : Pointer[CULong],
    outPropertyData : RawPointer) : CLong;

external AudioServicesSetProperty(
    inPropertyID : CULong,
    inSpecifierSize : CULong,
    inSpecifier : RawPointer,
    inPropertyDataSize : CULong,
    inPropertyData : RawPointer) : CLong;

alias kAudioSessionNoError = 0;
alias kAudioSessionNotInitialized = 560557673;
alias kAudioSessionAlreadyInitialized = 1768843636;
alias kAudioSessionInitializationError = 1768843583;
alias kAudioSessionUnsupportedPropertyError = 1886681407;
alias kAudioSessionBadPropertySizeError = 561211770;
alias kAudioSessionNotActiveError = 560030580;
alias kAudioServicesNoHardwareError = 1852794999;
alias kAudioSessionNoCategorySet = 1063477620;
alias kAudioSessionIncompatibleCategory = 560161140;
alias kAudioSessionUnspecifiedError = 2003329396;

alias AudioSessionPropertyID = CULong;

alias kAudioSessionBeginInterruption = 1;
alias kAudioSessionEndInterruption = 0;

alias kAudioSessionCategory_AmbientSound = 1634558569;
alias kAudioSessionCategory_SoloAmbientSound = 1936682095;
alias kAudioSessionCategory_MediaPlayback = 1835361385;
alias kAudioSessionCategory_RecordAudio = 1919247201;
alias kAudioSessionCategory_PlayAndRecord = 1886151026;
alias kAudioSessionCategory_AudioProcessing = 1886547811;

alias kAudioSessionOverrideAudioRoute_None = 0;
alias kAudioSessionOverrideAudioRoute_Speaker = 1936747378;

alias kAudioSessionRouteChangeReason_Unknown = 0;
alias kAudioSessionRouteChangeReason_NewDeviceAvailable = 1;
alias kAudioSessionRouteChangeReason_OldDeviceUnavailable = 2;
alias kAudioSessionRouteChangeReason_CategoryChange = 3;
alias kAudioSessionRouteChangeReason_Override = 4;
alias kAudioSessionRouteChangeReason_WakeFromSleep = 6;
alias kAudioSessionRouteChangeReason_NoSuitableRouteForCategory = 7;

alias kAudioSessionInterruptionType_ShouldResume = 1769108333;
alias kAudioSessionInterruptionType_ShouldNotResume = 561148781;

alias AudioSessionInterruptionType = CULong;

alias kAudioSessionProperty_PreferredHardwareSampleRate = 1752658802;
alias kAudioSessionProperty_PreferredHardwareIOBufferDuration = 1768907364;
alias kAudioSessionProperty_AudioCategory = 1633902964;
alias kAudioSessionProperty_AudioRoute = 1919907188;
alias kAudioSessionProperty_AudioRouteChange = 1919902568;
alias kAudioSessionProperty_CurrentHardwareSampleRate = 1667789682;
alias kAudioSessionProperty_CurrentHardwareInputNumberChannels = 1667787107;
alias kAudioSessionProperty_CurrentHardwareOutputNumberChannels = 1667788643;
alias kAudioSessionProperty_CurrentHardwareOutputVolume = 1667788662;
alias kAudioSessionProperty_CurrentHardwareInputLatency = 1667853428;
alias kAudioSessionProperty_CurrentHardwareOutputLatency = 1668246644;
alias kAudioSessionProperty_CurrentHardwareIOBufferDuration = 1667785316;
alias kAudioSessionProperty_OtherAudioIsPlaying = 1869899890;
alias kAudioSessionProperty_OverrideAudioRoute = 1870033508;
alias kAudioSessionProperty_AudioInputAvailable = 1634296182;
alias kAudioSessionProperty_ServerDied = 1684628836;
alias kAudioSessionProperty_OtherMixableAudioShouldDuck = 1685414763;
alias kAudioSessionProperty_OverrideCategoryMixWithOthers = 1668114808;
alias kAudioSessionProperty_OverrideCategoryDefaultToSpeaker = 1668509803;
alias kAudioSessionProperty_OverrideCategoryEnableBluetoothInput = 1667394677;
alias kAudioSessionProperty_InterruptionType = 1954115685;

alias AudioSessionInterruptionListener = CCodePointer[[RawPointer,CULong],[]];

alias AudioSessionPropertyListener = CCodePointer[[RawPointer,CULong,CULong,RawPointer],[]];

external AudioSessionInitialize(
    inRunLoop : CFRunLoopRef,
    inRunLoopMode : CFStringRef,
    inInterruptionListener : AudioSessionInterruptionListener,
    inClientData : RawPointer) : CLong;

external AudioSessionSetActive(
    active : CUChar) : CLong;

alias kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation = 1;

external AudioSessionSetActiveWithFlags(
    active : CUChar,
    inFlags : CULong) : CLong;

external AudioSessionGetProperty(
    inID : CULong,
    ioDataSize : Pointer[CULong],
    outData : RawPointer) : CLong;

external AudioSessionSetProperty(
    inID : CULong,
    inDataSize : CULong,
    inData : RawPointer) : CLong;

external AudioSessionGetPropertySize(
    inID : CULong,
    outDataSize : Pointer[CULong]) : CLong;

external AudioSessionAddPropertyListener(
    inID : CULong,
    inProc : AudioSessionPropertyListener,
    inClientData : RawPointer) : CLong;

external AudioSessionRemovePropertyListener(
    inID : CULong) : CLong;

external AudioSessionRemovePropertyListenerWithUserData(
    inID : CULong,
    inProc : AudioSessionPropertyListener,
    inClientData : RawPointer) : CLong;

alias kAudioSessionCategory_UserInterfaceSoundEffects = 1969841784;
alias kAudioSessionCategory_LiveAudio = 1818850917;

alias AUGraph = OpaquePointer;

alias AUNode = CLong;

alias kAUGraphErr_NodeNotFound = 4294956436;
alias kAUGraphErr_InvalidConnection = 4294956435;
alias kAUGraphErr_OutputNodeErr = 4294956434;
alias kAUGraphErr_CannotDoInCurrentContext = 4294956433;
alias kAUGraphErr_InvalidAudioUnit = 4294956432;

external NewAUGraph(
    outGraph : Pointer[AUGraph]) : CLong;

external DisposeAUGraph(
    inGraph : AUGraph) : CLong;

external AUGraphAddNode(
    inGraph : AUGraph,
    inDescription : Pointer[AudioComponentDescription],
    outNode : Pointer[CLong]) : CLong;

external AUGraphRemoveNode(
    inGraph : AUGraph,
    inNode : CLong) : CLong;

external AUGraphGetNodeCount(
    inGraph : AUGraph,
    outNumberOfNodes : Pointer[CULong]) : CLong;

external AUGraphGetIndNode(
    inGraph : AUGraph,
    inIndex : CULong,
    outNode : Pointer[CLong]) : CLong;

external AUGraphNodeInfo(
    inGraph : AUGraph,
    inNode : CLong,
    outDescription : Pointer[AudioComponentDescription],
    outAudioUnit : Pointer[AudioUnit]) : CLong;

alias kAUNodeInteraction_Connection = 1;
alias kAUNodeInteraction_InputCallback = 2;

record Struct_AudioUnitNodeConnection (
    sourceNode : CLong,
    sourceOutputNumber : CULong,
    destNode : CLong,
    destInputNumber : CULong,
);

alias AudioUnitNodeConnection = Struct_AudioUnitNodeConnection;

alias AUNodeConnection = Struct_AudioUnitNodeConnection;

record Struct_AUNodeRenderCallback (
    destNode : CLong,
    destInputNumber : CULong,
    cback : AURenderCallbackStruct,
);

alias AUNodeRenderCallback = Struct_AUNodeRenderCallback;

record Struct_AUNodeInteraction (
    nodeInteractionType : CULong,
    nodeInteraction : AUnionType,
);

alias AUNodeInteraction = Struct_AUNodeInteraction;

external AUGraphConnectNodeInput(
    inGraph : AUGraph,
    inSourceNode : CLong,
    inSourceOutputNumber : CULong,
    inDestNode : CLong,
    inDestInputNumber : CULong) : CLong;

external AUGraphSetNodeInputCallback(
    inGraph : AUGraph,
    inDestNode : CLong,
    inDestInputNumber : CULong,
    inInputCallback : Pointer[AURenderCallbackStruct]) : CLong;

external AUGraphDisconnectNodeInput(
    inGraph : AUGraph,
    inDestNode : CLong,
    inDestInputNumber : CULong) : CLong;

external AUGraphClearConnections(
    inGraph : AUGraph) : CLong;

external AUGraphGetNumberOfInteractions(
    inGraph : AUGraph,
    outNumInteractions : Pointer[CULong]) : CLong;

external AUGraphGetInteractionInfo(
    inGraph : AUGraph,
    inInteractionIndex : CULong,
    outInteraction : Pointer[AUNodeInteraction]) : CLong;

external AUGraphCountNodeInteractions(
    inGraph : AUGraph,
    inNode : CLong,
    outNumInteractions : Pointer[CULong]) : CLong;

external AUGraphGetNodeInteractions(
    inGraph : AUGraph,
    inNode : CLong,
    ioNumInteractions : Pointer[CULong],
    outInteractions : Pointer[AUNodeInteraction]) : CLong;

external AUGraphUpdate(
    inGraph : AUGraph,
    outIsUpdated : Pointer[CUChar]) : CLong;

external AUGraphOpen(
    inGraph : AUGraph) : CLong;

external AUGraphClose(
    inGraph : AUGraph) : CLong;

external AUGraphInitialize(
    inGraph : AUGraph) : CLong;

external AUGraphUninitialize(
    inGraph : AUGraph) : CLong;

external AUGraphStart(
    inGraph : AUGraph) : CLong;

external AUGraphStop(
    inGraph : AUGraph) : CLong;

external AUGraphIsOpen(
    inGraph : AUGraph,
    outIsOpen : Pointer[CUChar]) : CLong;

external AUGraphIsInitialized(
    inGraph : AUGraph,
    outIsInitialized : Pointer[CUChar]) : CLong;

external AUGraphIsRunning(
    inGraph : AUGraph,
    outIsRunning : Pointer[CUChar]) : CLong;

external AUGraphGetCPULoad(
    inGraph : AUGraph,
    outAverageCPULoad : Pointer[Float]) : CLong;

external AUGraphGetMaxCPULoad(
    inGraph : AUGraph,
    outMaxLoad : Pointer[Float]) : CLong;

external AUGraphAddRenderNotify(
    inGraph : AUGraph,
    inCallback : AURenderCallback,
    inRefCon : RawPointer) : CLong;

external AUGraphRemoveRenderNotify(
    inGraph : AUGraph,
    inCallback : AURenderCallback,
    inRefCon : RawPointer) : CLong;

alias AudioConverterRef = OpaquePointer;

alias AudioConverterPropertyID = CULong;

alias kAudioConverterPropertyMinimumInputBufferSize = 1835623027;
alias kAudioConverterPropertyMinimumOutputBufferSize = 1836016243;
alias kAudioConverterPropertyMaximumInputBufferSize = 2020172403;
alias kAudioConverterPropertyMaximumInputPacketSize = 2020175987;
alias kAudioConverterPropertyMaximumOutputPacketSize = 2020569203;
alias kAudioConverterPropertyCalculateInputBufferSize = 1667850867;
alias kAudioConverterPropertyCalculateOutputBufferSize = 1668244083;
alias kAudioConverterPropertyInputCodecParameters = 1768121456;
alias kAudioConverterPropertyOutputCodecParameters = 1868784752;
alias kAudioConverterSampleRateConverterAlgorithm = 1936876393;
alias kAudioConverterSampleRateConverterComplexity = 1936876385;
alias kAudioConverterSampleRateConverterQuality = 1936876401;
alias kAudioConverterSampleRateConverterInitialPhase = 1936876400;
alias kAudioConverterCodecQuality = 1667527029;
alias kAudioConverterPrimeMethod = 1886547309;
alias kAudioConverterPrimeInfo = 1886546285;
alias kAudioConverterChannelMap = 1667788144;
alias kAudioConverterDecompressionMagicCookie = 1684891491;
alias kAudioConverterCompressionMagicCookie = 1668114275;
alias kAudioConverterEncodeBitRate = 1651663220;
alias kAudioConverterEncodeAdjustableSampleRate = 1634366322;
alias kAudioConverterInputChannelLayout = 1768123424;
alias kAudioConverterOutputChannelLayout = 1868786720;
alias kAudioConverterApplicableEncodeBitRates = 1634034290;
alias kAudioConverterAvailableEncodeBitRates = 1986355826;
alias kAudioConverterApplicableEncodeSampleRates = 1634038642;
alias kAudioConverterAvailableEncodeSampleRates = 1986360178;
alias kAudioConverterAvailableEncodeChannelLayoutTags = 1634034540;
alias kAudioConverterCurrentOutputStreamDescription = 1633906532;
alias kAudioConverterCurrentInputStreamDescription = 1633904996;
alias kAudioConverterPropertySettings = 1633906803;
alias kAudioConverterPropertyBitDepthHint = 1633903204;
alias kAudioConverterPropertyFormatList = 1718383476;

alias kAudioConverterPropertyCanResumeFromInterruption = 1668441705;

alias kAudioConverterQuality_Max = 127;
alias kAudioConverterQuality_High = 96;
alias kAudioConverterQuality_Medium = 64;
alias kAudioConverterQuality_Low = 32;
alias kAudioConverterQuality_Min = 0;

alias kAudioConverterSampleRateConverterComplexity_Linear = 1818848869;
alias kAudioConverterSampleRateConverterComplexity_Normal = 1852797549;
alias kAudioConverterSampleRateConverterComplexity_Mastering = 1650553971;

alias kConverterPrimeMethod_Pre = 0;
alias kConverterPrimeMethod_Normal = 1;
alias kConverterPrimeMethod_None = 2;

record Struct_AudioConverterPrimeInfo (
    leadingFrames : CULong,
    trailingFrames : CULong,
);

alias AudioConverterPrimeInfo = Struct_AudioConverterPrimeInfo;

alias kAudioConverterErr_FormatNotSupported = 1718449215;
alias kAudioConverterErr_OperationNotSupported = 1869627199;
alias kAudioConverterErr_PropertyNotSupported = 1886547824;
alias kAudioConverterErr_InvalidInputSize = 1768846202;
alias kAudioConverterErr_InvalidOutputSize = 1869902714;
alias kAudioConverterErr_UnspecifiedError = 2003329396;
alias kAudioConverterErr_BadPropertySizeError = 561211770;
alias kAudioConverterErr_RequiresPacketDescriptionsError = 561015652;
alias kAudioConverterErr_InputSampleRateOutOfRange = 560558962;
alias kAudioConverterErr_OutputSampleRateOutOfRange = 560952178;

alias kAudioConverterErr_HardwareInUse = 1752656245;

external AudioConverterNew(
    inSourceFormat : Pointer[AudioStreamBasicDescription],
    inDestinationFormat : Pointer[AudioStreamBasicDescription],
    outAudioConverter : Pointer[AudioConverterRef]) : CLong;

external AudioConverterNewSpecific(
    inSourceFormat : Pointer[AudioStreamBasicDescription],
    inDestinationFormat : Pointer[AudioStreamBasicDescription],
    inNumberClassDescriptions : CULong,
    inClassDescriptions : Pointer[AudioClassDescription],
    outAudioConverter : Pointer[AudioConverterRef]) : CLong;

external AudioConverterDispose(
    inAudioConverter : AudioConverterRef) : CLong;

external AudioConverterReset(
    inAudioConverter : AudioConverterRef) : CLong;

external AudioConverterGetPropertyInfo(
    inAudioConverter : AudioConverterRef,
    inPropertyID : CULong,
    outSize : Pointer[CULong],
    outWritable : Pointer[CUChar]) : CLong;

external AudioConverterGetProperty(
    inAudioConverter : AudioConverterRef,
    inPropertyID : CULong,
    ioPropertyDataSize : Pointer[CULong],
    outPropertyData : RawPointer) : CLong;

external AudioConverterSetProperty(
    inAudioConverter : AudioConverterRef,
    inPropertyID : CULong,
    inPropertyDataSize : CULong,
    inPropertyData : RawPointer) : CLong;

alias AudioConverterInputDataProc = CCodePointer[[OpaquePointer,Pointer[CULong],Pointer[RawPointer],RawPointer],[CLong]];

external AudioConverterConvertBuffer(
    inAudioConverter : AudioConverterRef,
    inInputDataSize : CULong,
    inInputData : RawPointer,
    ioOutputDataSize : Pointer[CULong],
    outOutputData : RawPointer) : CLong;

alias AudioConverterComplexInputDataProc = CCodePointer[[OpaquePointer,Pointer[CULong],Pointer[Struct_AudioBufferList],Pointer[Pointer[Struct_AudioStreamPacketDescription]],RawPointer],[CLong]];

external AudioConverterFillComplexBuffer(
    inAudioConverter : AudioConverterRef,
    inInputDataProc : AudioConverterComplexInputDataProc,
    inInputDataProcUserData : RawPointer,
    ioOutputDataPacketSize : Pointer[CULong],
    outOutputData : Pointer[AudioBufferList],
    outPacketDescription : Pointer[AudioStreamPacketDescription]) : CLong;

alias ExtAudioFileRef = OpaquePointer;

alias kExtAudioFileProperty_FileDataFormat = 1717988724;
alias kExtAudioFileProperty_FileChannelLayout = 1717791855;
alias kExtAudioFileProperty_ClientDataFormat = 1667657076;
alias kExtAudioFileProperty_ClientChannelLayout = 1667460207;
alias kExtAudioFileProperty_CodecManufacturer = 1668112750;
alias kExtAudioFileProperty_AudioConverter = 1633906294;
alias kExtAudioFileProperty_AudioFile = 1634101612;
alias kExtAudioFileProperty_FileMaxPacketSize = 1718448243;
alias kExtAudioFileProperty_ClientMaxPacketSize = 1668116595;
alias kExtAudioFileProperty_FileLengthFrames = 593916525;
alias kExtAudioFileProperty_ConverterConfig = 1633903462;
alias kExtAudioFileProperty_IOBufferSizeBytes = 1768907379;
alias kExtAudioFileProperty_IOBuffer = 1768907366;
alias kExtAudioFileProperty_PacketTable = 2020635753;

alias ExtAudioFilePropertyID = CULong;

alias kExtAudioFileError_CodecUnavailableInputConsumed = 4294900737;
alias kExtAudioFileError_CodecUnavailableInputNotConsumed = 4294900736;
alias kExtAudioFileError_InvalidProperty = 4294900735;
alias kExtAudioFileError_InvalidPropertySize = 4294900734;
alias kExtAudioFileError_NonPCMClientFormat = 4294900733;
alias kExtAudioFileError_InvalidChannelMap = 4294900732;
alias kExtAudioFileError_InvalidOperationOrder = 4294900731;
alias kExtAudioFileError_InvalidDataFormat = 4294900730;
alias kExtAudioFileError_MaxPacketSizeUnknown = 4294900729;
alias kExtAudioFileError_InvalidSeek = 4294900728;
alias kExtAudioFileError_AsyncWriteTooLarge = 4294900727;
alias kExtAudioFileError_AsyncWriteBufferOverflow = 4294900726;

external ExtAudioFileOpenURL(
    inURL : CFURLRef,
    outExtAudioFile : Pointer[ExtAudioFileRef]) : CLong;

external ExtAudioFileWrapAudioFileID(
    inFileID : AudioFileID,
    inForWriting : CUChar,
    outExtAudioFile : Pointer[ExtAudioFileRef]) : CLong;

external ExtAudioFileCreateWithURL(
    inURL : CFURLRef,
    inFileType : CULong,
    inStreamDesc : Pointer[AudioStreamBasicDescription],
    inChannelLayout : Pointer[AudioChannelLayout],
    inFlags : CULong,
    outExtAudioFile : Pointer[ExtAudioFileRef]) : CLong;

external ExtAudioFileDispose(
    inExtAudioFile : ExtAudioFileRef) : CLong;

external ExtAudioFileRead(
    inExtAudioFile : ExtAudioFileRef,
    ioNumberFrames : Pointer[CULong],
    ioData : Pointer[AudioBufferList]) : CLong;

external ExtAudioFileWrite(
    inExtAudioFile : ExtAudioFileRef,
    inNumberFrames : CULong,
    ioData : Pointer[AudioBufferList]) : CLong;

external ExtAudioFileWriteAsync(
    inExtAudioFile : ExtAudioFileRef,
    inNumberFrames : CULong,
    ioData : Pointer[AudioBufferList]) : CLong;

external ExtAudioFileSeek(
    inExtAudioFile : ExtAudioFileRef,
    inFrameOffset : Int64) : CLong;

external ExtAudioFileTell(
    inExtAudioFile : ExtAudioFileRef,
    outFrameOffset : Pointer[Int64]) : CLong;

external ExtAudioFileGetPropertyInfo(
    inExtAudioFile : ExtAudioFileRef,
    inPropertyID : CULong,
    outSize : Pointer[CULong],
    outWritable : Pointer[CUChar]) : CLong;

external ExtAudioFileGetProperty(
    inExtAudioFile : ExtAudioFileRef,
    inPropertyID : CULong,
    ioPropertyDataSize : Pointer[CULong],
    outPropertyData : RawPointer) : CLong;

external ExtAudioFileSetProperty(
    inExtAudioFile : ExtAudioFileRef,
    inPropertyID : CULong,
    inPropertyDataSize : CULong,
    inPropertyData : RawPointer) : CLong;

external CAShow(
    inObject : RawPointer);

external CAShowFile(
    inObject : RawPointer,
    inFile : Pointer[FILE]);
