// 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 = UInt;

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 kAudioFileFlags_EraseFile = 1;
alias kAudioFileFlags_DontPageAlignAudioData = 2;

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

alias AudioFileID = OpaquePointer;

alias AudioFilePropertyID = UInt;

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 : UInt,
);

alias AudioFile_SMPTE_Time = Struct_AudioFile_SMPTE_Time;

alias kAudioFileMarkerType_Generic = 0;

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

alias AudioFileMarker = Struct_AudioFileMarker;

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

alias AudioFileMarkerList = Struct_AudioFileMarkerList;

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

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

alias AudioFileRegion = Struct_AudioFileRegion;

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

alias AudioFileRegionList = Struct_AudioFileRegionList;

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

alias AudioFramePacketTranslation = Struct_AudioFramePacketTranslation;

alias kBytePacketTranslationFlag_IsEstimate = 1;

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

alias AudioBytePacketTranslation = Struct_AudioBytePacketTranslation;

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

alias AudioFilePacketTableInfo = Struct_AudioFilePacketTableInfo;

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

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

alias AudioFile_ReadProc = CCodePointer[[RawPointer,Int64,UInt,RawPointer,Pointer[UInt]],[Int]];

alias AudioFile_WriteProc = CCodePointer[[RawPointer,Int64,UInt,RawPointer,Pointer[UInt]],[Int]];

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

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

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

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

external AudioFileClose(
    inAudioFile : AudioFileID) : Int;

external AudioFileOptimize(
    inAudioFile : AudioFileID) : Int;

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

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

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

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

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

external AudioFileCountUserData(
    inAudioFile : AudioFileID,
    inUserDataID : UInt,
    outNumberItems : Pointer[UInt]) : Int;

external AudioFileGetUserDataSize(
    inAudioFile : AudioFileID,
    inUserDataID : UInt,
    inIndex : UInt,
    outUserDataSize : Pointer[UInt]) : Int;

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

external AudioFileSetUserData(
    inAudioFile : AudioFileID,
    inUserDataID : UInt,
    inIndex : UInt,
    inUserDataSize : UInt,
    inUserData : RawPointer) : Int;

external AudioFileRemoveUserData(
    inAudioFile : AudioFileID,
    inUserDataID : UInt,
    inIndex : UInt) : Int;

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 : UInt,
    outDataSize : Pointer[UInt],
    isWritable : Pointer[UInt]) : Int;

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

external AudioFileSetProperty(
    inAudioFile : AudioFileID,
    inPropertyID : UInt,
    inDataSize : UInt,
    inPropertyData : RawPointer) : Int;

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 : UInt,
    mFormatID : UInt,
);

alias AudioFileTypeAndFormatID = Struct_AudioFileTypeAndFormatID;

external AudioFileGetGlobalInfoSize(
    inPropertyID : UInt,
    inSpecifierSize : UInt,
    inSpecifier : RawPointer,
    outDataSize : Pointer[UInt]) : Int;

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

external AudioFileCreate(
    inParentRef : OpaquePointer,
    inFileName : CFStringRef,
    inFileType : UInt,
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : UInt,
    outNewFileRef : OpaquePointer,
    outAudioFile : Pointer[AudioFileID]) : Int;

external AudioFileInitialize(
    inFileRef : OpaquePointer,
    inFileType : UInt,
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : UInt,
    outAudioFile : Pointer[AudioFileID]) : Int;

external AudioFileOpen(
    inFileRef : OpaquePointer,
    inPermissions : CChar,
    inFileTypeHint : UInt,
    outAudioFile : Pointer[AudioFileID]) : Int;

alias AudioFileStreamPropertyID = UInt;

alias AudioFileStreamID = OpaquePointer;

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

alias AudioFileStream_PacketsProc = CCodePointer[[RawPointer,UInt,UInt,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 : UInt,
    outAudioFileStream : Pointer[AudioFileStreamID]) : Int;

external AudioFileStreamParseBytes(
    inAudioFileStream : AudioFileStreamID,
    inDataByteSize : UInt,
    inData : RawPointer,
    inFlags : UInt) : Int;

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

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

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

external AudioFileStreamSetProperty(
    inAudioFileStream : AudioFileStreamID,
    inPropertyID : UInt,
    inPropertyDataSize : UInt,
    inPropertyData : RawPointer) : Int;

external AudioFileStreamClose(
    inAudioFileStream : AudioFileStreamID) : Int;

alias AudioFormatPropertyID = UInt;

alias kPanningMode_SoundField = 3;
alias kPanningMode_VectorBasedPanning = 4;

record Struct_AudioPanningInfo (
    mPanningMode : UInt,
    mCoordinateFlags : UInt,
    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 : UInt,
    mChannelLayout : Pointer[AudioChannelLayout],
);

alias AudioBalanceFade = Struct_AudioBalanceFade;

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

alias AudioFormatInfo = Struct_AudioFormatInfo;

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

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_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;

external AudioFormatGetPropertyInfo(
    inPropertyID : UInt,
    inSpecifierSize : UInt,
    inSpecifier : RawPointer,
    outPropertyDataSize : Pointer[UInt]) : Int;

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

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_EnqueueDuringReset = 4294900664;

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_EnableTimePitch = 1902081136;
alias kAudioQueueProperty_TimePitchAlgorithm = 1903456353;
alias kAudioQueueProperty_TimePitchBypass = 1903456354;

alias kAudioQueueTimePitchAlgorithm_Spectral = 1936745827;
alias kAudioQueueTimePitchAlgorithm_TimeDomain = 1953064047;

alias kAudioQueueParam_Volume = 1;
alias kAudioQueueParam_PlayRate = 2;
alias kAudioQueueParam_Pitch = 3;

alias AudioQueuePropertyID = UInt;

alias AudioQueueParameterID = UInt;

alias AudioQueueParameterValue = Float;

alias AudioQueueRef = OpaquePointer;

alias AudioQueueTimelineRef = OpaquePointer;

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

alias AudioQueueBuffer = Struct_AudioQueueBuffer;

alias AudioQueueBufferRef = Pointer[AudioQueueBuffer];

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

alias AudioQueueParameterEvent = Struct_AudioQueueParameterEvent;

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

alias AudioQueueLevelMeterState = Struct_AudioQueueLevelMeterState;

alias AudioQueueOutputCallbackBlock = UnknownType;

alias AudioQueueInputCallbackBlock = UnknownType;

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

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

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

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

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

external AudioQueueNewOutputWithDispatchQueue(
    outAQ : Pointer[AudioQueueRef],
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : UInt,
    inCallbackDispatchQueue : dispatch_queue_t,
    inCallbackBlock : AudioQueueOutputCallbackBlock) : Int;

external AudioQueueNewInputWithDispatchQueue(
    outAQ : Pointer[AudioQueueRef],
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : UInt,
    inCallbackDispatchQueue : dispatch_queue_t,
    inCallbackBlock : AudioQueueInputCallbackBlock) : Int;

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

external AudioQueueAllocateBuffer(
    inAQ : AudioQueueRef,
    inBufferByteSize : UInt,
    outBuffer : Pointer[AudioQueueBufferRef]) : Int;

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

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

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

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

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

external AudioQueuePrime(
    inAQ : AudioQueueRef,
    inNumberOfFramesToPrepare : UInt,
    outNumberOfFramesPrepared : Pointer[UInt]) : Int;

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

external AudioQueuePause(
    inAQ : AudioQueueRef) : Int;

external AudioQueueFlush(
    inAQ : AudioQueueRef) : Int;

external AudioQueueReset(
    inAQ : AudioQueueRef) : Int;

external AudioQueueGetParameter(
    inAQ : AudioQueueRef,
    inParamID : UInt,
    outValue : Pointer[Float]) : Int;

external AudioQueueSetParameter(
    inAQ : AudioQueueRef,
    inParamID : UInt,
    inValue : Float) : Int;

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

external AudioQueueSetProperty(
    inAQ : AudioQueueRef,
    inID : UInt,
    inData : RawPointer,
    inDataSize : UInt) : Int;

external AudioQueueGetPropertySize(
    inAQ : AudioQueueRef,
    inID : UInt,
    outDataSize : Pointer[UInt]) : Int;

external AudioQueueAddPropertyListener(
    inAQ : AudioQueueRef,
    inID : UInt,
    inProc : AudioQueuePropertyListenerProc,
    inUserData : RawPointer) : Int;

external AudioQueueRemovePropertyListener(
    inAQ : AudioQueueRef,
    inID : UInt,
    inProc : AudioQueuePropertyListenerProc,
    inUserData : RawPointer) : Int;

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

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

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

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

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

external AudioQueueDeviceGetNearestStartTime(
    inAQ : AudioQueueRef,
    ioRequestedStartTime : Pointer[AudioTimeStamp],
    inFlags : UInt) : Int;

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

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

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

alias SystemSoundID = UInt;

alias AudioServicesPropertyID = UInt;

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

alias kSystemSoundID_UserPreferredAlert = 4096;
alias kSystemSoundID_FlashScreen = 4094;
alias kUserPreferredAlert = 4096;

alias kAudioServicesPropertyIsUISound = 1769174377;
alias kAudioServicesPropertyCompletePlaybackIfAppDies = 1768318057;

external AudioServicesPlayAlertSound(
    inSystemSoundID : UInt);

external AudioServicesPlaySystemSound(
    inSystemSoundID : UInt);

external AudioServicesCreateSystemSoundID(
    inFileURL : CFURLRef,
    outSystemSoundID : Pointer[UInt]) : Int;

external AudioServicesDisposeSystemSoundID(
    inSystemSoundID : UInt) : Int;

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

external AudioServicesRemoveSystemSoundCompletion(
    inSystemSoundID : UInt);

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

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

external AudioServicesSetProperty(
    inPropertyID : UInt,
    inSpecifierSize : UInt,
    inSpecifier : RawPointer,
    inPropertyDataSize : UInt,
    inPropertyData : RawPointer) : Int;

alias kAudioHardwareServiceProperty_ServiceRestarted = 1936880500;
alias kAudioHardwareServiceDeviceProperty_VirtualMasterVolume = 1986885219;
alias kAudioHardwareServiceDeviceProperty_VirtualMasterBalance = 1986880099;

external AudioHardwareServiceHasProperty(
    inObjectID : UInt,
    inAddress : Pointer[AudioObjectPropertyAddress]) : CUChar;

external AudioHardwareServiceIsPropertySettable(
    inObjectID : UInt,
    inAddress : Pointer[AudioObjectPropertyAddress],
    outIsSettable : Pointer[CUChar]) : Int;

external AudioHardwareServiceGetPropertyDataSize(
    inObjectID : UInt,
    inAddress : Pointer[AudioObjectPropertyAddress],
    inQualifierDataSize : UInt,
    inQualifierData : RawPointer,
    outDataSize : Pointer[UInt]) : Int;

external AudioHardwareServiceGetPropertyData(
    inObjectID : UInt,
    inAddress : Pointer[AudioObjectPropertyAddress],
    inQualifierDataSize : UInt,
    inQualifierData : RawPointer,
    ioDataSize : Pointer[UInt],
    outData : RawPointer) : Int;

external AudioHardwareServiceSetPropertyData(
    inObjectID : UInt,
    inAddress : Pointer[AudioObjectPropertyAddress],
    inQualifierDataSize : UInt,
    inQualifierData : RawPointer,
    inDataSize : UInt,
    inData : RawPointer) : Int;

external AudioHardwareServiceAddPropertyListener(
    inObjectID : UInt,
    inAddress : Pointer[AudioObjectPropertyAddress],
    inListener : AudioObjectPropertyListenerProc,
    inClientData : RawPointer) : Int;

external AudioHardwareServiceRemovePropertyListener(
    inObjectID : UInt,
    inAddress : Pointer[AudioObjectPropertyAddress],
    inListener : AudioObjectPropertyListenerProc,
    inClientData : RawPointer) : Int;

alias AUGraph = OpaquePointer;

alias AUNode = Int;

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]) : Int;

external DisposeAUGraph(
    inGraph : AUGraph) : Int;

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

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

external AUGraphGetNodeCount(
    inGraph : AUGraph,
    outNumberOfNodes : Pointer[UInt]) : Int;

external AUGraphGetIndNode(
    inGraph : AUGraph,
    inIndex : UInt,
    outNode : Pointer[Int]) : Int;

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

external AUGraphNewNodeSubGraph(
    inGraph : AUGraph,
    outNode : Pointer[Int]) : Int;

external AUGraphGetNodeInfoSubGraph(
    inGraph : AUGraph,
    inNode : Int,
    outSubGraph : Pointer[AUGraph]) : Int;

external AUGraphIsNodeSubGraph(
    inGraph : AUGraph,
    inNode : Int,
    outFlag : Pointer[CUChar]) : Int;

alias kAUNodeInteraction_Connection = 1;
alias kAUNodeInteraction_InputCallback = 2;

record Struct_AudioUnitNodeConnection (
    sourceNode : Int,
    sourceOutputNumber : UInt,
    destNode : Int,
    destInputNumber : UInt,
);

alias AudioUnitNodeConnection = Struct_AudioUnitNodeConnection;

alias AUNodeConnection = Struct_AudioUnitNodeConnection;

record Struct_AUNodeRenderCallback (
    destNode : Int,
    destInputNumber : UInt,
    cback : AURenderCallbackStruct,
);

alias AUNodeRenderCallback = Struct_AUNodeRenderCallback;

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

alias AUNodeInteraction = Struct_AUNodeInteraction;

external AUGraphConnectNodeInput(
    inGraph : AUGraph,
    inSourceNode : Int,
    inSourceOutputNumber : UInt,
    inDestNode : Int,
    inDestInputNumber : UInt) : Int;

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

external AUGraphDisconnectNodeInput(
    inGraph : AUGraph,
    inDestNode : Int,
    inDestInputNumber : UInt) : Int;

external AUGraphClearConnections(
    inGraph : AUGraph) : Int;

external AUGraphGetNumberOfInteractions(
    inGraph : AUGraph,
    outNumInteractions : Pointer[UInt]) : Int;

external AUGraphGetInteractionInfo(
    inGraph : AUGraph,
    inInteractionIndex : UInt,
    outInteraction : Pointer[AUNodeInteraction]) : Int;

external AUGraphCountNodeInteractions(
    inGraph : AUGraph,
    inNode : Int,
    outNumInteractions : Pointer[UInt]) : Int;

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

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

external AUGraphOpen(
    inGraph : AUGraph) : Int;

external AUGraphClose(
    inGraph : AUGraph) : Int;

external AUGraphInitialize(
    inGraph : AUGraph) : Int;

external AUGraphUninitialize(
    inGraph : AUGraph) : Int;

external AUGraphStart(
    inGraph : AUGraph) : Int;

external AUGraphStop(
    inGraph : AUGraph) : Int;

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

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

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

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

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

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

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

external AUGraphNewNode(
    inGraph : AUGraph,
    inDescription : OpaquePointer,
    inClassDataSize : UInt,
    inClassData : RawPointer,
    outNode : Pointer[Int]) : Int;

external AUGraphGetNodeInfo(
    inGraph : AUGraph,
    inNode : Int,
    outDescription : OpaquePointer,
    outClassDataSize : Pointer[UInt],
    outClassData : Pointer[RawPointer],
    outAudioUnit : Pointer[AudioUnit]) : Int;

external AUGraphGetNumberOfConnections(
    inGraph : AUGraph,
    outNumConnections : Pointer[UInt]) : Int;

external AUGraphGetConnectionInfo(
    inGraph : AUGraph,
    inConnectionIndex : UInt,
    outSourceNode : Pointer[Int],
    outSourceOutputNumber : Pointer[UInt],
    outDestNode : Pointer[Int],
    outDestInputNumber : Pointer[UInt]) : Int;

external AUGraphCountNodeConnections(
    inGraph : AUGraph,
    inNode : Int,
    outNumConnections : Pointer[UInt]) : Int;

external AUGraphGetNodeConnections(
    inGraph : AUGraph,
    inNode : Int,
    outConnections : Pointer[AudioUnitNodeConnection],
    ioNumConnections : Pointer[UInt]) : Int;

alias AudioConverterRef = OpaquePointer;

alias AudioConverterPropertyID = UInt;

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 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 : UInt,
    trailingFrames : UInt,
);

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;

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

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

external AudioConverterDispose(
    inAudioConverter : AudioConverterRef) : Int;

external AudioConverterReset(
    inAudioConverter : AudioConverterRef) : Int;

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

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

external AudioConverterSetProperty(
    inAudioConverter : AudioConverterRef,
    inPropertyID : UInt,
    inPropertyDataSize : UInt,
    inPropertyData : RawPointer) : Int;

alias AudioConverterInputDataProc = CCodePointer[[OpaquePointer,Pointer[UInt],Pointer[RawPointer],RawPointer],[Int]];

external AudioConverterFillBuffer(
    inAudioConverter : AudioConverterRef,
    inInputDataProc : AudioConverterInputDataProc,
    inInputDataProcUserData : RawPointer,
    ioOutputDataSize : Pointer[UInt],
    outOutputData : RawPointer) : Int;

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

alias AudioConverterComplexInputDataProc = CCodePointer[[OpaquePointer,Pointer[UInt],Pointer[Struct_AudioBufferList],Pointer[Pointer[Struct_AudioStreamPacketDescription]],RawPointer],[Int]];

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

alias ExtAudioFileRef = OpaquePointer;

alias kExtAudioFileProperty_FileDataFormat = 1717988724;
alias kExtAudioFileProperty_FileChannelLayout = 1717791855;
alias kExtAudioFileProperty_ClientDataFormat = 1667657076;
alias kExtAudioFileProperty_ClientChannelLayout = 1667460207;
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 ExtAudioFilePropertyID = UInt;

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]) : Int;

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

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

external ExtAudioFileOpen(
    inFSRef : OpaquePointer,
    outExtAudioFile : Pointer[ExtAudioFileRef]) : Int;

external ExtAudioFileCreateNew(
    inParentDir : OpaquePointer,
    inFileName : CFStringRef,
    inFileType : UInt,
    inStreamDesc : Pointer[AudioStreamBasicDescription],
    inChannelLayout : Pointer[AudioChannelLayout],
    outExtAudioFile : Pointer[ExtAudioFileRef]) : Int;

external ExtAudioFileDispose(
    inExtAudioFile : ExtAudioFileRef) : Int;

external ExtAudioFileRead(
    inExtAudioFile : ExtAudioFileRef,
    ioNumberFrames : Pointer[UInt],
    ioData : Pointer[AudioBufferList]) : Int;

external ExtAudioFileWrite(
    inExtAudioFile : ExtAudioFileRef,
    inNumberFrames : UInt,
    ioData : Pointer[AudioBufferList]) : Int;

external ExtAudioFileWriteAsync(
    inExtAudioFile : ExtAudioFileRef,
    inNumberFrames : UInt,
    ioData : Pointer[AudioBufferList]) : Int;

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

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

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

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

external ExtAudioFileSetProperty(
    inExtAudioFile : ExtAudioFileRef,
    inPropertyID : UInt,
    inPropertyDataSize : UInt,
    inPropertyData : RawPointer) : Int;

alias AudioFileComponent = AudioComponentInstance;

alias AudioFileComponentPropertyID = UInt;

external AudioFileComponentCreateURL(
    inComponent : AudioFileComponent,
    inFileRef : CFURLRef,
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : UInt) : Int;

external AudioFileComponentOpenURL(
    inComponent : AudioFileComponent,
    inFileRef : CFURLRef,
    inPermissions : CChar,
    inFileDescriptor : Int) : Int;

external AudioFileComponentOpenWithCallbacks(
    inComponent : AudioFileComponent,
    inClientData : RawPointer,
    inReadFunc : AudioFile_ReadProc,
    inWriteFunc : AudioFile_WriteProc,
    inGetSizeFunc : AudioFile_GetSizeProc,
    inSetSizeFunc : AudioFile_SetSizeProc) : Int;

external AudioFileComponentInitializeWithCallbacks(
    inComponent : AudioFileComponent,
    inClientData : RawPointer,
    inReadFunc : AudioFile_ReadProc,
    inWriteFunc : AudioFile_WriteProc,
    inGetSizeFunc : AudioFile_GetSizeProc,
    inSetSizeFunc : AudioFile_SetSizeProc,
    inFileType : UInt,
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : UInt) : Int;

external AudioFileComponentCloseFile(
    inComponent : AudioFileComponent) : Int;

external AudioFileComponentOptimize(
    inComponent : AudioFileComponent) : Int;

external AudioFileComponentReadBytes(
    inComponent : AudioFileComponent,
    inUseCache : CUChar,
    inStartingByte : Int64,
    ioNumBytes : Pointer[UInt],
    outBuffer : RawPointer) : Int;

external AudioFileComponentWriteBytes(
    inComponent : AudioFileComponent,
    inUseCache : CUChar,
    inStartingByte : Int64,
    ioNumBytes : Pointer[UInt],
    inBuffer : RawPointer) : Int;

external AudioFileComponentReadPackets(
    inComponent : AudioFileComponent,
    inUseCache : CUChar,
    outNumBytes : Pointer[UInt],
    outPacketDescriptions : Pointer[AudioStreamPacketDescription],
    inStartingPacket : Int64,
    ioNumPackets : Pointer[UInt],
    outBuffer : RawPointer) : Int;

external AudioFileComponentReadPacketData(
    inComponent : AudioFileComponent,
    inUseCache : CUChar,
    ioNumBytes : Pointer[UInt],
    outPacketDescriptions : Pointer[AudioStreamPacketDescription],
    inStartingPacket : Int64,
    ioNumPackets : Pointer[UInt],
    outBuffer : RawPointer) : Int;

external AudioFileComponentWritePackets(
    inComponent : AudioFileComponent,
    inUseCache : CUChar,
    inNumBytes : UInt,
    inPacketDescriptions : Pointer[AudioStreamPacketDescription],
    inStartingPacket : Int64,
    ioNumPackets : Pointer[UInt],
    inBuffer : RawPointer) : Int;

external AudioFileComponentGetPropertyInfo(
    inComponent : AudioFileComponent,
    inPropertyID : UInt,
    outPropertySize : Pointer[UInt],
    outWritable : Pointer[UInt]) : Int;

external AudioFileComponentGetProperty(
    inComponent : AudioFileComponent,
    inPropertyID : UInt,
    ioPropertyDataSize : Pointer[UInt],
    outPropertyData : RawPointer) : Int;

external AudioFileComponentSetProperty(
    inComponent : AudioFileComponent,
    inPropertyID : UInt,
    inPropertyDataSize : UInt,
    inPropertyData : RawPointer) : Int;

external AudioFileComponentCountUserData(
    inComponent : AudioFileComponent,
    inUserDataID : UInt,
    outNumberItems : Pointer[UInt]) : Int;

external AudioFileComponentGetUserDataSize(
    inComponent : AudioFileComponent,
    inUserDataID : UInt,
    inIndex : UInt,
    outUserDataSize : Pointer[UInt]) : Int;

external AudioFileComponentGetUserData(
    inComponent : AudioFileComponent,
    inUserDataID : UInt,
    inIndex : UInt,
    ioUserDataSize : Pointer[UInt],
    outUserData : RawPointer) : Int;

external AudioFileComponentSetUserData(
    inComponent : AudioFileComponent,
    inUserDataID : UInt,
    inIndex : UInt,
    inUserDataSize : UInt,
    inUserData : RawPointer) : Int;

external AudioFileComponentRemoveUserData(
    inComponent : AudioFileComponent,
    inUserDataID : UInt,
    inIndex : UInt) : Int;

external AudioFileComponentExtensionIsThisFormat(
    inComponent : AudioFileComponent,
    inExtension : CFStringRef,
    outResult : Pointer[UInt]) : Int;

external AudioFileComponentFileDataIsThisFormat(
    inComponent : AudioFileComponent,
    inDataByteSize : UInt,
    inData : RawPointer,
    outResult : Pointer[UInt]) : Int;

external AudioFileComponentFileIsThisFormat(
    inComponent : AudioFileComponent,
    inFileRefNum : Short,
    outResult : Pointer[UInt]) : Int;

external AudioFileComponentDataIsThisFormat(
    inComponent : AudioFileComponent,
    inClientData : RawPointer,
    inReadFunc : AudioFile_ReadProc,
    inWriteFunc : AudioFile_WriteProc,
    inGetSizeFunc : AudioFile_GetSizeProc,
    inSetSizeFunc : AudioFile_SetSizeProc,
    outResult : Pointer[UInt]) : Int;

external AudioFileComponentGetGlobalInfoSize(
    inComponent : AudioFileComponent,
    inPropertyID : UInt,
    inSpecifierSize : UInt,
    inSpecifier : RawPointer,
    outPropertySize : Pointer[UInt]) : Int;

external AudioFileComponentGetGlobalInfo(
    inComponent : AudioFileComponent,
    inPropertyID : UInt,
    inSpecifierSize : UInt,
    inSpecifier : RawPointer,
    ioPropertyDataSize : Pointer[UInt],
    outPropertyData : RawPointer) : Int;

alias kAudioFileComponent_CanRead = 1668182628;
alias kAudioFileComponent_CanWrite = 1668183922;
alias kAudioFileComponent_FileTypeName = 1718906477;
alias kAudioFileComponent_ExtensionsForType = 1717926004;
alias kAudioFileComponent_AvailableFormatIDs = 1718446436;
alias kAudioFileComponent_AvailableStreamDescriptionsForFormat = 1935960420;
alias kAudioFileComponent_FastDispatchTable = 1717855860;
alias kAudioFileComponent_HFSTypeCodesForType = 1718118003;

alias kAudioFileCreateSelect = 1;
alias kAudioFileOpenSelect = 2;
alias kAudioFileInitializeSelect = 3;
alias kAudioFileOpenWithCallbacksSelect = 4;
alias kAudioFileInitializeWithCallbacksSelect = 5;
alias kAudioFileCloseSelect = 6;
alias kAudioFileOptimizeSelect = 7;
alias kAudioFileReadBytesSelect = 8;
alias kAudioFileWriteBytesSelect = 9;
alias kAudioFileReadPacketsSelect = 10;
alias kAudioFileWritePacketsSelect = 11;
alias kAudioFileGetPropertyInfoSelect = 12;
alias kAudioFileGetPropertySelect = 13;
alias kAudioFileSetPropertySelect = 14;
alias kAudioFileExtensionIsThisFormatSelect = 15;
alias kAudioFileFileIsThisFormatSelect = 16;
alias kAudioFileDataIsThisFormatSelect = 17;
alias kAudioFileGetGlobalInfoSizeSelect = 18;
alias kAudioFileGetGlobalInfoSelect = 19;
alias kAudioFileCountUserDataSelect = 20;
alias kAudioFileGetUserDataSizeSelect = 21;
alias kAudioFileGetUserDataSelect = 22;
alias kAudioFileSetUserDataSelect = 23;
alias kAudioFileRemoveUserDataSelect = 24;
alias kAudioFileCreateURLSelect = 25;
alias kAudioFileOpenURLSelect = 26;
alias kAudioFileFileDataIsThisFormatSelect = 27;
alias kAudioFileReadPacketDataSelect = 28;

alias ReadBytesFDF = CCodePointer[[RawPointer,CUChar,Int64,Pointer[UInt],RawPointer],[Int]];

alias WriteBytesFDF = CCodePointer[[RawPointer,CUChar,Int64,Pointer[UInt],RawPointer],[Int]];

alias ReadPacketsFDF = CCodePointer[[RawPointer,CUChar,Pointer[UInt],Pointer[Struct_AudioStreamPacketDescription],Int64,Pointer[UInt],RawPointer],[Int]];

alias ReadPacketDataFDF = CCodePointer[[RawPointer,CUChar,Pointer[UInt],Pointer[Struct_AudioStreamPacketDescription],Int64,Pointer[UInt],RawPointer],[Int]];

alias WritePacketsFDF = CCodePointer[[RawPointer,CUChar,UInt,Pointer[Struct_AudioStreamPacketDescription],Int64,Pointer[UInt],RawPointer],[Int]];

alias GetPropertyInfoFDF = CCodePointer[[RawPointer,UInt,Pointer[UInt],Pointer[UInt]],[Int]];

alias GetPropertyFDF = CCodePointer[[RawPointer,UInt,Pointer[UInt],RawPointer],[Int]];

alias SetPropertyFDF = CCodePointer[[RawPointer,UInt,UInt,RawPointer],[Int]];

alias CountUserDataFDF = CCodePointer[[RawPointer,UInt,Pointer[UInt]],[Int]];

alias GetUserDataSizeFDF = CCodePointer[[RawPointer,UInt,UInt,Pointer[UInt]],[Int]];

alias GetUserDataFDF = CCodePointer[[RawPointer,UInt,UInt,Pointer[UInt],RawPointer],[Int]];

alias SetUserDataFDF = CCodePointer[[RawPointer,UInt,UInt,UInt,RawPointer],[Int]];

record Struct_AudioFileFDFTable (
    mComponentStorage : RawPointer,
    mReadBytesFDF : ReadBytesFDF,
    mWriteBytesFDF : WriteBytesFDF,
    mReadPacketsFDF : ReadPacketsFDF,
    mWritePacketsFDF : WritePacketsFDF,
    mGetPropertyInfoFDF : GetPropertyInfoFDF,
    mGetPropertyFDF : GetPropertyFDF,
    mSetPropertyFDF : SetPropertyFDF,
    mCountUserDataFDF : CountUserDataFDF,
    mGetUserDataSizeFDF : GetUserDataSizeFDF,
    mGetUserDataFDF : GetUserDataFDF,
    mSetUserDataFDF : SetUserDataFDF,
);

alias AudioFileFDFTable = Struct_AudioFileFDFTable;

record Struct_AudioFileFDFTableExtended (
    mComponentStorage : RawPointer,
    mReadBytesFDF : ReadBytesFDF,
    mWriteBytesFDF : WriteBytesFDF,
    mReadPacketsFDF : ReadPacketsFDF,
    mWritePacketsFDF : WritePacketsFDF,
    mGetPropertyInfoFDF : GetPropertyInfoFDF,
    mGetPropertyFDF : GetPropertyFDF,
    mSetPropertyFDF : SetPropertyFDF,
    mCountUserDataFDF : CountUserDataFDF,
    mGetUserDataSizeFDF : GetUserDataSizeFDF,
    mGetUserDataFDF : GetUserDataFDF,
    mSetUserDataFDF : SetUserDataFDF,
    mReadPacketDataFDF : ReadPacketDataFDF,
);

alias AudioFileFDFTableExtended = Struct_AudioFileFDFTableExtended;

external AudioFileComponentCreate(
    inComponent : AudioFileComponent,
    inParentRef : OpaquePointer,
    inFileName : CFStringRef,
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : UInt,
    outNewFileRef : OpaquePointer) : Int;

external AudioFileComponentInitialize(
    inComponent : AudioFileComponent,
    inFileRef : OpaquePointer,
    inFormat : Pointer[AudioStreamBasicDescription],
    inFlags : UInt) : Int;

external AudioFileComponentOpenFile(
    inComponent : AudioFileComponent,
    inFileRef : OpaquePointer,
    inPermissions : CChar,
    inRefNum : Short) : Int;

alias kAUParameterListener_AnyParameter = 4294967295;

alias kAudioUnitEvent_ParameterValueChange = 0;
alias kAudioUnitEvent_BeginParameterChangeGesture = 1;
alias kAudioUnitEvent_EndParameterChangeGesture = 2;
alias kAudioUnitEvent_PropertyChange = 3;

alias AudioUnitEventType = UInt;

alias AUParameterListenerRef = OpaquePointer;

alias AUEventListenerRef = AUParameterListenerRef;

record Struct_AudioUnitEvent (
    mEventType : UInt,
    mArgument : AUnionType,
);

alias AudioUnitEvent = Struct_AudioUnitEvent;

alias AUParameterListenerBlock = UnknownType;

alias AUEventListenerBlock = UnknownType;

alias AUParameterListenerProc = CCodePointer[[RawPointer,RawPointer,Pointer[Struct_AudioUnitParameter],Float],[]];

alias AUEventListenerProc = CCodePointer[[RawPointer,RawPointer,Pointer[Struct_AudioUnitEvent],UInt64,Float],[]];

external AUListenerCreateWithDispatchQueue(
    outListener : Pointer[AUParameterListenerRef],
    inNotificationInterval : Float,
    inDispatchQueue : dispatch_queue_t,
    inBlock : AUParameterListenerBlock) : Int;

external AUListenerCreate(
    inProc : AUParameterListenerProc,
    inUserData : RawPointer,
    inRunLoop : CFRunLoopRef,
    inRunLoopMode : CFStringRef,
    inNotificationInterval : Float,
    outListener : Pointer[AUParameterListenerRef]) : Int;

external AUListenerDispose(
    inListener : AUParameterListenerRef) : Int;

external AUListenerAddParameter(
    inListener : AUParameterListenerRef,
    inObject : RawPointer,
    inParameter : Pointer[AudioUnitParameter]) : Int;

external AUListenerRemoveParameter(
    inListener : AUParameterListenerRef,
    inObject : RawPointer,
    inParameter : Pointer[AudioUnitParameter]) : Int;

external AUParameterSet(
    inSendingListener : AUParameterListenerRef,
    inSendingObject : RawPointer,
    inParameter : Pointer[AudioUnitParameter],
    inValue : Float,
    inBufferOffsetInFrames : UInt) : Int;

external AUParameterListenerNotify(
    inSendingListener : AUParameterListenerRef,
    inSendingObject : RawPointer,
    inParameter : Pointer[AudioUnitParameter]) : Int;

external AUEventListenerCreateWithDispatchQueue(
    outListener : Pointer[AUEventListenerRef],
    inNotificationInterval : Float,
    inValueChangeGranularity : Float,
    inDispatchQueue : dispatch_queue_t,
    inBlock : AUEventListenerBlock) : Int;

external AUEventListenerCreate(
    inProc : AUEventListenerProc,
    inUserData : RawPointer,
    inRunLoop : CFRunLoopRef,
    inRunLoopMode : CFStringRef,
    inNotificationInterval : Float,
    inValueChangeGranularity : Float,
    outListener : Pointer[AUEventListenerRef]) : Int;

external AUEventListenerAddEventType(
    inListener : AUEventListenerRef,
    inObject : RawPointer,
    inEvent : Pointer[AudioUnitEvent]) : Int;

external AUEventListenerRemoveEventType(
    inListener : AUEventListenerRef,
    inObject : RawPointer,
    inEvent : Pointer[AudioUnitEvent]) : Int;

external AUEventListenerNotify(
    inSendingListener : AUEventListenerRef,
    inSendingObject : RawPointer,
    inEvent : Pointer[AudioUnitEvent]) : Int;

external AUParameterValueFromLinear(
    inLinearValue : Float,
    inParameter : Pointer[AudioUnitParameter]) : Float;

external AUParameterValueToLinear(
    inParameterValue : Float,
    inParameter : Pointer[AudioUnitParameter]) : Float;

external AUParameterFormatValue(
    inParameterValue : Double,
    inParameter : Pointer[AudioUnitParameter],
    inTextBuffer : Pointer[CChar],
    inDigits : UInt) : Pointer[CChar];

alias kCAF_FileType = 1667327590;
alias kCAF_FileVersion_Initial = 1;

alias kCAF_StreamDescriptionChunkID = 1684370275;
alias kCAF_AudioDataChunkID = 1684108385;
alias kCAF_ChannelLayoutChunkID = 1667785070;
alias kCAF_FillerChunkID = 1718773093;
alias kCAF_MarkerChunkID = 1835102827;
alias kCAF_RegionChunkID = 1919248238;
alias kCAF_InstrumentChunkID = 1768846196;
alias kCAF_MagicCookieID = 1802857321;
alias kCAF_InfoStringsChunkID = 1768842863;
alias kCAF_EditCommentsChunkID = 1701077876;
alias kCAF_PacketTableChunkID = 1885432692;
alias kCAF_StringsChunkID = 1937011303;
alias kCAF_UUIDChunkID = 1970628964;
alias kCAF_PeakChunkID = 1885692267;
alias kCAF_OverviewChunkID = 1870034551;
alias kCAF_MIDIChunkID = 1835623529;
alias kCAF_UMIDChunkID = 1970104676;
alias kCAF_FormatListID = 1818522467;

record Struct_CAFFileHeader (
    mFileType : UInt,
    mFileVersion : UShort,
    mFileFlags : UShort,
);

alias CAFFileHeader = Struct_CAFFileHeader;

record Struct_CAFChunkHeader (
    mChunkType : UInt,
    mChunkSize : Int64,
);

alias CAFChunkHeader = Struct_CAFChunkHeader;

record Struct_CAF_UUID_ChunkHeader (
    mHeader : CAFChunkHeader,
    mUUID : Array[CUChar,16],
);

alias CAF_UUID_ChunkHeader = Struct_CAF_UUID_ChunkHeader;

record Struct_CAFAudioDescription (
    mSampleRate : Double,
    mFormatID : UInt,
    mFormatFlags : UInt,
    mBytesPerPacket : UInt,
    mFramesPerPacket : UInt,
    mChannelsPerFrame : UInt,
    mBitsPerChannel : UInt,
);

alias CAFAudioDescription = Struct_CAFAudioDescription;

alias kCAFLinearPCMFormatFlagIsFloat = 1;
alias kCAFLinearPCMFormatFlagIsLittleEndian = 2;

record Struct_CAFAudioFormatListItem (
    mFormat : CAFAudioDescription,
    mChannelLayoutTag : UInt,
);

record Struct_CAFPacketTableHeader (
    mNumberPackets : Int64,
    mNumberValidFrames : Int64,
    mPrimingFrames : Int,
    mRemainderFrames : Int,
    mPacketDescriptions : Array[CUChar,1],
);

alias CAFPacketTableHeader = Struct_CAFPacketTableHeader;

record Struct_CAFDataChunk (
    mEditCount : UInt,
    mData : Array[CUChar,1],
);

alias CAFDataChunk = Struct_CAFDataChunk;

alias kCAFMarkerType_Generic = 0;
alias kCAFMarkerType_ProgramStart = 1885496679;
alias kCAFMarkerType_ProgramEnd = 1885695588;
alias kCAFMarkerType_TrackStart = 1952605543;
alias kCAFMarkerType_TrackEnd = 1952804452;
alias kCAFMarkerType_Index = 1768842360;
alias kCAFMarkerType_RegionStart = 1919051111;
alias kCAFMarkerType_RegionEnd = 1919250020;
alias kCAFMarkerType_RegionSyncPoint = 1920170339;
alias kCAFMarkerType_SelectionStart = 1935828327;
alias kCAFMarkerType_SelectionEnd = 1936027236;
alias kCAFMarkerType_EditSourceBegin = 1667392871;
alias kCAFMarkerType_EditSourceEnd = 1667591780;
alias kCAFMarkerType_EditDestinationBegin = 1684170087;
alias kCAFMarkerType_EditDestinationEnd = 1684368996;
alias kCAFMarkerType_SustainLoopStart = 1936482919;
alias kCAFMarkerType_SustainLoopEnd = 1936483694;
alias kCAFMarkerType_ReleaseLoopStart = 1919705703;
alias kCAFMarkerType_ReleaseLoopEnd = 1919706478;
alias kCAFMarkerType_SavedPlayPosition = 1936747641;

alias kCAF_SMPTE_TimeTypeNone = 0;
alias kCAF_SMPTE_TimeType24 = 1;
alias kCAF_SMPTE_TimeType25 = 2;
alias kCAF_SMPTE_TimeType30Drop = 3;
alias kCAF_SMPTE_TimeType30 = 4;
alias kCAF_SMPTE_TimeType2997 = 5;
alias kCAF_SMPTE_TimeType2997Drop = 6;
alias kCAF_SMPTE_TimeType60 = 7;
alias kCAF_SMPTE_TimeType5994 = 8;
alias kCAF_SMPTE_TimeType60Drop = 9;
alias kCAF_SMPTE_TimeType5994Drop = 10;
alias kCAF_SMPTE_TimeType50 = 11;
alias kCAF_SMPTE_TimeType2398 = 12;

record Struct_CAF_SMPTE_Time (
    mHours : CChar,
    mMinutes : CChar,
    mSeconds : CChar,
    mFrames : CChar,
    mSubFrameSampleOffset : UInt,
);

alias CAF_SMPTE_Time = Struct_CAF_SMPTE_Time;

record Struct_CAFMarker (
    mType : UInt,
    mFramePosition : Double,
    mMarkerID : UInt,
    mSMPTETime : CAF_SMPTE_Time,
    mChannel : UInt,
);

alias CAFMarker = Struct_CAFMarker;

record Struct_CAFMarkerChunk (
    mSMPTE_TimeType : UInt,
    mNumberMarkers : UInt,
    mMarkers : Array[CAFMarker,1],
);

alias CAFMarkerChunk = Struct_CAFMarkerChunk;

alias kCAFRegionFlag_LoopEnable = 1;
alias kCAFRegionFlag_PlayForward = 2;
alias kCAFRegionFlag_PlayBackward = 4;

record Struct_CAFRegion (
    mRegionID : UInt,
    mFlags : UInt,
    mNumberMarkers : UInt,
    mMarkers : Array[CAFMarker,1],
);

alias CAFRegion = Struct_CAFRegion;

record Struct_CAFRegionChunk (
    mSMPTE_TimeType : UInt,
    mNumberRegions : UInt,
    mRegions : Array[CAFRegion,1],
);

alias CAFRegionChunk = Struct_CAFRegionChunk;

record Struct_CAFInstrumentChunk (
    mBaseNote : Float,
    mMIDILowNote : CUChar,
    mMIDIHighNote : CUChar,
    mMIDILowVelocity : CUChar,
    mMIDIHighVelocity : CUChar,
    mdBGain : Float,
    mStartRegionID : UInt,
    mSustainRegionID : UInt,
    mReleaseRegionID : UInt,
    mInstrumentID : UInt,
);

alias CAFInstrumentChunk = Struct_CAFInstrumentChunk;

record Struct_CAFStringID (
    mStringID : UInt,
    mStringStartByteOffset : Int64,
);

alias CAFStringID = Struct_CAFStringID;

record Struct_CAFStrings (
    mNumEntries : UInt,
    mStringsIDs : Array[CAFStringID,1],
);

alias CAFStrings = Struct_CAFStrings;

record Struct_CAFInfoStrings (
    mNumEntries : UInt,
);

alias CAFInfoStrings = Struct_CAFInfoStrings;

record Struct_CAFPositionPeak (
    mValue : Float,
    mFrameNumber : UInt64,
);

alias CAFPositionPeak = Struct_CAFPositionPeak;

record Struct_CAFPeakChunk (
    mEditCount : UInt,
    mPeaks : Array[CAFPositionPeak,1],
);

alias CAFPeakChunk = Struct_CAFPeakChunk;

record Struct_CAFOverviewSample (
    mMinValue : Short,
    mMaxValue : Short,
);

alias CAFOverviewSample = Struct_CAFOverviewSample;

record Struct_CAFOverviewChunk (
    mEditCount : UInt,
    mNumFramesPerOVWSample : UInt,
    mData : Array[CAFOverviewSample,1],
);

alias CAFOverviewChunk = Struct_CAFOverviewChunk;

record Struct_CAFUMIDChunk (
    mBytes : Array[CUChar,64],
);

alias CAFUMIDChunk = Struct_CAFUMIDChunk;

alias kCAClockProperty_InternalTimebase = 1768846434;
alias kCAClockProperty_TimebaseSource = 1769235059;
alias kCAClockProperty_SyncMode = 1937337965;
alias kCAClockProperty_SyncSource = 1937337971;
alias kCAClockProperty_SMPTEFormat = 1936552038;
alias kCAClockProperty_SMPTEOffset = 1936552047;
alias kCAClockProperty_MIDIClockDestinations = 1835164516;
alias kCAClockProperty_MTCDestinations = 1836344164;
alias kCAClockProperty_MTCFreewheelTime = 1836344951;
alias kCAClockProperty_TempoMap = 1953329263;
alias kCAClockProperty_MeterTrack = 1835365490;
alias kCAClockProperty_Name = 1851878757;
alias kCAClockProperty_SendMIDISPP = 1836281968;

alias CAClockPropertyID = UInt;

alias kCAClockTimebase_HostTime = 1752134516;
alias kCAClockTimebase_AudioDevice = 1635083369;
alias kCAClockTimebase_AudioOutputUnit = 1635086197;

alias CAClockTimebase = UInt;

alias kCAClockSyncMode_Internal = 1768846450;
alias kCAClockSyncMode_MIDIClockTransport = 1835232363;
alias kCAClockSyncMode_MTCTransport = 1835889763;

alias CAClockSyncMode = UInt;

alias CAClockSMPTEFormat = UInt;

alias kCAClockMessage_StartTimeSet = 1937009005;
alias kCAClockMessage_Started = 1937011316;
alias kCAClockMessage_Stopped = 1937010544;
alias kCAClockMessage_Armed = 1634889060;
alias kCAClockMessage_Disarmed = 1684107885;
alias kCAClockMessage_PropertyChanged = 1885562983;
alias kCAClockMessage_WrongSMPTEFormat = 1064529264;

alias CAClockMessage = UInt;

alias kCAClockTimeFormat_HostTime = 1752134516;
alias kCAClockTimeFormat_Samples = 1935764848;
alias kCAClockTimeFormat_Beats = 1650811252;
alias kCAClockTimeFormat_Seconds = 1936024435;
alias kCAClockTimeFormat_SMPTESeconds = 1936552051;
alias kCAClockTimeFormat_SMPTETime = 1936552052;

alias CAClockTimeFormat = UInt;

alias kCAClock_UnknownPropertyError = 4294900480;
alias kCAClock_InvalidPropertySizeError = 4294900481;
alias kCAClock_InvalidTimeFormatError = 4294900482;
alias kCAClock_InvalidSyncModeError = 4294900483;
alias kCAClock_InvalidSyncSourceError = 4294900484;
alias kCAClock_InvalidTimebaseError = 4294900485;
alias kCAClock_InvalidTimebaseSourceError = 4294900486;
alias kCAClock_InvalidSMPTEFormatError = 4294900487;
alias kCAClock_InvalidSMPTEOffsetError = 4294900488;
alias kCAClock_InvalidUnitError = 4294900489;
alias kCAClock_InvalidPlayRateError = 4294900490;
alias kCAClock_CannotSetTimeError = 4294900491;

alias CAClockRef = OpaquePointer;

alias CAClockBeats = Double;

alias CAClockTempo = Double;

alias CAClockSamples = Double;

alias CAClockSeconds = Double;

alias CAClockListenerProc = CCodePointer[[RawPointer,UInt,RawPointer],[]];

record Struct_CAClockTime (
    format : UInt,
    reserved : UInt,
    time : AUnionType,
);

alias CAClockTime = Struct_CAClockTime;

record Struct_CABarBeatTime (
    bar : Int,
    beat : UShort,
    subbeat : UShort,
    subbeatDivisor : UShort,
    reserved : UShort,
);

alias CABarBeatTime = Struct_CABarBeatTime;

record Struct_CATempoMapEntry (
    beats : Double,
    tempoBPM : Double,
);

alias CATempoMapEntry = Struct_CATempoMapEntry;

record Struct_CAMeterTrackEntry (
    beats : Double,
    meterNumer : UShort,
    meterDenom : UShort,
);

alias CAMeterTrackEntry = Struct_CAMeterTrackEntry;

external CAClockNew(
    inReservedFlags : UInt,
    outCAClock : Pointer[CAClockRef]) : Int;

external CAClockDispose(
    inCAClock : CAClockRef) : Int;

external CAClockGetPropertyInfo(
    inCAClock : CAClockRef,
    inPropertyID : UInt,
    outSize : Pointer[UInt],
    outWritable : Pointer[CUChar]) : Int;

external CAClockGetProperty(
    inCAClock : CAClockRef,
    inPropertyID : UInt,
    ioPropertyDataSize : Pointer[UInt],
    outPropertyData : RawPointer) : Int;

external CAClockSetProperty(
    inCAClock : CAClockRef,
    inPropertyID : UInt,
    inPropertyDataSize : UInt,
    inPropertyData : RawPointer) : Int;

external CAClockAddListener(
    inCAClock : CAClockRef,
    inListenerProc : CAClockListenerProc,
    inUserData : RawPointer) : Int;

external CAClockRemoveListener(
    inCAClock : CAClockRef,
    inListenerProc : CAClockListenerProc,
    inUserData : RawPointer) : Int;

external CAClockSetCurrentTime(
    inCAClock : CAClockRef,
    inTime : Pointer[CAClockTime]) : Int;

external CAClockGetCurrentTime(
    inCAClock : CAClockRef,
    inTimeFormat : UInt,
    outTime : Pointer[CAClockTime]) : Int;

external CAClockGetStartTime(
    inCAClock : CAClockRef,
    inTimeFormat : UInt,
    outTime : Pointer[CAClockTime]) : Int;

external CAClockTranslateTime(
    inCAClock : CAClockRef,
    inTime : Pointer[CAClockTime],
    inOutputTimeFormat : UInt,
    outTime : Pointer[CAClockTime]) : Int;

external CAClockStart(
    inCAClock : CAClockRef) : Int;

external CAClockStop(
    inCAClock : CAClockRef) : Int;

external CAClockArm(
    inCAClock : CAClockRef) : Int;

external CAClockDisarm(
    inCAClock : CAClockRef) : Int;

external CAClockSetPlayRate(
    inCAClock : CAClockRef,
    inPlayRate : Double) : Int;

external CAClockGetPlayRate(
    inCAClock : CAClockRef,
    outPlayRate : Pointer[Double]) : Int;

external CAClockGetCurrentTempo(
    inCAClock : CAClockRef,
    outTempo : Pointer[Double],
    outTimestamp : Pointer[CAClockTime]) : Int;

external CAClockSetCurrentTempo(
    inCAClock : CAClockRef,
    inTempo : Double,
    inTimestamp : Pointer[CAClockTime]) : Int;

external CAClockSecondsToSMPTETime(
    inCAClock : CAClockRef,
    inSeconds : Double,
    inSubframeDivisor : UShort,
    outSMPTETime : Pointer[SMPTETime]) : Int;

external CAClockSMPTETimeToSeconds(
    inCAClock : CAClockRef,
    inSMPTETime : Pointer[SMPTETime],
    outSeconds : Pointer[Double]) : Int;

external CAClockBeatsToBarBeatTime(
    inCAClock : CAClockRef,
    inBeats : Double,
    inSubbeatDivisor : UShort,
    outBarBeatTime : Pointer[CABarBeatTime]) : Int;

external CAClockBarBeatTimeToBeats(
    inCAClock : CAClockRef,
    inBarBeatTime : Pointer[CABarBeatTime],
    outBeats : Pointer[Double]) : Int;

external CAClockParseMIDI(
    inCAClock : CAClockRef,
    inMIDIPacketList : Pointer[Struct_MIDIPacketList]) : Int;

alias kMusicEventType_NULL = 0;
alias kMusicEventType_ExtendedNote = 1;
alias kMusicEventType_ExtendedControl = 2;
alias kMusicEventType_ExtendedTempo = 3;
alias kMusicEventType_User = 4;
alias kMusicEventType_Meta = 5;
alias kMusicEventType_MIDINoteMessage = 6;
alias kMusicEventType_MIDIChannelMessage = 7;
alias kMusicEventType_MIDIRawData = 8;
alias kMusicEventType_Parameter = 9;
alias kMusicEventType_AUPreset = 10;
alias kMusicEventType_Last = 11;

alias MusicEventType = UInt;

alias kMusicSequenceLoadSMF_ChannelsToTracks = 1;

alias MusicSequenceLoadFlags = UInt;

alias kMusicSequenceType_Beats = 1650811252;
alias kMusicSequenceType_Seconds = 1936024435;
alias kMusicSequenceType_Samples = 1935764848;

alias MusicSequenceType = UInt;

alias kMusicSequenceFile_MIDIType = 1835623529;
alias kMusicSequenceFile_iMelodyType = 1768777068;

alias MusicSequenceFileTypeID = UInt;

alias kMusicSequenceFileFlags_EraseFile = 1;

alias MusicSequenceFileFlags = UInt;

alias MusicTimeStamp = Double;

record Struct_MIDINoteMessage (
    channel : CUChar,
    note : CUChar,
    velocity : CUChar,
    releaseVelocity : CUChar,
    duration : Float,
);

alias MIDINoteMessage = Struct_MIDINoteMessage;

record Struct_MIDIChannelMessage (
    status : CUChar,
    data1 : CUChar,
    data2 : CUChar,
    reserved : CUChar,
);

alias MIDIChannelMessage = Struct_MIDIChannelMessage;

record Struct_MIDIRawData (
    length : UInt,
    data : Array[CUChar,1],
);

alias MIDIRawData = Struct_MIDIRawData;

record Struct_MIDIMetaEvent (
    metaEventType : CUChar,
    unused1 : CUChar,
    unused2 : CUChar,
    unused3 : CUChar,
    dataLength : UInt,
    data : Array[CUChar,1],
);

alias MIDIMetaEvent = Struct_MIDIMetaEvent;

record Struct_MusicEventUserData (
    length : UInt,
    data : Array[CUChar,1],
);

alias MusicEventUserData = Struct_MusicEventUserData;

record Struct_ExtendedNoteOnEvent (
    instrumentID : UInt,
    groupID : UInt,
    duration : Float,
    extendedParams : MusicDeviceNoteParams,
);

alias ExtendedNoteOnEvent = Struct_ExtendedNoteOnEvent;

record Struct_ExtendedControlEvent (
    groupID : UInt,
    controlID : UInt,
    value : Float,
);

alias ExtendedControlEvent = Struct_ExtendedControlEvent;

record Struct_ParameterEvent (
    parameterID : UInt,
    scope : UInt,
    element : UInt,
    value : Float,
);

alias ParameterEvent = Struct_ParameterEvent;

record Struct_ExtendedTempoEvent (
    bpm : Double,
);

alias ExtendedTempoEvent = Struct_ExtendedTempoEvent;

record Struct_AUPresetEvent (
    scope : UInt,
    element : UInt,
    preset : CFPropertyListRef,
);

alias AUPresetEvent = Struct_AUPresetEvent;

alias MusicPlayer = OpaquePointer;

alias MusicSequence = OpaquePointer;

alias MusicTrack = OpaquePointer;

alias MusicEventIterator = OpaquePointer;

alias MusicSequenceUserCallback = CCodePointer[[RawPointer,OpaquePointer,OpaquePointer,Double,Pointer[Struct_MusicEventUserData],Double,Double],[]];

alias kAudioToolboxErr_InvalidSequenceType = 4294956450;
alias kAudioToolboxErr_TrackIndexError = 4294956437;
alias kAudioToolboxErr_TrackNotFound = 4294956438;
alias kAudioToolboxErr_EndOfTrack = 4294956439;
alias kAudioToolboxErr_StartOfTrack = 4294956440;
alias kAudioToolboxErr_IllegalTrackDestination = 4294956441;
alias kAudioToolboxErr_NoSequence = 4294956442;
alias kAudioToolboxErr_InvalidEventType = 4294956443;
alias kAudioToolboxErr_InvalidPlayerState = 4294956444;
alias kAudioToolboxErr_CannotDoInCurrentContext = 4294956433;

alias kSequenceTrackProperty_LoopInfo = 0;
alias kSequenceTrackProperty_OffsetTime = 1;
alias kSequenceTrackProperty_MuteStatus = 2;
alias kSequenceTrackProperty_SoloStatus = 3;
alias kSequenceTrackProperty_AutomatedParameters = 4;
alias kSequenceTrackProperty_TrackLength = 5;
alias kSequenceTrackProperty_TimeResolution = 6;

record Struct_MusicTrackLoopInfo (
    loopDuration : Double,
    numberOfLoops : Int,
);

alias MusicTrackLoopInfo = Struct_MusicTrackLoopInfo;

external NewMusicPlayer(
    outPlayer : Pointer[MusicPlayer]) : Int;

external DisposeMusicPlayer(
    inPlayer : MusicPlayer) : Int;

external MusicPlayerSetSequence(
    inPlayer : MusicPlayer,
    inSequence : MusicSequence) : Int;

external MusicPlayerGetSequence(
    inPlayer : MusicPlayer,
    outSequence : Pointer[MusicSequence]) : Int;

external MusicPlayerSetTime(
    inPlayer : MusicPlayer,
    inTime : Double) : Int;

external MusicPlayerGetTime(
    inPlayer : MusicPlayer,
    outTime : Pointer[Double]) : Int;

external MusicPlayerGetHostTimeForBeats(
    inPlayer : MusicPlayer,
    inBeats : Double,
    outHostTime : Pointer[UInt64]) : Int;

external MusicPlayerGetBeatsForHostTime(
    inPlayer : MusicPlayer,
    inHostTime : UInt64,
    outBeats : Pointer[Double]) : Int;

external MusicPlayerPreroll(
    inPlayer : MusicPlayer) : Int;

external MusicPlayerStart(
    inPlayer : MusicPlayer) : Int;

external MusicPlayerStop(
    inPlayer : MusicPlayer) : Int;

external MusicPlayerIsPlaying(
    inPlayer : MusicPlayer,
    outIsPlaying : Pointer[CUChar]) : Int;

external MusicPlayerSetPlayRateScalar(
    inPlayer : MusicPlayer,
    inScaleRate : Double) : Int;

external MusicPlayerGetPlayRateScalar(
    inPlayer : MusicPlayer,
    outScaleRate : Pointer[Double]) : Int;

external NewMusicSequence(
    outSequence : Pointer[MusicSequence]) : Int;

external DisposeMusicSequence(
    inSequence : MusicSequence) : Int;

external MusicSequenceNewTrack(
    inSequence : MusicSequence,
    outTrack : Pointer[MusicTrack]) : Int;

external MusicSequenceDisposeTrack(
    inSequence : MusicSequence,
    inTrack : MusicTrack) : Int;

external MusicSequenceGetTrackCount(
    inSequence : MusicSequence,
    outNumberOfTracks : Pointer[UInt]) : Int;

external MusicSequenceGetIndTrack(
    inSequence : MusicSequence,
    inTrackIndex : UInt,
    outTrack : Pointer[MusicTrack]) : Int;

external MusicSequenceGetTrackIndex(
    inSequence : MusicSequence,
    inTrack : MusicTrack,
    outTrackIndex : Pointer[UInt]) : Int;

external MusicSequenceGetTempoTrack(
    inSequence : MusicSequence,
    outTrack : Pointer[MusicTrack]) : Int;

external MusicSequenceSetAUGraph(
    inSequence : MusicSequence,
    inGraph : AUGraph) : Int;

external MusicSequenceGetAUGraph(
    inSequence : MusicSequence,
    outGraph : Pointer[AUGraph]) : Int;

external MusicSequenceSetMIDIEndpoint(
    inSequence : MusicSequence,
    inEndpoint : UInt) : Int;

external MusicSequenceSetSequenceType(
    inSequence : MusicSequence,
    inType : UInt) : Int;

external MusicSequenceGetSequenceType(
    inSequence : MusicSequence,
    outType : Pointer[UInt]) : Int;

external MusicSequenceFileLoad(
    inSequence : MusicSequence,
    inFileRef : CFURLRef,
    inFileTypeHint : UInt,
    inFlags : UInt) : Int;

external MusicSequenceFileLoadData(
    inSequence : MusicSequence,
    inData : CFDataRef,
    inFileTypeHint : UInt,
    inFlags : UInt) : Int;

external MusicSequenceFileCreate(
    inSequence : MusicSequence,
    inFileRef : CFURLRef,
    inFileType : UInt,
    inFlags : UInt,
    inResolution : Short) : Int;

external MusicSequenceFileCreateData(
    inSequence : MusicSequence,
    inFileType : UInt,
    inFlags : UInt,
    inResolution : Short,
    outData : Pointer[CFDataRef]) : Int;

external MusicSequenceReverse(
    inSequence : MusicSequence) : Int;

external MusicSequenceGetSecondsForBeats(
    inSequence : MusicSequence,
    inBeats : Double,
    outSeconds : Pointer[Double]) : Int;

external MusicSequenceGetBeatsForSeconds(
    inSequence : MusicSequence,
    inSeconds : Double,
    outBeats : Pointer[Double]) : Int;

external MusicSequenceSetUserCallback(
    inSequence : MusicSequence,
    inCallback : MusicSequenceUserCallback,
    inClientData : RawPointer) : Int;

external MusicSequenceBeatsToBarBeatTime(
    inSequence : MusicSequence,
    inBeats : Double,
    inSubbeatDivisor : UInt,
    outBarBeatTime : Pointer[CABarBeatTime]) : Int;

external MusicSequenceBarBeatTimeToBeats(
    inSequence : MusicSequence,
    inBarBeatTime : Pointer[CABarBeatTime],
    outBeats : Pointer[Double]) : Int;

external MusicSequenceGetInfoDictionary(
    inSequence : MusicSequence) : CFDictionaryRef;

external MusicTrackGetSequence(
    inTrack : MusicTrack,
    outSequence : Pointer[MusicSequence]) : Int;

external MusicTrackSetDestNode(
    inTrack : MusicTrack,
    inNode : Int) : Int;

external MusicTrackSetDestMIDIEndpoint(
    inTrack : MusicTrack,
    inEndpoint : UInt) : Int;

external MusicTrackGetDestNode(
    inTrack : MusicTrack,
    outNode : Pointer[Int]) : Int;

external MusicTrackGetDestMIDIEndpoint(
    inTrack : MusicTrack,
    outEndpoint : Pointer[UInt]) : Int;

external MusicTrackSetProperty(
    inTrack : MusicTrack,
    inPropertyID : UInt,
    inData : RawPointer,
    inLength : UInt) : Int;

external MusicTrackGetProperty(
    inTrack : MusicTrack,
    inPropertyID : UInt,
    outData : RawPointer,
    ioLength : Pointer[UInt]) : Int;

external MusicTrackMoveEvents(
    inTrack : MusicTrack,
    inStartTime : Double,
    inEndTime : Double,
    inMoveTime : Double) : Int;

external MusicTrackClear(
    inTrack : MusicTrack,
    inStartTime : Double,
    inEndTime : Double) : Int;

external MusicTrackCut(
    inTrack : MusicTrack,
    inStartTime : Double,
    inEndTime : Double) : Int;

external MusicTrackCopyInsert(
    inSourceTrack : MusicTrack,
    inSourceStartTime : Double,
    inSourceEndTime : Double,
    inDestTrack : MusicTrack,
    inDestInsertTime : Double) : Int;

external MusicTrackMerge(
    inSourceTrack : MusicTrack,
    inSourceStartTime : Double,
    inSourceEndTime : Double,
    inDestTrack : MusicTrack,
    inDestInsertTime : Double) : Int;

external MusicTrackNewMIDINoteEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inMessage : Pointer[MIDINoteMessage]) : Int;

external MusicTrackNewMIDIChannelEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inMessage : Pointer[MIDIChannelMessage]) : Int;

external MusicTrackNewMIDIRawDataEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inRawData : Pointer[MIDIRawData]) : Int;

external MusicTrackNewExtendedNoteEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inInfo : Pointer[ExtendedNoteOnEvent]) : Int;

external MusicTrackNewExtendedControlEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inInfo : Pointer[ExtendedControlEvent]) : Int;

external MusicTrackNewParameterEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inInfo : Pointer[ParameterEvent]) : Int;

external MusicTrackNewExtendedTempoEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inBPM : Double) : Int;

external MusicTrackNewMetaEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inMetaEvent : Pointer[MIDIMetaEvent]) : Int;

external MusicTrackNewUserEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inUserData : Pointer[MusicEventUserData]) : Int;

external MusicTrackNewAUPresetEvent(
    inTrack : MusicTrack,
    inTimeStamp : Double,
    inPresetEvent : Pointer[AUPresetEvent]) : Int;

external NewMusicEventIterator(
    inTrack : MusicTrack,
    outIterator : Pointer[MusicEventIterator]) : Int;

external DisposeMusicEventIterator(
    inIterator : MusicEventIterator) : Int;

external MusicEventIteratorSeek(
    inIterator : MusicEventIterator,
    inTimeStamp : Double) : Int;

external MusicEventIteratorNextEvent(
    inIterator : MusicEventIterator) : Int;

external MusicEventIteratorPreviousEvent(
    inIterator : MusicEventIterator) : Int;

external MusicEventIteratorGetEventInfo(
    inIterator : MusicEventIterator,
    outTimeStamp : Pointer[Double],
    outEventType : Pointer[UInt],
    outEventData : Pointer[RawPointer],
    outEventDataSize : Pointer[UInt]) : Int;

external MusicEventIteratorSetEventInfo(
    inIterator : MusicEventIterator,
    inEventType : UInt,
    inEventData : RawPointer) : Int;

external MusicEventIteratorSetEventTime(
    inIterator : MusicEventIterator,
    inTimeStamp : Double) : Int;

external MusicEventIteratorDeleteEvent(
    inIterator : MusicEventIterator) : Int;

external MusicEventIteratorHasPreviousEvent(
    inIterator : MusicEventIterator,
    outHasPrevEvent : Pointer[CUChar]) : Int;

external MusicEventIteratorHasNextEvent(
    inIterator : MusicEventIterator,
    outHasNextEvent : Pointer[CUChar]) : Int;

external MusicEventIteratorHasCurrentEvent(
    inIterator : MusicEventIterator,
    outHasCurEvent : Pointer[CUChar]) : Int;

external MusicSequenceLoadSMFWithFlags(
    inSequence : MusicSequence,
    inFileRef : OpaquePointer,
    inFlags : UInt) : Int;

external MusicSequenceLoadSMFDataWithFlags(
    inSequence : MusicSequence,
    inData : CFDataRef,
    inFlags : UInt) : Int;

external MusicSequenceSaveMIDIFile(
    inSequence : MusicSequence,
    inParentDirectory : OpaquePointer,
    inFileName : CFStringRef,
    inResolution : UShort,
    inFlags : UInt) : Int;

external MusicSequenceSaveSMFData(
    inSequence : MusicSequence,
    outData : Pointer[CFDataRef],
    inResolution : UShort) : Int;

external NewMusicTrackFrom(
    inSourceTrack : MusicTrack,
    inSourceStartTime : Double,
    inSourceEndTime : Double,
    outNewTrack : Pointer[MusicTrack]) : Int;

external CAShow(
    inObject : RawPointer);

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

external GetNameFromSoundBank(
    inSoundBankRef : OpaquePointer,
    outName : Pointer[CFStringRef]) : Int;

external CopyNameFromSoundBank(
    inURL : CFURLRef,
    outName : Pointer[CFStringRef]) : Int;
