AudioConverter.pas 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. {!
  2. @file AudioConverter.h
  3. @framework AudioToolbox.framework
  4. @copyright (c) 1985-2015 by Apple, Inc., all rights reserved.
  5. @abstract API's to perform audio format conversions.
  6. @discussion
  7. AudioConverters convert between various linear PCM and compressed
  8. audio formats. Supported transformations include:
  9. - PCM float/integer/bit depth conversions
  10. - PCM sample rate conversion
  11. - PCM interleaving and deinterleaving
  12. - encoding PCM to compressed formats
  13. - decoding compressed formats to PCM
  14. A single AudioConverter may perform more than one
  15. of the above transformations.
  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 AudioConverter;
  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,CoreAudioTypes;
  207. {$endc} {not MACOSALLINCLUDE}
  208. {$ALIGN POWER}
  209. //==================================================================================================
  210. {!
  211. @header AudioConverter.h
  212. }
  213. //=============================================================================
  214. // Includes
  215. //=============================================================================
  216. //CF_ASSUME_NONNULL_BEGIN
  217. //=============================================================================
  218. // Theory of Operation
  219. //=============================================================================
  220. //=============================================================================
  221. // Types specific to the Audio Converter API
  222. //=============================================================================
  223. {!
  224. @typedef AudioConverterRef
  225. @abstract A reference to an AudioConverter object.
  226. }
  227. type
  228. AudioConverterRef = ^OpaqueAudioConverter; { an opaque type }
  229. OpaqueAudioConverter = record end;
  230. type
  231. AudioConverterPropertyID = UInt32;
  232. //=============================================================================
  233. // Standard Properties
  234. //=============================================================================
  235. {!
  236. @enum AudioConverterPropertyID
  237. @abstract The properties of an AudioConverter, accessible via AudioConverterGetProperty()
  238. and AudioConverterSetProperty().
  239. @constant kAudioConverterPropertyMinimumInputBufferSize
  240. a UInt32 that indicates the size in bytes of the smallest buffer of input
  241. data that can be supplied via the AudioConverterInputProc or as the input to
  242. AudioConverterConvertBuffer
  243. @constant kAudioConverterPropertyMinimumOutputBufferSize
  244. a UInt32 that indicates the size in bytes of the smallest buffer of output
  245. data that can be supplied to AudioConverterFillComplexBuffer or as the output to
  246. AudioConverterConvertBuffer
  247. @constant kAudioConverterPropertyMaximumInputBufferSize
  248. DEPRECATED. The AudioConverter input proc may be passed any number of packets of data.
  249. If fewer are packets are returned than required, then the input proc will be called again.
  250. If more packets are passed than required, they will remain in the client's buffer and be
  251. consumed as needed.
  252. @constant kAudioConverterPropertyMaximumInputPacketSize
  253. a UInt32 that indicates the size in bytes of the largest single packet of
  254. data in the input format. This is mostly useful for variable bit rate
  255. compressed data (decoders).
  256. @constant kAudioConverterPropertyMaximumOutputPacketSize
  257. a UInt32 that indicates the size in bytes of the largest single packet of
  258. data in the output format. This is mostly useful for variable bit rate
  259. compressed data (encoders).
  260. @constant kAudioConverterPropertyCalculateInputBufferSize
  261. a UInt32 that on input holds a size in bytes that is desired for the output
  262. data. On output, it will hold the size in bytes of the input buffer required
  263. to generate that much output data. Note that some converters cannot do this
  264. calculation.
  265. @constant kAudioConverterPropertyCalculateOutputBufferSize
  266. a UInt32 that on input holds a size in bytes that is desired for the input
  267. data. On output, it will hold the size in bytes of the output buffer
  268. required to hold the output data that will be generated. Note that some
  269. converters cannot do this calculation.
  270. @constant kAudioConverterPropertyInputCodecParameters
  271. The value of this property varies from format to format and is considered
  272. private to the format. It is treated as a buffer of untyped data.
  273. @constant kAudioConverterPropertyOutputCodecParameters
  274. The value of this property varies from format to format and is considered
  275. private to the format. It is treated as a buffer of untyped data.
  276. @constant kAudioConverterSampleRateConverterAlgorithm
  277. DEPRECATED: please use kAudioConverterSampleRateConverterComplexity instead
  278. @constant kAudioConverterSampleRateConverterComplexity
  279. An OSType that specifies the sample rate converter algorithm to use (as defined in
  280. AudioToolbox/AudioUnitProperties.h)
  281. @constant kAudioConverterSampleRateConverterQuality
  282. A UInt32 that specifies rendering quality of the sample rate converter (see
  283. enum constants below)
  284. @constant kAudioConverterSampleRateConverterInitialPhase
  285. A Float64 with value 0.0 <= x < 1.0 giving the initial subsample position of the
  286. sample rate converter.
  287. @constant kAudioConverterCodecQuality
  288. A UInt32 that specifies rendering quality of a codec (see enum constants
  289. below)
  290. @constant kAudioConverterPrimeMethod
  291. a UInt32 specifying priming method (usually for sample-rate converter) see
  292. explanation for struct AudioConverterPrimeInfo below along with enum
  293. constants
  294. @constant kAudioConverterPrimeInfo
  295. A pointer to AudioConverterPrimeInfo (see explanation for struct
  296. AudioConverterPrimeInfo below)
  297. @constant kAudioConverterChannelMap
  298. An array of SInt32's. The size of the array is the number of output
  299. channels, and each element specifies which input channel's data is routed to
  300. that output channel (using a 0-based index of the input channels), or -1 if
  301. no input channel is to be routed to that output channel. The default
  302. behavior is as follows. I = number of input channels, O = number of output
  303. channels. When I > O, the first O inputs are routed to the first O outputs,
  304. and the remaining puts discarded. When O > I, the first I inputs are routed
  305. to the first O outputs, and the remaining outputs are zeroed.
  306. A simple example for splitting mono input to stereo output (instead of routing
  307. the input to only the first output channel):
  308. <pre>
  309. // this should be as large as the number of output channels:
  310. SInt32 channelMap[2] = ( 0, 0 );
  311. AudioConverterSetProperty(theConverter, kAudioConverterChannelMap,
  312. sizeof(channelMap), channelMap);
  313. </pre>
  314. @constant kAudioConverterDecompressionMagicCookie
  315. A void * pointing to memory set up by the caller. Required by some formats
  316. in order to decompress the input data.
  317. @constant kAudioConverterCompressionMagicCookie
  318. A void * pointing to memory set up by the caller. Returned by the converter
  319. so that it may be stored along with the output data. It can then be passed
  320. back to the converter for decompression at a later time.
  321. @constant kAudioConverterEncodeBitRate
  322. A UInt32 containing the number of bits per second to aim for when encoding
  323. data. Some decoders will also allow you to get this property to discover the bit rate.
  324. @constant kAudioConverterEncodeAdjustableSampleRate
  325. For encoders where the AudioConverter was created with an output sample rate
  326. of zero, and the codec can do rate conversion on its input, this provides a
  327. way to set the output sample rate. The property value is a Float64.
  328. @constant kAudioConverterInputChannelLayout
  329. The property value is an AudioChannelLayout.
  330. @constant kAudioConverterOutputChannelLayout
  331. The property value is an AudioChannelLayout.
  332. @constant kAudioConverterApplicableEncodeBitRates
  333. The property value is an array of AudioValueRange describing applicable bit
  334. rates based on current settings.
  335. @constant kAudioConverterAvailableEncodeBitRates
  336. The property value is an array of AudioValueRange describing available bit
  337. rates based on the input format. You can get all available bit rates from
  338. the AudioFormat API.
  339. @constant kAudioConverterApplicableEncodeSampleRates
  340. The property value is an array of AudioValueRange describing applicable
  341. sample rates based on current settings.
  342. @constant kAudioConverterAvailableEncodeSampleRates
  343. The property value is an array of AudioValueRange describing available
  344. sample rates based on the input format. You can get all available sample
  345. rates from the AudioFormat API.
  346. @constant kAudioConverterAvailableEncodeChannelLayoutTags
  347. The property value is an array of AudioChannelLayoutTags for the format and
  348. number of channels specified in the input format going to the encoder.
  349. @constant kAudioConverterCurrentOutputStreamDescription
  350. Returns the current completely specified output AudioStreamBasicDescription.
  351. For example when encoding to AAC, your original output stream description
  352. will not have been completely filled out.
  353. @constant kAudioConverterCurrentInputStreamDescription
  354. Returns the current completely specified input AudioStreamBasicDescription.
  355. @constant kAudioConverterPropertySettings
  356. Returns the a CFArray of property settings for converters.
  357. @constant kAudioConverterPropertyBitDepthHint
  358. An SInt32 of the source bit depth to preserve. This is a hint to some
  359. encoders like lossless about how many bits to preserve in the input. The
  360. converter usually tries to preserve as many as possible, but a lossless
  361. encoder will do poorly if more bits are supplied than are desired in the
  362. output. The bit depth is expressed as a negative number if the source was floating point,
  363. e.g. -32 for float, -64 for double.
  364. @constant kAudioConverterPropertyFormatList
  365. An array of AudioFormatListItem structs describing all the data formats produced by the
  366. encoder end of the AudioConverter. If the ioPropertyDataSize parameter indicates that
  367. outPropertyData is sizeof(AudioFormatListItem), then only the best format is returned.
  368. This property may be used for example to discover all the data formats produced by the AAC_HE2
  369. (AAC High Efficiency vers. 2) encoder.
  370. }
  371. const
  372. kAudioConverterPropertyMinimumInputBufferSize = FourCharCode('mibs');
  373. kAudioConverterPropertyMinimumOutputBufferSize = FourCharCode('mobs');
  374. kAudioConverterPropertyMaximumInputBufferSize = FourCharCode('xibs');
  375. kAudioConverterPropertyMaximumInputPacketSize = FourCharCode('xips');
  376. kAudioConverterPropertyMaximumOutputPacketSize = FourCharCode('xops');
  377. kAudioConverterPropertyCalculateInputBufferSize = FourCharCode('cibs');
  378. kAudioConverterPropertyCalculateOutputBufferSize = FourCharCode('cobs');
  379. kAudioConverterPropertyInputCodecParameters = FourCharCode('icdp');
  380. kAudioConverterPropertyOutputCodecParameters = FourCharCode('ocdp');
  381. kAudioConverterSampleRateConverterAlgorithm = FourCharCode('srci');
  382. kAudioConverterSampleRateConverterComplexity = FourCharCode('srca');
  383. kAudioConverterSampleRateConverterQuality = FourCharCode('srcq');
  384. kAudioConverterSampleRateConverterInitialPhase = FourCharCode('srcp');
  385. kAudioConverterCodecQuality = FourCharCode('cdqu');
  386. kAudioConverterPrimeMethod = FourCharCode('prmm');
  387. kAudioConverterPrimeInfo = FourCharCode('prim');
  388. kAudioConverterChannelMap = FourCharCode('chmp');
  389. kAudioConverterDecompressionMagicCookie = FourCharCode('dmgc');
  390. kAudioConverterCompressionMagicCookie = FourCharCode('cmgc');
  391. kAudioConverterEncodeBitRate = FourCharCode('brat');
  392. kAudioConverterEncodeAdjustableSampleRate = FourCharCode('ajsr');
  393. kAudioConverterInputChannelLayout = FourCharCode('icl ');
  394. kAudioConverterOutputChannelLayout = FourCharCode('ocl ');
  395. kAudioConverterApplicableEncodeBitRates = FourCharCode('aebr');
  396. kAudioConverterAvailableEncodeBitRates = FourCharCode('vebr');
  397. kAudioConverterApplicableEncodeSampleRates = FourCharCode('aesr');
  398. kAudioConverterAvailableEncodeSampleRates = FourCharCode('vesr');
  399. kAudioConverterAvailableEncodeChannelLayoutTags = FourCharCode('aecl');
  400. kAudioConverterCurrentOutputStreamDescription = FourCharCode('acod');
  401. kAudioConverterCurrentInputStreamDescription = FourCharCode('acid');
  402. kAudioConverterPropertySettings = FourCharCode('acps');
  403. kAudioConverterPropertyBitDepthHint = FourCharCode('acbd');
  404. kAudioConverterPropertyFormatList = FourCharCode('flst');
  405. //=============================================================================
  406. //
  407. //=============================================================================
  408. {!
  409. @enum Mac OS X AudioConverter Properties
  410. @constant kAudioConverterPropertyDithering
  411. A UInt32. Set to a value from the enum of dithering algorithms below.
  412. Zero means no dithering and is the default. (Mac OS X only.)
  413. @constant kAudioConverterPropertyDitherBitDepth
  414. A UInt32. Dither is applied at this bit depth. (Mac OS X only.)
  415. }
  416. const
  417. kAudioConverterPropertyDithering = FourCharCode('dith');
  418. kAudioConverterPropertyDitherBitDepth = FourCharCode('dbit');
  419. {!
  420. @enum Dithering algorithms
  421. @abstract Constants to be used as the value for kAudioConverterPropertyDithering.
  422. @constant kDitherAlgorithm_TPDF Dither signal is generated by a white noise source with a triangular probability density function
  423. @constant kDitherAlgorithm_NoiseShaping Use a static, perceptually weighted noise shaped dither
  424. }
  425. const
  426. kDitherAlgorithm_TPDF = 1;
  427. kDitherAlgorithm_NoiseShaping = 2;
  428. {!
  429. @enum Quality constants
  430. @abstract Constants to be used with kAudioConverterSampleRateConverterQuality.
  431. @constant kAudioConverterQuality_Max maximum quality
  432. @constant kAudioConverterQuality_High high quality
  433. @constant kAudioConverterQuality_Medium medium quality
  434. @constant kAudioConverterQuality_Low low quality
  435. @constant kAudioConverterQuality_Min minimum quality
  436. }
  437. const
  438. kAudioConverterQuality_Max = $7F;
  439. kAudioConverterQuality_High = $60;
  440. kAudioConverterQuality_Medium = $40;
  441. kAudioConverterQuality_Low = $20;
  442. kAudioConverterQuality_Min = 0;
  443. {!
  444. @enum Sample Rate Converter Complexity
  445. @constant kAudioConverterSampleRateConverterComplexity_Linear
  446. @discussion Linear interpolation. lowest quality, cheapest.
  447. InitialPhase and PrimeMethod properties are not operative with this mode.
  448. @constant kAudioConverterSampleRateConverterComplexity_Normal
  449. @discussion Normal quality sample rate conversion.
  450. @constant kAudioConverterSampleRateConverterComplexity_Mastering
  451. @discussion Mastering quality sample rate conversion. More expensive.
  452. @constant kAudioConverterSampleRateConverterComplexity_MinimumPhase
  453. @discussion Minimum phase impulse response. Stopband attenuation varies with quality setting.
  454. The InitialPhase and PrimeMethod properties are not operative with this mode.
  455. There are three levels of quality provided.
  456. kAudioConverterQuality_Low (or Min) : noise floor to -96 dB
  457. kAudioConverterQuality_Medium : noise floor to -144 dB
  458. kAudioConverterQuality_High (or Max) : noise floor to -160 dB (this uses double precision internally)
  459. Quality equivalences to the other complexity modes are very roughly as follows:
  460. MinimumPhase Low is somewhat better than Normal Medium.
  461. MinimumPhase Medium is similar to Normal Max.
  462. MinimumPhase High is similar to Mastering Low.
  463. In general, MinimumPhase performs better than Normal and Mastering for the equivalent qualities listed above.
  464. MinimumPhase High is several times faster than Mastering Low.
  465. }
  466. const
  467. kAudioConverterSampleRateConverterComplexity_Linear = FourCharCode('line'); // linear interpolation
  468. kAudioConverterSampleRateConverterComplexity_Normal = FourCharCode('norm'); // normal quality range, the default
  469. kAudioConverterSampleRateConverterComplexity_Mastering = FourCharCode('bats'); // higher quality range, more expensive
  470. kAudioConverterSampleRateConverterComplexity_MinimumPhase = FourCharCode('minp'); // minimum phase impulse response.
  471. {!
  472. @enum Prime method constants
  473. @abstract Constants to be used with kAudioConverterPrimeMethod.
  474. @constant kConverterPrimeMethod_Pre
  475. Primes with leading + trailing input frames.
  476. @constant kConverterPrimeMethod_Normal
  477. Only primes with trailing (zero latency). Leading frames are assumed to be
  478. silence.
  479. @constant kConverterPrimeMethod_None
  480. Acts in "latency" mode. Both leading and trailing frames assumed to be
  481. silence.
  482. }
  483. const
  484. kConverterPrimeMethod_Pre = 0;
  485. kConverterPrimeMethod_Normal = 1;
  486. kConverterPrimeMethod_None = 2;
  487. {!
  488. @struct AudioConverterPrimeInfo
  489. @abstract Specifies priming information.
  490. @field leadingFrames
  491. Specifies the number of leading (previous) input frames, relative to the normal/desired
  492. start input frame, required by the converter to perform a high quality conversion. If
  493. using kConverterPrimeMethod_Pre, the client should "pre-seek" the input stream provided
  494. through the input proc by leadingFrames. If no frames are available previous to the
  495. desired input start frame (because, for example, the desired start frame is at the very
  496. beginning of available audio), then provide "leadingFrames" worth of initial zero frames
  497. in the input proc. Do not "pre-seek" in the default case of
  498. kConverterPrimeMethod_Normal or when using kConverterPrimeMethod_None.
  499. @field trailingFrames
  500. Specifies the number of trailing input frames (past the normal/expected end input frame)
  501. required by the converter to perform a high quality conversion. The client should be
  502. prepared to provide this number of additional input frames except when using
  503. kConverterPrimeMethod_None. If no more frames of input are available in the input stream
  504. (because, for example, the desired end frame is at the end of an audio file), then zero
  505. (silent) trailing frames will be synthesized for the client.
  506. @discussion
  507. When using AudioConverterFillComplexBuffer() (either a single call or a series of calls), some
  508. conversions, particularly involving sample-rate conversion, ideally require a certain
  509. number of input frames previous to the normal start input frame and beyond the end of
  510. the last expected input frame in order to yield high-quality results.
  511. These are expressed in the leadingFrames and trailingFrames members of the structure.
  512. The very first call to AudioConverterFillComplexBuffer(), or first call after
  513. AudioConverterReset(), will request additional input frames beyond those normally
  514. expected in the input proc callback to fulfill this first AudioConverterFillComplexBuffer()
  515. request. The number of additional frames requested, depending on the prime method, will
  516. be approximately:
  517. <pre>
  518. kConverterPrimeMethod_Pre leadingFrames + trailingFrames
  519. kConverterPrimeMethod_Normal trailingFrames
  520. kConverterPrimeMethod_None 0
  521. </pre>
  522. Thus, in effect, the first input proc callback(s) may provide not only the leading
  523. frames, but also may "read ahead" by an additional number of trailing frames depending
  524. on the prime method.
  525. kConverterPrimeMethod_None is useful in a real-time application processing live input,
  526. in which case trailingFrames (relative to input sample rate) of through latency will be
  527. seen at the beginning of the output of the AudioConverter. In other real-time
  528. applications such as DAW systems, it may be possible to provide these initial extra
  529. audio frames since they are stored on disk or in memory somewhere and
  530. kConverterPrimeMethod_Pre may be preferable. The default method is
  531. kConverterPrimeMethod_Normal, which requires no pre-seeking of the input stream and
  532. generates no latency at the output.
  533. }
  534. type
  535. AudioConverterPrimeInfo = record
  536. leadingFrames: UInt32;
  537. trailingFrames: UInt32;
  538. end;
  539. AudioConverterPrimeInfoPtr = ^AudioConverterPrimeInfo;
  540. //=============================================================================
  541. // Errors
  542. //=============================================================================
  543. const
  544. kAudioConverterErr_FormatNotSupported = FourCharCode('fmt?');
  545. kAudioConverterErr_OperationNotSupported = $6F703F3F; // 'op??', integer used because of trigraph
  546. kAudioConverterErr_PropertyNotSupported = FourCharCode('prop');
  547. kAudioConverterErr_InvalidInputSize = FourCharCode('insz');
  548. kAudioConverterErr_InvalidOutputSize = FourCharCode('otsz');
  549. // e.g. byte size is not a multiple of the frame size
  550. kAudioConverterErr_UnspecifiedError = FourCharCode('what');
  551. kAudioConverterErr_BadPropertySizeError = FourCharCode('!siz');
  552. kAudioConverterErr_RequiresPacketDescriptionsError = FourCharCode('!pkd');
  553. kAudioConverterErr_InputSampleRateOutOfRange = FourCharCode('!isr');
  554. kAudioConverterErr_OutputSampleRateOutOfRange = FourCharCode('!osr');
  555. //=============================================================================
  556. // Routines
  557. //=============================================================================
  558. //-----------------------------------------------------------------------------
  559. {!
  560. @function AudioConverterNew
  561. @abstract Create a new AudioConverter.
  562. @param inSourceFormat
  563. The format of the source audio to be converted.
  564. @param inDestinationFormat
  565. The destination format to which the audio is to be converted.
  566. @param outAudioConverter
  567. On successful return, points to a new AudioConverter instance.
  568. @result An OSStatus result code.
  569. @discussion
  570. For a pair of linear PCM formats, the following conversions
  571. are supported:
  572. <ul>
  573. <li>addition and removal of channels, when the stream descriptions'
  574. mChannelsPerFrame does not match. Channels may also be reordered and removed
  575. using the kAudioConverterChannelMap property.</li>
  576. <li>sample rate conversion</li>
  577. <li>interleaving/deinterleaving, when the stream descriptions' (mFormatFlags &
  578. kAudioFormatFlagIsNonInterleaved) does not match.</li>
  579. <li>conversion between any pair of the following formats:</li>
  580. <ul>
  581. <li>8 bit integer, signed or unsigned</li>
  582. <li>16, 24, or 32-bit integer, big- or little-endian. Other integral
  583. bit depths, if high-aligned and non-packed, are also supported</li>
  584. <li>32 and 64-bit float, big- or little-endian.</li>
  585. </ul>
  586. </ul>
  587. Also, encoding and decoding between linear PCM and compressed formats is
  588. supported. Functions in AudioToolbox/AudioFormat.h return information about the
  589. supported formats. When using a codec, you can use any supported PCM format (as
  590. above); the converter will perform any necessary additional conversion between
  591. your PCM format and the one created or consumed by the codec.
  592. }
  593. function AudioConverterNew( const (*var*) inSourceFormat: AudioStreamBasicDescription; const (*var*) inDestinationFormat: AudioStreamBasicDescription; var outAudioConverter: AudioConverterRef {__nullable * __nonnull} ): OSStatus; external name '_AudioConverterNew';
  594. (* API_AVAILABLE(macos(10.1), ios(2.0), watchos(2.0), tvos(9.0)) *)
  595. //-----------------------------------------------------------------------------
  596. {!
  597. @function AudioConverterNewSpecific
  598. @abstract Create a new AudioConverter using specific codecs.
  599. @param inSourceFormat
  600. The format of the source audio to be converted.
  601. @param inDestinationFormat
  602. The destination format to which the audio is to be converted.
  603. @param inNumberClassDescriptions
  604. The number of class descriptions.
  605. @param inClassDescriptions
  606. AudioClassDescriptions specifiying the codec to instantiate.
  607. @param outAudioConverter
  608. On successful return, points to a new AudioConverter instance.
  609. @result An OSStatus result code.
  610. @discussion
  611. This function is identical to AudioConverterNew(), except that the client may
  612. explicitly choose which codec to instantiate if there is more than one choice.
  613. }
  614. function AudioConverterNewSpecific( const (*var*) inSourceFormat: AudioStreamBasicDescription; const (*var*) inDestinationFormat: AudioStreamBasicDescription; inNumberClassDescriptions: UInt32; const (*var*) inClassDescriptions: AudioClassDescription; var outAudioConverter: AudioConverterRef {__nullable * __nonnull} ): OSStatus; external name '_AudioConverterNewSpecific';
  615. (* API_AVAILABLE(macos(10.4), ios(2.0), watchos(2.0), tvos(9.0)) *)
  616. //-----------------------------------------------------------------------------
  617. {!
  618. @function AudioConverterDispose
  619. @abstract Destroy an AudioConverter.
  620. @param inAudioConverter
  621. The AudioConverter to dispose.
  622. @result An OSStatus result code.
  623. }
  624. function AudioConverterDispose( inAudioConverter: AudioConverterRef ): OSStatus; external name '_AudioConverterDispose';
  625. (* API_AVAILABLE(macos(10.1), ios(2.0), watchos(2.0), tvos(9.0)) *)
  626. //-----------------------------------------------------------------------------
  627. {!
  628. @function AudioConverterReset
  629. @abstract Reset an AudioConverter
  630. @param inAudioConverter
  631. The AudioConverter to reset.
  632. @result An OSStatus result code.
  633. @discussion
  634. Should be called whenever there is a discontinuity in the source audio stream
  635. being provided to the converter. This will flush any internal buffers in the
  636. converter.
  637. }
  638. function AudioConverterReset( inAudioConverter: AudioConverterRef ): OSStatus; external name '_AudioConverterReset';
  639. (* API_AVAILABLE(macos(10.1), ios(2.0), watchos(2.0), tvos(9.0)) *)
  640. //-----------------------------------------------------------------------------
  641. {!
  642. @function AudioConverterGetPropertyInfo
  643. @abstract Returns information about an AudioConverter property.
  644. @param inAudioConverter
  645. The AudioConverter to query.
  646. @param inPropertyID
  647. The property to query.
  648. @param outSize
  649. If non-null, on exit, the maximum size of the property value in bytes.
  650. @param outWritable
  651. If non-null, on exit, indicates whether the property value is writable.
  652. @result An OSStatus result code.
  653. }
  654. function AudioConverterGetPropertyInfo( inAudioConverter: AudioConverterRef; inPropertyID: AudioConverterPropertyID; outSize: UInt32Ptr {* __nullable}; outWritable: BooleanPtr {* __nullable} ): OSStatus; external name '_AudioConverterGetPropertyInfo';
  655. (* API_AVAILABLE(macos(10.1), ios(2.0), watchos(2.0), tvos(9.0)) *)
  656. //-----------------------------------------------------------------------------
  657. {!
  658. @function AudioConverterGetProperty
  659. @abstract Returns an AudioConverter property value.
  660. @param inAudioConverter
  661. The AudioConverter to query.
  662. @param inPropertyID
  663. The property to fetch.
  664. @param ioPropertyDataSize
  665. On entry, the size of the memory pointed to by outPropertyData. On
  666. successful exit, the size of the property value.
  667. @param outPropertyData
  668. On exit, the property value.
  669. @result An OSStatus result code.
  670. }
  671. function AudioConverterGetProperty( inAudioConverter: AudioConverterRef; inPropertyID: AudioConverterPropertyID; var ioPropertyDataSize: UInt32; outPropertyData: UnivPtr ): OSStatus; external name '_AudioConverterGetProperty';
  672. (* API_AVAILABLE(macos(10.1), ios(2.0), watchos(2.0), tvos(9.0)) *)
  673. //-----------------------------------------------------------------------------
  674. {!
  675. @function AudioConverterSetProperty
  676. @abstract Sets an AudioConverter property value.
  677. @param inAudioConverter
  678. The AudioConverter to modify.
  679. @param inPropertyID
  680. The property to set.
  681. @param inPropertyDataSize
  682. The size in bytes of the property value.
  683. @param inPropertyData
  684. Points to the new property value.
  685. @result An OSStatus result code.
  686. }
  687. function AudioConverterSetProperty( inAudioConverter: AudioConverterRef; inPropertyID: AudioConverterPropertyID; inPropertyDataSize: UInt32; inPropertyData: {const} UnivPtr ): OSStatus; external name '_AudioConverterSetProperty';
  688. (* API_AVAILABLE(macos(10.1), ios(2.0), watchos(2.0), tvos(9.0)) *)
  689. //-----------------------------------------------------------------------------
  690. {!
  691. @typedef AudioConverterInputDataProc
  692. @abstract Callback function for supplying input data to AudioConverterFillBuffer.
  693. @param inAudioConverter
  694. The AudioConverter requesting input.
  695. @param ioDataSize
  696. On entry, the minimum number of bytes of audio data the converter
  697. would like in order to fulfill its current FillBuffer request.
  698. On exit, the number of bytes of audio data actually being provided
  699. for input, or 0 if there is no more input.
  700. @param outData
  701. On exit, *outData should point to the audio data being provided
  702. for input.
  703. @param inUserData
  704. The inInputDataProcUserData parameter passed to AudioConverterFillBuffer().
  705. @result An OSStatus result code.
  706. @discussion
  707. <b>NOTE:</b> This API is now deprecated,
  708. use AudioConverterFillComplexBuffer instead.
  709. This callback function supplies input to AudioConverterFillBuffer.
  710. The AudioConverter requests a minimum amount of data (*ioDataSize). The callback
  711. may return any amount of data. If it is less than than the minimum, the callback
  712. will simply be called again in the near future.
  713. The callback supplies a pointer to a buffer of audio data. The callback is
  714. responsible for not freeing or altering this buffer until it is called again.
  715. If the callback returns an error, it must return zero bytes of data.
  716. AudioConverterFillBuffer will stop producing output and return whatever output
  717. has already been produced to its caller, along with the error code. This
  718. mechanism can be used when an input proc has temporarily run out of data, but
  719. has not yet reached end of stream.
  720. }
  721. type
  722. AudioConverterInputDataProc = function( inAudioConverter: AudioConverterRef; var ioDataSize: UInt32; var outData: UnivPtr {__nonnull * __nonnull}; inUserData: UnivPtr {__nullable} ): OSStatus;
  723. //-----------------------------------------------------------------------------
  724. (*
  725. {!
  726. @function AudioConverterFillBuffer
  727. @abstract Converts data supplied by an input callback function.
  728. @param inAudioConverter
  729. The AudioConverter to use.
  730. @param inInputDataProc
  731. A callback function which supplies the input data.
  732. @param inInputDataProcUserData
  733. A value for the use of the callback function.
  734. @param ioOutputDataSize
  735. On entry, the size of the buffer pointed to by outOutputData.
  736. On exit, the number of bytes written to outOutputData
  737. @param outOutputData
  738. The buffer into which the converted data is written.
  739. @result An OSStatus result code.
  740. @discussion
  741. <b>NOTE:</b> This API is now deprecated,
  742. use AudioConverterFillComplexBuffer instead.
  743. Produces a buffer of output data from an AudioConverter. The supplied input
  744. callback function is called whenever necessary.
  745. }
  746. extern OSStatus
  747. AudioConverterFillBuffer( AudioConverterRef inAudioConverter,
  748. AudioConverterInputDataProc inInputDataProc,
  749. void * __nullable inInputDataProcUserData,
  750. UInt32 * ioOutputDataSize,
  751. void * outOutputData)
  752. API_DEPRECATED("no longer supported", macos(10.1, 10.5)) API_UNAVAILABLE(ios, watchos, tvos);
  753. *)
  754. //-----------------------------------------------------------------------------
  755. {!
  756. @function AudioConverterConvertBuffer
  757. @abstract Converts data from an input buffer to an output buffer.
  758. @param inAudioConverter
  759. The AudioConverter to use.
  760. @param inInputDataSize
  761. The size of the buffer inInputData.
  762. @param inInputData
  763. The input audio data buffer.
  764. @param ioOutputDataSize
  765. On entry, the size of the buffer outOutputData. On exit, the number of bytes
  766. written to outOutputData.
  767. @param outOutputData
  768. The output data buffer.
  769. @result
  770. Produces a buffer of output data from an AudioConverter, using the supplied
  771. input buffer.
  772. @discussion
  773. <b>WARNING:</b> this function will fail for any conversion where there is a
  774. variable relationship between the input and output data buffer sizes. This
  775. includes sample rate conversions and most compressed formats. In these cases,
  776. use AudioConverterFillComplexBuffer. Generally this function is only appropriate for
  777. PCM-to-PCM conversions where there is no sample rate conversion.
  778. }
  779. function AudioConverterConvertBuffer( inAudioConverter: AudioConverterRef; inInputDataSize: UInt32; inInputData: {const} UnivPtr; var ioOutputDataSize: UInt32; outOutputData: UnivPtr ): OSStatus; external name '_AudioConverterConvertBuffer';
  780. (* API_AVAILABLE(macos(10.1), ios(2.0), watchos(2.0), tvos(9.0)) *)
  781. //-----------------------------------------------------------------------------
  782. {!
  783. @typedef AudioConverterComplexInputDataProc
  784. @abstract Callback function for supplying input data to AudioConverterFillComplexBuffer.
  785. @param inAudioConverter
  786. The AudioConverter requesting input.
  787. @param ioNumberDataPackets
  788. On entry, the minimum number of packets of input audio data the converter
  789. would like in order to fulfill its current FillBuffer request. On exit, the
  790. number of packets of audio data actually being provided for input, or 0 if
  791. there is no more input.
  792. @param ioData
  793. On exit, the members of ioData should be set to point to the audio data
  794. being provided for input.
  795. @param outDataPacketDescription
  796. If non-null, on exit, the callback is expected to fill this in with
  797. an AudioStreamPacketDescription for each packet of input data being provided.
  798. @param inUserData
  799. The inInputDataProcUserData parameter passed to AudioConverterFillComplexBuffer().
  800. @result An OSStatus result code.
  801. @discussion
  802. This callback function supplies input to AudioConverterFillComplexBuffer.
  803. The AudioConverter requests a minimum number of packets (*ioNumberDataPackets).
  804. The callback may return one or more packets. If this is less than the minimum,
  805. the callback will simply be called again in the near future.
  806. The callback manipulates the members of ioData to point to one or more buffers
  807. of audio data (multiple buffers are used with non-interleaved PCM data). The
  808. callback is responsible for not freeing or altering this buffer until it is
  809. called again.
  810. If the callback returns an error, it must return zero packets of data.
  811. AudioConverterFillComplexBuffer will stop producing output and return whatever
  812. output has already been produced to its caller, along with the error code. This
  813. mechanism can be used when an input proc has temporarily run out of data, but
  814. has not yet reached end of stream.
  815. }
  816. type
  817. AudioConverterComplexInputDataProc = function( inAudioConverter: AudioConverterRef; var ioNumberDataPackets: UInt32; var ioData: AudioBufferList; outDataPacketDescription: AudioStreamPacketDescriptionPtrPtr {* __nullable * __nullable}; inUserData: UnivPtr {__nullable} ): OSStatus;
  818. //-----------------------------------------------------------------------------
  819. {!
  820. @function AudioConverterFillComplexBuffer
  821. @abstract Converts data supplied by an input callback function, supporting non-interleaved
  822. and packetized formats.
  823. @param inAudioConverter
  824. The AudioConverter to use.
  825. @param inInputDataProc
  826. A callback function which supplies the input data.
  827. @param inInputDataProcUserData
  828. A value for the use of the callback function.
  829. @param ioOutputDataPacketSize
  830. On entry, the capacity of outOutputData expressed in packets in the
  831. converter's output format. On exit, the number of packets of converted
  832. data that were written to outOutputData.
  833. @param outOutputData
  834. The converted output data is written to this buffer.
  835. @param outPacketDescription
  836. If non-null, and the converter's output uses packet descriptions, then
  837. packet descriptions are written to this array. It must point to a memory
  838. block capable of holding *ioOutputDataPacketSize packet descriptions.
  839. (See AudioFormat.h for ways to determine whether an audio format
  840. uses packet descriptions).
  841. @result An OSStatus result code.
  842. @discussion
  843. Produces a buffer list of output data from an AudioConverter. The supplied input
  844. callback function is called whenever necessary.
  845. }
  846. function AudioConverterFillComplexBuffer( inAudioConverter: AudioConverterRef; inInputDataProc: AudioConverterComplexInputDataProc; inInputDataProcUserData: UnivPtr {__nullable}; var ioOutputDataPacketSize: UInt32; var outOutputData: AudioBufferList; outPacketDescription: AudioStreamPacketDescriptionPtr {* __nullable} ): OSStatus; external name '_AudioConverterFillComplexBuffer';
  847. (* API_AVAILABLE(macos(10.2), ios(2.0), watchos(2.0), tvos(9.0)) *)
  848. //-----------------------------------------------------------------------------
  849. {!
  850. @function AudioConverterConvertComplexBuffer
  851. @abstract Converts PCM data from an input buffer list to an output buffer list.
  852. @param inAudioConverter
  853. The AudioConverter to use.
  854. @param inNumberPCMFrames
  855. The number of PCM frames to convert.
  856. @param inInputData
  857. The source audio buffer list.
  858. @param outOutputData
  859. The converted output data is written to this buffer list.
  860. @result An OSStatus result code.
  861. @discussion
  862. <b>WARNING:</b> this function will fail for any conversion where there is a
  863. variable relationship between the input and output data buffer sizes. This
  864. includes sample rate conversions and most compressed formats. In these cases,
  865. use AudioConverterFillComplexBuffer. Generally this function is only appropriate for
  866. PCM-to-PCM conversions where there is no sample rate conversion.
  867. }
  868. function AudioConverterConvertComplexBuffer( inAudioConverter: AudioConverterRef; inNumberPCMFrames: UInt32; const (*var*) inInputData: AudioBufferList; var outOutputData: AudioBufferList ): OSStatus; external name '_AudioConverterConvertComplexBuffer';
  869. (* API_AVAILABLE(macos(10.7), ios(5.0), watchos(2.0), tvos(9.0)) *)
  870. //CF_ASSUME_NONNULL_END
  871. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  872. end.
  873. {$endc} {not MACOSALLINCLUDE}