AudioFileComponents.pas 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. {!
  2. @file AudioFileComponent.h
  3. @framework AudioToolbox.framework
  4. @copyright (c) 2004-2015 by Apple, Inc., all rights reserved.
  5. @abstract Interfaces for components which implement knowledge of audio file formats.
  6. @discussion
  7. Audio file components are not for the use of clients. Rather, they are called by the
  8. implementation of the AudioFile API to implement the various semantics of that API.
  9. Most of these calls match a call in the AudioFile API which calls through to the component.
  10. A component may be used in two ways, either associated with a file or not. If a component is
  11. not associated with a file, it may be used to answer questions about the file type in
  12. general and whether some data is recognized by that file type. A component is associated
  13. with a file by calling one of the AudioFile Create, Open or Initialize calls. If a component
  14. is associated with a file, then it can also be asked to perform any of the calls that
  15. implement the AudioFile API.
  16. }
  17. { Pascal Translation: Jonas Maebe <[email protected]>, July 2019 }
  18. {
  19. Modified for use with Free Pascal
  20. Version 308
  21. Please report any bugs to <[email protected]>
  22. }
  23. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  24. {$mode macpas}
  25. {$modeswitch cblocks}
  26. {$packenum 1}
  27. {$macro on}
  28. {$inline on}
  29. {$calling mwpascal}
  30. unit AudioFileComponents;
  31. interface
  32. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  33. {$setc GAP_INTERFACES_VERSION := $0308}
  34. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  35. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  36. {$endc}
  37. {$ifc defined CPUPOWERPC and defined CPUI386}
  38. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  39. {$endc}
  40. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  41. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  42. {$endc}
  43. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  44. {$setc __ppc__ := 1}
  45. {$elsec}
  46. {$setc __ppc__ := 0}
  47. {$endc}
  48. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  49. {$setc __ppc64__ := 1}
  50. {$elsec}
  51. {$setc __ppc64__ := 0}
  52. {$endc}
  53. {$ifc not defined __i386__ and defined CPUI386}
  54. {$setc __i386__ := 1}
  55. {$elsec}
  56. {$setc __i386__ := 0}
  57. {$endc}
  58. {$ifc not defined __x86_64__ and defined CPUX86_64}
  59. {$setc __x86_64__ := 1}
  60. {$elsec}
  61. {$setc __x86_64__ := 0}
  62. {$endc}
  63. {$ifc not defined __arm__ and defined CPUARM}
  64. {$setc __arm__ := 1}
  65. {$elsec}
  66. {$setc __arm__ := 0}
  67. {$endc}
  68. {$ifc not defined __arm64__ and defined CPUAARCH64}
  69. {$setc __arm64__ := 1}
  70. {$elsec}
  71. {$setc __arm64__ := 0}
  72. {$endc}
  73. {$ifc defined cpu64}
  74. {$setc __LP64__ := 1}
  75. {$elsec}
  76. {$setc __LP64__ := 0}
  77. {$endc}
  78. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  79. {$error Conflicting definitions for __ppc__ and __i386__}
  80. {$endc}
  81. {$ifc defined __ppc__ and __ppc__}
  82. {$setc TARGET_CPU_PPC := TRUE}
  83. {$setc TARGET_CPU_PPC64 := FALSE}
  84. {$setc TARGET_CPU_X86 := FALSE}
  85. {$setc TARGET_CPU_X86_64 := FALSE}
  86. {$setc TARGET_CPU_ARM := FALSE}
  87. {$setc TARGET_CPU_ARM64 := FALSE}
  88. {$setc TARGET_OS_MAC := TRUE}
  89. {$setc TARGET_OS_IPHONE := FALSE}
  90. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  91. {$setc TARGET_OS_EMBEDDED := FALSE}
  92. {$elifc defined __ppc64__ and __ppc64__}
  93. {$setc TARGET_CPU_PPC := FALSE}
  94. {$setc TARGET_CPU_PPC64 := TRUE}
  95. {$setc TARGET_CPU_X86 := FALSE}
  96. {$setc TARGET_CPU_X86_64 := FALSE}
  97. {$setc TARGET_CPU_ARM := FALSE}
  98. {$setc TARGET_CPU_ARM64 := FALSE}
  99. {$setc TARGET_OS_MAC := TRUE}
  100. {$setc TARGET_OS_IPHONE := FALSE}
  101. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  102. {$setc TARGET_OS_EMBEDDED := FALSE}
  103. {$elifc defined __i386__ and __i386__}
  104. {$setc TARGET_CPU_PPC := FALSE}
  105. {$setc TARGET_CPU_PPC64 := FALSE}
  106. {$setc TARGET_CPU_X86 := TRUE}
  107. {$setc TARGET_CPU_X86_64 := FALSE}
  108. {$setc TARGET_CPU_ARM := FALSE}
  109. {$setc TARGET_CPU_ARM64 := FALSE}
  110. {$ifc defined iphonesim}
  111. {$setc TARGET_OS_MAC := FALSE}
  112. {$setc TARGET_OS_IPHONE := TRUE}
  113. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  114. {$elsec}
  115. {$setc TARGET_OS_MAC := TRUE}
  116. {$setc TARGET_OS_IPHONE := FALSE}
  117. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  118. {$endc}
  119. {$setc TARGET_OS_EMBEDDED := FALSE}
  120. {$elifc defined __x86_64__ and __x86_64__}
  121. {$setc TARGET_CPU_PPC := FALSE}
  122. {$setc TARGET_CPU_PPC64 := FALSE}
  123. {$setc TARGET_CPU_X86 := FALSE}
  124. {$setc TARGET_CPU_X86_64 := TRUE}
  125. {$setc TARGET_CPU_ARM := FALSE}
  126. {$setc TARGET_CPU_ARM64 := FALSE}
  127. {$ifc defined iphonesim}
  128. {$setc TARGET_OS_MAC := FALSE}
  129. {$setc TARGET_OS_IPHONE := TRUE}
  130. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  131. {$elsec}
  132. {$setc TARGET_OS_MAC := TRUE}
  133. {$setc TARGET_OS_IPHONE := FALSE}
  134. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  135. {$endc}
  136. {$setc TARGET_OS_EMBEDDED := FALSE}
  137. {$elifc defined __arm__ and __arm__}
  138. {$setc TARGET_CPU_PPC := FALSE}
  139. {$setc TARGET_CPU_PPC64 := FALSE}
  140. {$setc TARGET_CPU_X86 := FALSE}
  141. {$setc TARGET_CPU_X86_64 := FALSE}
  142. {$setc TARGET_CPU_ARM := TRUE}
  143. {$setc TARGET_CPU_ARM64 := FALSE}
  144. {$setc TARGET_OS_MAC := FALSE}
  145. {$setc TARGET_OS_IPHONE := TRUE}
  146. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  147. {$setc TARGET_OS_EMBEDDED := TRUE}
  148. {$elifc defined __arm64__ and __arm64__}
  149. {$setc TARGET_CPU_PPC := FALSE}
  150. {$setc TARGET_CPU_PPC64 := FALSE}
  151. {$setc TARGET_CPU_X86 := FALSE}
  152. {$setc TARGET_CPU_X86_64 := FALSE}
  153. {$setc TARGET_CPU_ARM := FALSE}
  154. {$setc TARGET_CPU_ARM64 := TRUE}
  155. {$ifc defined ios}
  156. {$setc TARGET_OS_MAC := FALSE}
  157. {$setc TARGET_OS_IPHONE := TRUE}
  158. {$setc TARGET_OS_EMBEDDED := TRUE}
  159. {$elsec}
  160. {$setc TARGET_OS_MAC := TRUE}
  161. {$setc TARGET_OS_IPHONE := FALSE}
  162. {$setc TARGET_OS_EMBEDDED := FALSE}
  163. {$endc}
  164. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  165. {$elsec}
  166. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  167. {$endc}
  168. {$ifc defined __LP64__ and __LP64__ }
  169. {$setc TARGET_CPU_64 := TRUE}
  170. {$elsec}
  171. {$setc TARGET_CPU_64 := FALSE}
  172. {$endc}
  173. {$ifc defined FPC_BIG_ENDIAN}
  174. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  175. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  176. {$elifc defined FPC_LITTLE_ENDIAN}
  177. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  178. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  179. {$elsec}
  180. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  181. {$endc}
  182. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  183. {$setc CALL_NOT_IN_CARBON := FALSE}
  184. {$setc OLDROUTINENAMES := FALSE}
  185. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  186. {$setc OPAQUE_UPP_TYPES := TRUE}
  187. {$setc OTCARBONAPPLICATION := TRUE}
  188. {$setc OTKERNEL := FALSE}
  189. {$setc PM_USE_SESSION_APIS := TRUE}
  190. {$setc TARGET_API_MAC_CARBON := TRUE}
  191. {$setc TARGET_API_MAC_OS8 := FALSE}
  192. {$setc TARGET_API_MAC_OSX := TRUE}
  193. {$setc TARGET_CARBON := TRUE}
  194. {$setc TARGET_CPU_68K := FALSE}
  195. {$setc TARGET_CPU_MIPS := FALSE}
  196. {$setc TARGET_CPU_SPARC := FALSE}
  197. {$setc TARGET_OS_UNIX := FALSE}
  198. {$setc TARGET_OS_WIN32 := FALSE}
  199. {$setc TARGET_RT_MAC_68881 := FALSE}
  200. {$setc TARGET_RT_MAC_CFM := FALSE}
  201. {$setc TARGET_RT_MAC_MACHO := TRUE}
  202. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  203. {$setc TYPE_BOOL := FALSE}
  204. {$setc TYPE_EXTENDED := FALSE}
  205. {$setc TYPE_LONGLONG := TRUE}
  206. uses MacTypes,CFBase,CoreAudioTypes,Files,AudioFile,AudioComponents;
  207. {$endc} {not MACOSALLINCLUDE}
  208. {$ALIGN POWER}
  209. //==================================================================================================
  210. // Includes
  211. //==================================================================================================
  212. //CF_ASSUME_NONNULL_BEGIN
  213. {!
  214. @typedef AudioFileComponent
  215. @abstract represents an instance of an AudioFileComponent.
  216. }
  217. type
  218. AudioFileComponent = AudioComponentInstance;
  219. AudioFileComponentPtr = ^AudioFileComponent;
  220. {!
  221. @typedef AudioFileComponentPropertyID
  222. @abstract a four char code for a property ID.
  223. }
  224. type
  225. AudioFileComponentPropertyID = UInt32;
  226. AudioFileComponentPropertyIDPtr = ^AudioFileComponentPropertyID;
  227. {$ifc TARGET_OS_MAC}
  228. {!
  229. @function AudioFileComponentCreateURL
  230. @abstract creates a new (or initialises an existing) audio file specified by the URL.
  231. @discussion creates a new (or initialises an existing) audio file specified by the URL.
  232. @param inComponent an AudioFileComponent
  233. @param inFileRef an CFURLRef fully specifying the path of the file to create/initialise
  234. @param inFormat an AudioStreamBasicDescription describing the data format that will be
  235. added to the audio file.
  236. @param inFlags relevant flags for creating/opening the file.
  237. if kAudioFileFlags_EraseFile is set, it will erase an existing file
  238. if not set, then the Create call will fail if the URL is an existing file
  239. @result returns noErr if successful.
  240. }
  241. function AudioFileComponentCreateURL( inComponent: AudioFileComponent; inFileRef: CFURLRef; const (*var*) inFormat: AudioStreamBasicDescription; inFlags: UInt32 ): OSStatus; external name '_AudioFileComponentCreateURL';
  242. (* API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, watchos, tvos) *)
  243. {!
  244. @function AudioFileComponentOpenURL
  245. @abstract Open an existing audio file.
  246. @discussion Open an existing audio file for reading or reading and writing.
  247. @param inComponent an AudioFileComponent.
  248. @param inFileRef the CFURLRef of an existing audio file.
  249. @param inPermissions use the permission constants.
  250. @param inFileDescriptor an open file descriptor.
  251. @result returns noErr if successful.
  252. }
  253. function AudioFileComponentOpenURL( inComponent: AudioFileComponent; inFileRef: CFURLRef; inPermissions: SInt8; inFileDescriptor: SInt32 ): OSStatus; external name '_AudioFileComponentOpenURL';
  254. (* API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, watchos, tvos) *)
  255. {!
  256. @function AudioFileComponentOpenWithCallbacks
  257. @abstract implements AudioFileOpenWithCallbacks
  258. @param inComponent an AudioFileComponent
  259. @param inClientData a constant that will be passed to your callbacks.
  260. @param inReadFunc a function that will be called when AudioFile needs to read data.
  261. @param inWriteFunc a function that will be called when AudioFile needs to write data.
  262. @param inGetSizeFunc a function that will be called when AudioFile needs to know the file size.
  263. @param inSetSizeFunc a function that will be called when AudioFile needs to set the file size.
  264. @result returns noErr if successful.
  265. }
  266. function AudioFileComponentOpenWithCallbacks( inComponent: AudioFileComponent; inClientData: UnivPtr; inReadFunc: AudioFile_ReadProc; inWriteFunc: AudioFile_WriteProc; inGetSizeFunc: AudioFile_GetSizeProc; inSetSizeFunc: AudioFile_SetSizeProc ): OSStatus; external name '_AudioFileComponentOpenWithCallbacks';
  267. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  268. {!
  269. @function AudioFileComponentInitializeWithCallbacks
  270. @abstract implements AudioFileInitializeWithCallbacks
  271. @param inComponent an AudioFileComponent
  272. @param inClientData a constant that will be passed to your callbacks.
  273. @param inReadFunc a function that will be called when AudioFile needs to read data.
  274. @param inWriteFunc a function that will be called when AudioFile needs to write data.
  275. @param inGetSizeFunc a function that will be called when AudioFile needs to know the file size.
  276. @param inSetSizeFunc a function that will be called when AudioFile needs to set the file size.
  277. @param inFileType an AudioFileTypeID indicating the type of audio file to which to initialize the file.
  278. @param inFormat an AudioStreamBasicDescription describing the data format that will be
  279. added to the audio file.
  280. @param inFlags relevant flags for creating/opening the file. Currently zero.
  281. @result returns noErr if successful.
  282. }
  283. function AudioFileComponentInitializeWithCallbacks( inComponent: AudioFileComponent; inClientData: UnivPtr; inReadFunc: AudioFile_ReadProc; inWriteFunc: AudioFile_WriteProc; inGetSizeFunc: AudioFile_GetSizeProc; inSetSizeFunc: AudioFile_SetSizeProc; inFileType: UInt32; const (*var*) inFormat: AudioStreamBasicDescription; inFlags: UInt32 ): OSStatus; external name '_AudioFileComponentInitializeWithCallbacks';
  284. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  285. {!
  286. @function AudioFileComponentCloseFile
  287. @abstract implements AudioFileClose.
  288. @param inComponent an AudioFileComponent
  289. @result returns noErr if successful.
  290. }
  291. function AudioFileComponentCloseFile( inComponent: AudioFileComponent ): OSStatus; external name '_AudioFileComponentCloseFile';
  292. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  293. {!
  294. @function AudioFileComponentOptimize
  295. @abstract implements AudioFileOptimize.
  296. @param inComponent an AudioFileComponent
  297. @result returns noErr if successful.
  298. }
  299. function AudioFileComponentOptimize( inComponent: AudioFileComponent ): OSStatus; external name '_AudioFileComponentOptimize';
  300. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  301. {!
  302. @function AudioFileComponentReadBytes
  303. @abstract implements AudioFileReadBytes.
  304. @discussion Returns kAudioFileEndOfFileError when read encounters end of file.
  305. @param inComponent an AudioFileComponent
  306. @param inUseCache true if it is desired to cache the data upon read, else false
  307. @param inStartingByte the byte offset of the audio data desired to be returned
  308. @param ioNumBytes on input, the number of bytes to read, on output, the number of
  309. bytes actually read.
  310. @param outBuffer outBuffer should be a void * to user allocated memory large enough for the requested bytes.
  311. @result returns noErr if successful.
  312. }
  313. function AudioFileComponentReadBytes( inComponent: AudioFileComponent; inUseCache: Boolean; inStartingByte: SInt64; var ioNumBytes: UInt32; outBuffer: UnivPtr ): OSStatus; external name '_AudioFileComponentReadBytes';
  314. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  315. {!
  316. @function AudioFileComponentWriteBytes
  317. @abstract implements AudioFileWriteBytes.
  318. @param inComponent an AudioFileComponent
  319. @param inUseCache true if it is desired to cache the data upon write, else false
  320. @param inStartingByte the byte offset where the audio data should be written
  321. @param ioNumBytes on input, the number of bytes to write, on output, the number of
  322. bytes actually written.
  323. @param inBuffer inBuffer should be a void * containing the bytes to be written
  324. @result returns noErr if successful.
  325. }
  326. function AudioFileComponentWriteBytes( inComponent: AudioFileComponent; inUseCache: Boolean; inStartingByte: SInt64; var ioNumBytes: UInt32; inBuffer: {const} UnivPtr ): OSStatus; external name '_AudioFileComponentWriteBytes';
  327. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  328. {!
  329. @function AudioFileComponentReadPackets
  330. @abstract implements AudioFileReadPackets.
  331. @discussion For all uncompressed formats, packets == frames.
  332. ioNumPackets less than requested indicates end of file.
  333. @param inComponent an AudioFileComponent
  334. @param inUseCache true if it is desired to cache the data upon read, else false
  335. @param outNumBytes on output, the number of bytes actually returned
  336. @param outPacketDescriptions on output, an array of packet descriptions describing
  337. the packets being returned. NULL may be passed for this
  338. parameter. Nothing will be returned for linear pcm data.
  339. @param inStartingPacket the packet index of the first packet desired to be returned
  340. @param ioNumPackets on input, the number of packets to read, on output, the number of
  341. packets actually read.
  342. @param outBuffer outBuffer should be a pointer to user allocated memory of size:
  343. number of packets requested times file's maximum (or upper bound on)
  344. packet size.
  345. @result returns noErr if successful.
  346. }
  347. function AudioFileComponentReadPackets( inComponent: AudioFileComponent; inUseCache: Boolean; var outNumBytes: UInt32; outPacketDescriptions: AudioStreamPacketDescriptionPtr {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; outBuffer: UnivPtr ): OSStatus; external name '_AudioFileComponentReadPackets';
  348. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  349. {!
  350. @function AudioFileComponentReadPacketData
  351. @abstract implements AudioFileReadPacketData.
  352. @discussion For all uncompressed formats, packets == frames.
  353. If the byte size of the number packets requested is
  354. less than the buffer size, ioNumBytes will be reduced.
  355. If the buffer is too small for the number of packets
  356. requested, ioNumPackets and ioNumBytes will be reduced
  357. to the number of packets that can be accommodated and their byte size.
  358. Returns kAudioFileEndOfFileError when read encounters end of file.
  359. @param inComponent an AudioFileComponent
  360. @param inUseCache true if it is desired to cache the data upon read, else false
  361. @param ioNumBytes on input the size of outBuffer in bytes.
  362. on output, the number of bytes actually returned.
  363. @param outPacketDescriptions on output, an array of packet descriptions describing
  364. the packets being returned. NULL may be passed for this
  365. parameter. Nothing will be returned for linear pcm data.
  366. @param inStartingPacket the packet index of the first packet desired to be returned
  367. @param ioNumPackets on input, the number of packets to read, on output, the number of
  368. packets actually read.
  369. @param outBuffer outBuffer should be a pointer to user allocated memory.
  370. @result returns noErr if successful.
  371. }
  372. function AudioFileComponentReadPacketData( inComponent: AudioFileComponent; inUseCache: Boolean; var ioNumBytes: UInt32; outPacketDescriptions: AudioStreamPacketDescriptionPtr {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; outBuffer: UnivPtr ): OSStatus; external name '_AudioFileComponentReadPacketData';
  373. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  374. {!
  375. @function AudioFileComponentWritePackets
  376. @abstract implements AudioFileWritePackets.
  377. @discussion For all uncompressed formats, packets == frames.
  378. @param inComponent an AudioFileComponent
  379. @param inUseCache true if it is desired to cache the data upon write, else false
  380. @param inNumBytes the number of bytes being provided for write
  381. @param inPacketDescriptions an array of packet descriptions describing the packets being
  382. provided. Not all formats require packet descriptions to be
  383. provided. NULL may be passed if no descriptions are required.
  384. @param inStartingPacket the packet index of where the first packet provided should be placed.
  385. @param ioNumPackets on input, the number of packets to write, on output, the number of
  386. packets actually written.
  387. @param inBuffer a void * to user allocated memory containing the packets to write.
  388. @result returns noErr if successful.
  389. }
  390. function AudioFileComponentWritePackets( inComponent: AudioFileComponent; inUseCache: Boolean; inNumBytes: UInt32; {const} inPacketDescriptions: AudioStreamPacketDescriptionPtr {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; inBuffer: {const} UnivPtr ): OSStatus; external name '_AudioFileComponentWritePackets';
  391. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  392. {!
  393. @function AudioFileComponentGetPropertyInfo
  394. @abstract implements AudioFileGetPropertyInfo.
  395. @param inComponent an AudioFileComponent
  396. @param inPropertyID an AudioFileProperty constant.
  397. @param outPropertySize the size in bytes of the current value of the property. In order to get the property value,
  398. you will need a buffer of this size.
  399. @param outWritable will be set to 1 if writable, or 0 if read only.
  400. @result returns noErr if successful.
  401. }
  402. function AudioFileComponentGetPropertyInfo( inComponent: AudioFileComponent; inPropertyID: AudioFileComponentPropertyID; outPropertySize: UInt32Ptr {* __nullable}; outWritable: UInt32Ptr {* __nullable} ): OSStatus; external name '_AudioFileComponentGetPropertyInfo';
  403. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  404. {!
  405. @function AudioFileComponentGetProperty
  406. @abstract implements AudioFileGetProperty.
  407. @param inComponent an AudioFileComponent
  408. @param inPropertyID an AudioFileProperty constant.
  409. @param ioPropertyDataSize on input the size of the outPropertyData buffer. On output the number of bytes written to the buffer.
  410. @param outPropertyData the buffer in which to write the property data.
  411. @result returns noErr if successful.
  412. }
  413. function AudioFileComponentGetProperty( inComponent: AudioFileComponent; inPropertyID: AudioFileComponentPropertyID; var ioPropertyDataSize: UInt32; outPropertyData: UnivPtr ): OSStatus; external name '_AudioFileComponentGetProperty';
  414. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  415. {!
  416. @function AudioFileComponentSetProperty
  417. @abstract implements AudioFileSetProperty.
  418. @param inComponent an AudioFileComponent
  419. @param inPropertyID an AudioFileProperty constant.
  420. @param inPropertyDataSize the size of the property data.
  421. @param inPropertyData the buffer containing the property data.
  422. @result returns noErr if successful.
  423. }
  424. function AudioFileComponentSetProperty( inComponent: AudioFileComponent; inPropertyID: AudioFileComponentPropertyID; inPropertyDataSize: UInt32; inPropertyData: {const} UnivPtr ): OSStatus; external name '_AudioFileComponentSetProperty';
  425. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  426. {!
  427. @function AudioFileComponentCountUserData
  428. @abstract implements AudioFileCountUserData
  429. @discussion "User Data" refers to chunks in AIFF, CAF and WAVE files, or resources
  430. in Sound Designer II files, and possibly other things in other files.
  431. For simplicity, referred to below as "chunks".
  432. @param inComponent an AudioFileComponent
  433. @param inUserDataID the four char code of the chunk.
  434. @param outNumberItems on output, if successful, number of chunks of this type in the file.
  435. @result returns noErr if successful.
  436. }
  437. function AudioFileComponentCountUserData( inComponent: AudioFileComponent; inUserDataID: UInt32; var outNumberItems: UInt32 ): OSStatus; external name '_AudioFileComponentCountUserData';
  438. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  439. {!
  440. @function AudioFileComponentGetUserDataSize
  441. @abstract implements AudioFileGetUserDataSize
  442. @param inComponent an AudioFileComponent
  443. @param inUserDataID the four char code of the chunk.
  444. @param inIndex an index specifying which chunk if there are more than one.
  445. @param outUserDataSize on output, if successful, the size of the user data chunk.
  446. @result returns noErr if successful.
  447. }
  448. function AudioFileComponentGetUserDataSize( inComponent: AudioFileComponent; inUserDataID: UInt32; inIndex: UInt32; var outUserDataSize: UInt32 ): OSStatus; external name '_AudioFileComponentGetUserDataSize';
  449. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  450. {!
  451. @function AudioFileGetUserData
  452. @abstract implements AudioFileGetUserData.
  453. @param inComponent an AudioFileComponent
  454. @param inUserDataID the four char code of the chunk.
  455. @param inIndex an index specifying which chunk if there are more than one.
  456. @param ioUserDataSize the size of the buffer on input, size of bytes copied to buffer on output
  457. @param outUserData a pointer to a buffer in which to copy the chunk data.
  458. @result returns noErr if successful.
  459. }
  460. function AudioFileComponentGetUserData( inComponent: AudioFileComponent; inUserDataID: UInt32; inIndex: UInt32; var ioUserDataSize: UInt32; outUserData: UnivPtr ): OSStatus; external name '_AudioFileComponentGetUserData';
  461. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  462. {!
  463. @function AudioFileComponentSetUserData
  464. @abstract implements AudioFileSetUserData.
  465. @param inComponent an AudioFileComponent
  466. @param inUserDataID the four char code of the chunk.
  467. @param inIndex an index specifying which chunk if there are more than one.
  468. @param inUserDataSize on input the size of the data to copy, on output, size of bytes copied from the buffer
  469. @param inUserData a pointer to a buffer from which to copy the chunk data
  470. (only the contents of the chunk, not including the chunk header).
  471. @result returns noErr if successful.
  472. }
  473. function AudioFileComponentSetUserData( inComponent: AudioFileComponent; inUserDataID: UInt32; inIndex: UInt32; inUserDataSize: UInt32; inUserData: {const} UnivPtr ): OSStatus; external name '_AudioFileComponentSetUserData';
  474. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  475. {!
  476. @function AudioFileComponentRemoveUserData
  477. @abstract implements AudioFileRemoveUserData.
  478. @param inComponent an AudioFileComponent
  479. @param inUserDataID the four char code of the chunk.
  480. @param inIndex an index specifying which chunk if there are more than one.
  481. @result returns noErr if successful.
  482. }
  483. function AudioFileComponentRemoveUserData( inComponent: AudioFileComponent; inUserDataID: UInt32; inIndex: UInt32 ): OSStatus; external name '_AudioFileComponentRemoveUserData';
  484. (* API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, watchos, tvos) *)
  485. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  486. // The following calls are not made on AudioFile instances.
  487. // These calls are used to determine the audio file type of some data.
  488. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  489. {!
  490. @function AudioFileComponentExtensionIsThisFormat
  491. @abstract used by the AudioFile API to determine if this component is appropriate for handling a file.
  492. @param inComponent an AudioFileComponent
  493. @param inExtension a CFString containing a file name extension.
  494. @param outResult on output, is set to 1 if the extension is recognized by this component, 0 if not.
  495. @result returns noErr if successful.
  496. }
  497. function AudioFileComponentExtensionIsThisFormat( inComponent: AudioFileComponent; inExtension: CFStringRef; var outResult: UInt32 ): OSStatus; external name '_AudioFileComponentExtensionIsThisFormat';
  498. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  499. {!
  500. @function AudioFileComponentFileDataIsThisFormat
  501. @abstract used by the AudioFile API to determine if this component is appropriate for handling a file.
  502. @param inComponent an AudioFileComponent
  503. @param inDataByteSize the size of inData in bytes.
  504. @param inData a pointer to a buffer of audio file data.
  505. @param outResult on output, is set to 1 if the file is recognized by this component, 0 if not.
  506. @result returns noErr if successful.
  507. }
  508. function AudioFileComponentFileDataIsThisFormat( inComponent: AudioFileComponent; inDataByteSize: UInt32; inData: {const} UnivPtr; var outResult: UInt32 ): OSStatus; external name '_AudioFileComponentFileDataIsThisFormat';
  509. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  510. {$ifc false}
  511. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  512. // The following two calls are deprecated.
  513. // Please implement AudioFileComponentFileDataIsThisFormat instead.
  514. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  515. {!
  516. @function AudioFileComponentFileIsThisFormat
  517. @abstract deprecated. use AudioFileComponentFileDataIsThisFormat instead.
  518. @param inComponent an AudioFileComponent
  519. @param inFileRefNum a refNum of a file.
  520. @param outResult on output, is set to 1 if the file is recognized by this component, 0 if not.
  521. @result returns noErr if successful.
  522. }
  523. function AudioFileComponentFileIsThisFormat( inComponent: AudioFileComponent; inFileRefNum: SInt16; var outResult: UInt32 ): OSStatus; external name '_AudioFileComponentFileIsThisFormat';
  524. (* API_DEPRECATED("no longer supported", macos(10.4, 10.5)) API_UNAVAILABLE(ios, watchos, tvos) *)
  525. {!
  526. @function AudioFileComponentDataIsThisFormat
  527. @abstract deprecated. use AudioFileComponentFileDataIsThisFormat instead.
  528. @param inComponent an AudioFileComponent
  529. @param inClientData a constant that will be passed to your callbacks.
  530. @param inReadFunc a function that will be called when AudioFile needs to read data.
  531. @param inWriteFunc a function that will be called when AudioFile needs to write data.
  532. @param inGetSizeFunc a function that will be called when AudioFile needs to know the file size.
  533. @param inSetSizeFunc a function that will be called when AudioFile needs to set the file size.
  534. @param outResult on output, is set to 1 if the file data is recognized by this component, 0 if not.
  535. @result returns noErr if successful.
  536. }
  537. function AudioFileComponentDataIsThisFormat( inComponent: AudioFileComponent; inClientData: UnivPtr {__nullable}; inReadFunc: AudioFile_ReadProc {__nullable}; inWriteFunc: AudioFile_WriteProc {__nullable}; inGetSizeFunc: AudioFile_GetSizeProc {__nullable}; inSetSizeFunc: AudioFile_SetSizeProc {__nullable}; var outResult: UInt32 ): OSStatus; external name '_AudioFileComponentDataIsThisFormat';
  538. (* API_DEPRECATED("no longer supported", macos(10.4, 10.5)) API_UNAVAILABLE(ios, watchos, tvos) *)
  539. {$endc}
  540. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  541. // The following calls are not made on AudioFile instances.
  542. // They implement the AudioFileGetGlobalInfo calls.
  543. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  544. {!
  545. @function AudioFileComponentGetGlobalInfoSize
  546. @abstract implements AudioFileGetGlobalInfoSize.
  547. @param inComponent an AudioFileComponent
  548. @param inPropertyID an AudioFileGlobalInfo property constant.
  549. @param inSpecifierSize The size of the specifier data.
  550. @param inSpecifier A specifier is a buffer of data used as an input argument to some of the global info properties.
  551. @param outPropertySize the size in bytes of the current value of the property. In order to get the property value,
  552. you will need a buffer of this size.
  553. @result returns noErr if successful.
  554. }
  555. function AudioFileComponentGetGlobalInfoSize( inComponent: AudioFileComponent; inPropertyID: AudioFileComponentPropertyID; inSpecifierSize: UInt32; {const} inSpecifier: UnivPtr {__nullable}; var outPropertySize: UInt32 ): OSStatus; external name '_AudioFileComponentGetGlobalInfoSize';
  556. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  557. {!
  558. @function AudioFileComponentGetGlobalInfo
  559. @abstract implements AudioFileGetGlobalInfo.
  560. @param inComponent an AudioFileComponent
  561. @param inPropertyID an AudioFileGlobalInfo property constant.
  562. @param inSpecifierSize The size of the specifier data.
  563. @param inSpecifier A specifier is a buffer of data used as an input argument to some of the global info properties.
  564. @param ioPropertyDataSize on input the size of the outPropertyData buffer. On output the number of bytes written to the buffer.
  565. @param outPropertyData the buffer in which to write the property data.
  566. @result returns noErr if successful.
  567. }
  568. function AudioFileComponentGetGlobalInfo( inComponent: AudioFileComponent; inPropertyID: AudioFileComponentPropertyID; inSpecifierSize: UInt32; {const} inSpecifier: UnivPtr {__nullable}; var ioPropertyDataSize: UInt32; outPropertyData: UnivPtr ): OSStatus; external name '_AudioFileComponentGetGlobalInfo';
  569. (* API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, watchos, tvos) *)
  570. //==================================================================================================
  571. // Properties for AudioFileComponentGetGlobalInfo.
  572. //==================================================================================================
  573. {!
  574. @enum AudioFileComponent specific properties
  575. @constant kAudioFileComponent_CanRead
  576. Is file type readable? Returns a UInt32 1 or 0.
  577. @constant kAudioFileComponent_CanWrite
  578. Is file type writeable? Returns a UInt32 1 or 0.
  579. @constant kAudioFileComponent_FileTypeName
  580. Returns a CFString containing the name for the file type.
  581. @constant kAudioFileComponent_ExtensionsForType
  582. Returns a CFArray of CFStrings containing the file extensions
  583. that are recognized for this file type.
  584. @constant kAudioFileComponent_UTIsForType
  585. Returns a CFArray of CFStrings containing the universal type identifiers
  586. for this file type.
  587. @constant kAudioFileComponent_MIMETypesForType
  588. Returns a CFArray of CFStrings containing the MIME types
  589. for this file type.
  590. @constant kAudioFileComponent_AvailableFormatIDs
  591. Returns a array of format IDs for formats that can be read.
  592. @constant kAudioFileComponent_AvailableStreamDescriptionsForFormat
  593. The specifier is the format ID for the requested format.
  594. Returns an array of AudioStreamBasicDescriptions which have all of the
  595. formats for a particular file type and format ID. The AudioStreamBasicDescriptions
  596. have the following fields filled in: mFormatID, mFormatFlags, mBitsPerChannel
  597. @constant kAudioFileComponent_FastDispatchTable
  598. Deprecated. This selector is no longer called by the implementation.
  599. @constant kAudioFileComponent_HFSTypeCodesForType
  600. Returns an array of HFSTypeCodes corresponding to this file type.
  601. The first type in the array is the preferred one for use when
  602. writing new files.
  603. }
  604. const
  605. kAudioFileComponent_CanRead = FourCharCode('cnrd');
  606. kAudioFileComponent_CanWrite = FourCharCode('cnwr');
  607. kAudioFileComponent_FileTypeName = FourCharCode('ftnm');
  608. kAudioFileComponent_UTIsForType = FourCharCode('futi');
  609. kAudioFileComponent_MIMETypesForType = FourCharCode('fmim');
  610. kAudioFileComponent_ExtensionsForType = FourCharCode('fext');
  611. kAudioFileComponent_AvailableFormatIDs = FourCharCode('fmid');
  612. kAudioFileComponent_AvailableStreamDescriptionsForFormat = FourCharCode('sdid');
  613. kAudioFileComponent_FastDispatchTable = FourCharCode('fdft');
  614. kAudioFileComponent_HFSTypeCodesForType = FourCharCode('fhfs');
  615. //==================================================================================================
  616. // Selectors for the component routines
  617. //==================================================================================================
  618. const
  619. kAudioFileCreateSelect = $0001;
  620. kAudioFileOpenSelect = $0002;
  621. kAudioFileInitializeSelect = $0003;
  622. kAudioFileOpenWithCallbacksSelect = $0004;
  623. kAudioFileInitializeWithCallbacksSelect = $0005;
  624. kAudioFileCloseSelect = $0006;
  625. kAudioFileOptimizeSelect = $0007;
  626. kAudioFileReadBytesSelect = $0008;
  627. kAudioFileWriteBytesSelect = $0009;
  628. kAudioFileReadPacketsSelect = $000A;
  629. kAudioFileWritePacketsSelect = $000B;
  630. kAudioFileGetPropertyInfoSelect = $000C;
  631. kAudioFileGetPropertySelect = $000D;
  632. kAudioFileSetPropertySelect = $000E;
  633. kAudioFileExtensionIsThisFormatSelect = $000F;
  634. kAudioFileFileIsThisFormatSelect = $0010;
  635. kAudioFileDataIsThisFormatSelect = $0011;
  636. kAudioFileGetGlobalInfoSizeSelect = $0012;
  637. kAudioFileGetGlobalInfoSelect = $0013;
  638. kAudioFileCountUserDataSelect = $0014;
  639. kAudioFileGetUserDataSizeSelect = $0015;
  640. kAudioFileGetUserDataSelect = $0016;
  641. kAudioFileSetUserDataSelect = $0017;
  642. kAudioFileRemoveUserDataSelect = $0018;
  643. kAudioFileCreateURLSelect = $0019;
  644. kAudioFileOpenURLSelect = $001A;
  645. kAudioFileFileDataIsThisFormatSelect = $001B;
  646. kAudioFileReadPacketDataSelect = $001C;
  647. //#pragma mark -
  648. //#pragma mark Deprecated
  649. //==================================================================================================
  650. // Fast Dispatch Function typedefs. Deprecated. These are no longer used by the implementation.
  651. //==================================================================================================
  652. type
  653. ReadBytesFDF = function( inComponentStorage: UnivPtr; inUseCache: Boolean; inStartingByte: SInt64; var ioNumBytes: UInt32; outBuffer: UnivPtr ): OSStatus;
  654. type
  655. WriteBytesFDF = function( inComponentStorage: UnivPtr; inUseCache: Boolean; inStartingByte: SInt64; var ioNumBytes: UInt32; inBuffer: {const} UnivPtr ): OSStatus;
  656. type
  657. ReadPacketsFDF = function( inComponentStorage: UnivPtr; inUseCache: Boolean; var outNumBytes: UInt32; outPacketDescriptions: AudioStreamPacketDescriptionPtr {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; outBuffer: UnivPtr ): OSStatus;
  658. type
  659. ReadPacketDataFDF = function( inComponentStorage: UnivPtr; inUseCache: Boolean; var ioNumBytes: UInt32; outPacketDescriptions: AudioStreamPacketDescriptionPtr {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; outBuffer: UnivPtr ): OSStatus;
  660. type
  661. WritePacketsFDF = function( inComponentStorage: UnivPtr; inUseCache: Boolean; inNumBytes: UInt32; {const} inPacketDescriptions: AudioStreamPacketDescriptionPtr {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; inBuffer: {const} UnivPtr ): OSStatus;
  662. type
  663. GetPropertyInfoFDF = function( inComponentStorage: UnivPtr; inPropertyID: AudioFilePropertyID; outDataSize: UInt32Ptr {* __nullable}; isWritable: UInt32Ptr {* __nullable} ): OSStatus;
  664. type
  665. GetPropertyFDF = function( inComponentStorage: UnivPtr; inPropertyID: AudioFilePropertyID; var ioDataSize: UInt32; ioPropertyData: UnivPtr ): OSStatus;
  666. type
  667. SetPropertyFDF = function( inComponentStorage: UnivPtr; inPropertyID: AudioFilePropertyID; inDataSize: UInt32; inPropertyData: {const} UnivPtr ): OSStatus;
  668. type
  669. CountUserDataFDF = function( inComponentStorage: UnivPtr; inUserDataID: UInt32; var outNumberItems: UInt32 ): OSStatus;
  670. type
  671. GetUserDataSizeFDF = function( inComponentStorage: UnivPtr; inUserDataID: UInt32; inIndex: UInt32; var outDataSize: UInt32 ): OSStatus;
  672. type
  673. GetUserDataFDF = function( inComponentStorage: UnivPtr; inUserDataID: UInt32; inIndex: UInt32; var ioUserDataSize: UInt32; outUserData: UnivPtr ): OSStatus;
  674. type
  675. SetUserDataFDF = function( inComponentStorage: UnivPtr; inUserDataID: UInt32; inIndex: UInt32; inUserDataSize: UInt32; inUserData: {const} UnivPtr ): OSStatus;
  676. { no fast dispatch for kAudioFileRemoveUserDataSelect }
  677. //#pragma /mark -
  678. //#pragma /mark Deprecated
  679. //==================================================================================================
  680. // Fast Dispatch Function tables. Deprecated. These are no longer used by the implementation.
  681. //==================================================================================================
  682. type
  683. AudioFileFDFTable = record
  684. mComponentStorage: UnivPtr;
  685. mReadBytesFDF: ReadBytesFDF;
  686. mWriteBytesFDF: WriteBytesFDF;
  687. mReadPacketsFDF: ReadPacketsFDF;
  688. mWritePacketsFDF: WritePacketsFDF;
  689. mGetPropertyInfoFDF: GetPropertyInfoFDF;
  690. mGetPropertyFDF: GetPropertyFDF;
  691. mSetPropertyFDF: SetPropertyFDF;
  692. mCountUserDataFDF: CountUserDataFDF;
  693. mGetUserDataSizeFDF: GetUserDataSizeFDF;
  694. mGetUserDataFDF: GetUserDataFDF;
  695. mSetUserDataFDF: SetUserDataFDF;
  696. end;
  697. AudioFileFDFTablePtr = ^AudioFileFDFTable;
  698. (* API_DEPRECATED("no longer supported", macos(10.4, 10.7)) API_UNAVAILABLE(ios, watchos, tvos); *)
  699. type
  700. AudioFileFDFTableExtended = record
  701. mComponentStorage: UnivPtr;
  702. mReadBytesFDF: ReadBytesFDF;
  703. mWriteBytesFDF: WriteBytesFDF;
  704. mReadPacketsFDF: ReadPacketsFDF;
  705. mWritePacketsFDF: WritePacketsFDF;
  706. mGetPropertyInfoFDF: GetPropertyInfoFDF;
  707. mGetPropertyFDF: GetPropertyFDF;
  708. mSetPropertyFDF: SetPropertyFDF;
  709. mCountUserDataFDF: CountUserDataFDF;
  710. mGetUserDataSizeFDF: GetUserDataSizeFDF;
  711. mGetUserDataFDF: GetUserDataFDF;
  712. mSetUserDataFDF: SetUserDataFDF;
  713. mReadPacketDataFDF: ReadPacketDataFDF;
  714. end;
  715. AudioFileFDFTableExtendedPtr = ^AudioFileFDFTableExtended;
  716. (* API_DEPRECATED("no longer supported", macos(10.4, 10.7)) API_UNAVAILABLE(ios, watchos, tvos);*)
  717. {!
  718. @functiongroup Deprecated AFComponent
  719. @discussion These API calls are no longer called on Snow Leopard, instead the URL versions are used.
  720. They can be provided by the file component for compatibility with Leopard and Tiger systems
  721. }
  722. {!
  723. @function AudioFileComponentCreate
  724. @abstract implements AudioFileCreate
  725. @param inComponent an AudioFileComponent
  726. @param inParentRef an FSRef to the directory where the new file should be created.
  727. @param inFileName a CFStringRef containing the name of the file to be created.
  728. @param inFormat an AudioStreamBasicDescription describing the data format that will be
  729. added to the audio file.
  730. @param inFlags relevant flags for creating/opening the file. Currently zero.
  731. @param outNewFileRef if successful, the FSRef of the newly created file.
  732. @result returns noErr if successful.
  733. }
  734. function AudioFileComponentCreate( inComponent: AudioFileComponent; {const} inParentRef: FSRefPtr; inFileName: CFStringRef; const (*var*) inFormat: AudioStreamBasicDescription; inFlags: UInt32; outNewFileRef: FSRefPtr ): OSStatus; external name '_AudioFileComponentCreate';
  735. (* API_DEPRECATED("no longer supported", macos(10.4, 10.6)) API_UNAVAILABLE(ios, watchos, tvos) *)
  736. {!
  737. @function AudioFileComponentInitialize
  738. @abstract implements AudioFileInitialize
  739. @param inComponent an AudioFileComponent
  740. @param inFileRef the FSRef of an existing audio file.
  741. @param inFormat an AudioStreamBasicDescription describing the data format that will be
  742. added to the audio file.
  743. @param inFlags flags for creating/opening the file. Currently zero.
  744. @result returns noErr if successful.
  745. }
  746. function AudioFileComponentInitialize( inComponent: AudioFileComponent; {const} inFileRef: FSRefPtr; const (*var*) inFormat: AudioStreamBasicDescription; inFlags: UInt32 ): OSStatus; external name '_AudioFileComponentInitialize';
  747. (* API_DEPRECATED("no longer supported", macos(10.4, 10.6)) API_UNAVAILABLE(ios, watchos, tvos) *)
  748. {!
  749. @function AudioFileComponentOpenFile
  750. @abstract implements AudioFileOpen
  751. @param inComponent an AudioFileComponent
  752. @param inFileRef the FSRef of an existing audio file.
  753. @param inPermissions use the permission constants
  754. @param inRefNum the file refNum for the opened file. This avoids opening the file twice
  755. - once to determine which file type to which to delegate and once to parse it.
  756. @result returns noErr if successful.
  757. }
  758. function AudioFileComponentOpenFile( inComponent: AudioFileComponent; {const} inFileRef: FSRefPtr; inPermissions: SInt8; inRefNum: SInt16 ): OSStatus; external name '_AudioFileComponentOpenFile';
  759. (* API_DEPRECATED("no longer supported", macos(10.4, 10.6)) API_UNAVAILABLE(ios, watchos, tvos) *)
  760. //=====================================================================================================================
  761. type
  762. AudioFileComponentCreateURLProc = function( self: UnivPtr; inFileRef: CFURLRef; const (*var*) inFormat: AudioStreamBasicDescription; inFlags: UInt32 ): OSStatus;
  763. AudioFileComponentOpenURLProc = function( self: UnivPtr; inFileRef: CFURLRef; inPermissions: SInt8; inFileDescriptor: SInt32 ): OSStatus;
  764. type
  765. AudioFileComponentOpenWithCallbacksProc = function( self: UnivPtr; inClientData: UnivPtr; inReadFunc: AudioFile_ReadProc; inWriteFunc: AudioFile_WriteProc; inGetSizeFunc: AudioFile_GetSizeProc; inSetSizeFunc: AudioFile_SetSizeProc ): OSStatus;
  766. type
  767. AudioFileComponentInitializeWithCallbacksProc = function( self: UnivPtr; inClientData: UnivPtr; inReadFunc: AudioFile_ReadProc; inWriteFunc: AudioFile_WriteProc; inGetSizeFunc: AudioFile_GetSizeProc; inSetSizeFunc: AudioFile_SetSizeProc; inFileType: UInt32; const (*var*) inFormat: AudioStreamBasicDescription; inFlags: UInt32 ): OSStatus;
  768. type
  769. AudioFileComponentCloseProc = function( self: UnivPtr ): OSStatus;
  770. type
  771. AudioFileComponentOptimizeProc = function( self: UnivPtr ): OSStatus;
  772. type
  773. AudioFileComponentReadBytesProc = function( self: UnivPtr; inUseCache: Boolean; inStartingByte: SInt64; var ioNumBytes: UInt32; outBuffer: UnivPtr ): OSStatus;
  774. type
  775. AudioFileComponentWriteBytesProc = function( self: UnivPtr; inUseCache: Boolean; inStartingByte: SInt64; var ioNumBytes: UInt32; inBuffer: {const} UnivPtr ): OSStatus;
  776. type
  777. AudioFileComponentReadPacketsProc = function( self: UnivPtr; inUseCache: Boolean; var outNumBytes: UInt32; outPacketDescriptions: AudioStreamPacketDescriptionPtr {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; outBuffer: UnivPtr ): OSStatus;
  778. type
  779. AudioFileComponentReadPacketDataProc = function( self: UnivPtr; inUseCache: Boolean; var ioNumBytes: UInt32; outPacketDescriptions: AudioStreamPacketDescription {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; outBuffer: UnivPtr ): OSStatus;
  780. type
  781. AudioFileComponentWritePacketsProc = function( self: UnivPtr; inUseCache: Boolean; inNumBytes: UInt32; {const} inPacketDescriptions: AudioStreamPacketDescription {* __nullable}; inStartingPacket: SInt64; var ioNumPackets: UInt32; inBuffer: {const} UnivPtr ): OSStatus;
  782. type
  783. AudioFileComponentGetPropertyInfoProc = function( self: UnivPtr; inPropertyID: AudioFileComponentPropertyID; outPropertySize: UInt32Ptr {* __nullable}; outWritable: UInt32Ptr {* __nullable} ): OSStatus;
  784. type
  785. AudioFileComponentGetPropertyProc = function( self: UnivPtr; inPropertyID: AudioFileComponentPropertyID; var ioPropertyDataSize: UInt32; outPropertyData: UnivPtr ): OSStatus;
  786. type
  787. AudioFileComponentSetPropertyProc = function( self: UnivPtr; inPropertyID: AudioFileComponentPropertyID; inPropertyDataSize: UInt32; inPropertyData: {const} UnivPtr ): OSStatus;
  788. type
  789. AudioFileComponentCountUserDataProc = function( self: UnivPtr; inUserDataID: UInt32; var outNumberItems: UInt32 ): OSStatus;
  790. type
  791. AudioFileComponentGetUserDataSizeProc = function( self: UnivPtr; inUserDataID: UInt32; inIndex: UInt32; var outUserDataSize: UInt32 ): OSStatus;
  792. type
  793. AudioFileComponentGetUserDataProc = function( self: UnivPtr; inUserDataID: UInt32; inIndex: UInt32; var ioUserDataSize: UInt32; outUserData: UnivPtr ): OSStatus;
  794. type
  795. AudioFileComponentSetUserDataProc = function( self: UnivPtr; inUserDataID: UInt32; inIndex: UInt32; inUserDataSize: UInt32; inUserData: {const} UnivPtr ): OSStatus;
  796. type
  797. AudioFileComponentRemoveUserDataProc = function( self: UnivPtr; inUserDataID: UInt32; inIndex: UInt32 ): OSStatus;
  798. type
  799. AudioFileComponentExtensionIsThisFormatProc = function( self: UnivPtr; inExtension: CFStringRef; var outResult: UInt32 ): OSStatus;
  800. type
  801. AudioFileComponentFileDataIsThisFormatProc = function( self: UnivPtr; inDataByteSize: UInt32; inData: {const} UnivPtr; var outResult: UInt32 ): OSStatus;
  802. type
  803. AudioFileComponentGetGlobalInfoSizeProc = function( self: UnivPtr; inPropertyID: AudioFileComponentPropertyID; inSpecifierSize: UInt32; {const} inSpecifier: UnivPtr {__nullable}; var outPropertySize: UInt32 ): OSStatus;
  804. type
  805. AudioFileComponentGetGlobalInfoProc = function( self: UnivPtr; inPropertyID: AudioFileComponentPropertyID; inSpecifierSize: UInt32; {const} inSpecifier: UnivPtr {__nullable}; var ioPropertyDataSize: UInt32; outPropertyData: UnivPtr ): OSStatus;
  806. {$endc} {TARGET_OS_MAC}
  807. //CF_ASSUME_NONNULL_END
  808. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  809. end.
  810. {$endc} {not MACOSALLINCLUDE}