AUComponent.pas 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716
  1. {
  2. File: AUComponent.h
  3. Contains: AudioUnit Interfaces
  4. Copyright: © 2002-2008 by Apple, Inc., all rights reserved.
  5. Bugs?: For bug reports, consult the following page on
  6. the World Wide Web:
  7. http://bugs.freepascal.org
  8. }
  9. { Pascal Translation: Gorazd Krosl <[email protected]>, October 2009 }
  10. { Pascal Translation Update: Jonas Maebe <[email protected]>, October 2012 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 308
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  17. {$mode macpas}
  18. {$packenum 1}
  19. {$macro on}
  20. {$inline on}
  21. {$calling mwpascal}
  22. unit AUComponent;
  23. interface
  24. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  25. {$setc GAP_INTERFACES_VERSION := $0308}
  26. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  27. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  28. {$endc}
  29. {$ifc defined CPUPOWERPC and defined CPUI386}
  30. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  31. {$endc}
  32. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  33. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  34. {$endc}
  35. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  36. {$setc __ppc__ := 1}
  37. {$elsec}
  38. {$setc __ppc__ := 0}
  39. {$endc}
  40. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  41. {$setc __ppc64__ := 1}
  42. {$elsec}
  43. {$setc __ppc64__ := 0}
  44. {$endc}
  45. {$ifc not defined __i386__ and defined CPUI386}
  46. {$setc __i386__ := 1}
  47. {$elsec}
  48. {$setc __i386__ := 0}
  49. {$endc}
  50. {$ifc not defined __x86_64__ and defined CPUX86_64}
  51. {$setc __x86_64__ := 1}
  52. {$elsec}
  53. {$setc __x86_64__ := 0}
  54. {$endc}
  55. {$ifc not defined __arm__ and defined CPUARM}
  56. {$setc __arm__ := 1}
  57. {$elsec}
  58. {$setc __arm__ := 0}
  59. {$endc}
  60. {$ifc not defined __arm64__ and defined CPUAARCH64}
  61. {$setc __arm64__ := 1}
  62. {$elsec}
  63. {$setc __arm64__ := 0}
  64. {$endc}
  65. {$ifc defined cpu64}
  66. {$setc __LP64__ := 1}
  67. {$elsec}
  68. {$setc __LP64__ := 0}
  69. {$endc}
  70. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  71. {$error Conflicting definitions for __ppc__ and __i386__}
  72. {$endc}
  73. {$ifc defined __ppc__ and __ppc__}
  74. {$setc TARGET_CPU_PPC := TRUE}
  75. {$setc TARGET_CPU_PPC64 := FALSE}
  76. {$setc TARGET_CPU_X86 := FALSE}
  77. {$setc TARGET_CPU_X86_64 := FALSE}
  78. {$setc TARGET_CPU_ARM := FALSE}
  79. {$setc TARGET_CPU_ARM64 := FALSE}
  80. {$setc TARGET_OS_MAC := TRUE}
  81. {$setc TARGET_OS_IPHONE := FALSE}
  82. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  83. {$setc TARGET_OS_EMBEDDED := FALSE}
  84. {$elifc defined __ppc64__ and __ppc64__}
  85. {$setc TARGET_CPU_PPC := FALSE}
  86. {$setc TARGET_CPU_PPC64 := TRUE}
  87. {$setc TARGET_CPU_X86 := FALSE}
  88. {$setc TARGET_CPU_X86_64 := FALSE}
  89. {$setc TARGET_CPU_ARM := FALSE}
  90. {$setc TARGET_CPU_ARM64 := FALSE}
  91. {$setc TARGET_OS_MAC := TRUE}
  92. {$setc TARGET_OS_IPHONE := FALSE}
  93. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  94. {$setc TARGET_OS_EMBEDDED := FALSE}
  95. {$elifc defined __i386__ and __i386__}
  96. {$setc TARGET_CPU_PPC := FALSE}
  97. {$setc TARGET_CPU_PPC64 := FALSE}
  98. {$setc TARGET_CPU_X86 := TRUE}
  99. {$setc TARGET_CPU_X86_64 := FALSE}
  100. {$setc TARGET_CPU_ARM := FALSE}
  101. {$setc TARGET_CPU_ARM64 := FALSE}
  102. {$ifc defined(iphonesim)}
  103. {$setc TARGET_OS_MAC := FALSE}
  104. {$setc TARGET_OS_IPHONE := TRUE}
  105. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  106. {$elsec}
  107. {$setc TARGET_OS_MAC := TRUE}
  108. {$setc TARGET_OS_IPHONE := FALSE}
  109. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  110. {$endc}
  111. {$setc TARGET_OS_EMBEDDED := FALSE}
  112. {$elifc defined __x86_64__ and __x86_64__}
  113. {$setc TARGET_CPU_PPC := FALSE}
  114. {$setc TARGET_CPU_PPC64 := FALSE}
  115. {$setc TARGET_CPU_X86 := FALSE}
  116. {$setc TARGET_CPU_X86_64 := TRUE}
  117. {$setc TARGET_CPU_ARM := FALSE}
  118. {$setc TARGET_CPU_ARM64 := FALSE}
  119. {$ifc defined(iphonesim)}
  120. {$setc TARGET_OS_MAC := FALSE}
  121. {$setc TARGET_OS_IPHONE := TRUE}
  122. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  123. {$elsec}
  124. {$setc TARGET_OS_MAC := TRUE}
  125. {$setc TARGET_OS_IPHONE := FALSE}
  126. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  127. {$endc}
  128. {$setc TARGET_OS_EMBEDDED := FALSE}
  129. {$elifc defined __arm__ and __arm__}
  130. {$setc TARGET_CPU_PPC := FALSE}
  131. {$setc TARGET_CPU_PPC64 := FALSE}
  132. {$setc TARGET_CPU_X86 := FALSE}
  133. {$setc TARGET_CPU_X86_64 := FALSE}
  134. {$setc TARGET_CPU_ARM := TRUE}
  135. {$setc TARGET_CPU_ARM64 := FALSE}
  136. { will require compiler define when/if other Apple devices with ARM cpus ship }
  137. {$setc TARGET_OS_MAC := FALSE}
  138. {$setc TARGET_OS_IPHONE := TRUE}
  139. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  140. {$setc TARGET_OS_EMBEDDED := TRUE}
  141. {$elifc defined __arm64__ and __arm64__}
  142. {$setc TARGET_CPU_PPC := FALSE}
  143. {$setc TARGET_CPU_PPC64 := FALSE}
  144. {$setc TARGET_CPU_X86 := FALSE}
  145. {$setc TARGET_CPU_X86_64 := FALSE}
  146. {$setc TARGET_CPU_ARM := FALSE}
  147. {$setc TARGET_CPU_ARM64 := TRUE}
  148. { will require compiler define when/if other Apple devices with ARM cpus ship }
  149. {$setc TARGET_OS_MAC := FALSE}
  150. {$setc TARGET_OS_IPHONE := TRUE}
  151. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  152. {$setc TARGET_OS_EMBEDDED := TRUE}
  153. {$elsec}
  154. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  155. {$endc}
  156. {$ifc defined __LP64__ and __LP64__ }
  157. {$setc TARGET_CPU_64 := TRUE}
  158. {$elsec}
  159. {$setc TARGET_CPU_64 := FALSE}
  160. {$endc}
  161. {$ifc defined FPC_BIG_ENDIAN}
  162. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  163. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  164. {$elifc defined FPC_LITTLE_ENDIAN}
  165. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  166. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  167. {$elsec}
  168. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  169. {$endc}
  170. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  171. {$setc CALL_NOT_IN_CARBON := FALSE}
  172. {$setc OLDROUTINENAMES := FALSE}
  173. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  174. {$setc OPAQUE_UPP_TYPES := TRUE}
  175. {$setc OTCARBONAPPLICATION := TRUE}
  176. {$setc OTKERNEL := FALSE}
  177. {$setc PM_USE_SESSION_APIS := TRUE}
  178. {$setc TARGET_API_MAC_CARBON := TRUE}
  179. {$setc TARGET_API_MAC_OS8 := FALSE}
  180. {$setc TARGET_API_MAC_OSX := TRUE}
  181. {$setc TARGET_CARBON := TRUE}
  182. {$setc TARGET_CPU_68K := FALSE}
  183. {$setc TARGET_CPU_MIPS := FALSE}
  184. {$setc TARGET_CPU_SPARC := FALSE}
  185. {$setc TARGET_OS_UNIX := FALSE}
  186. {$setc TARGET_OS_WIN32 := FALSE}
  187. {$setc TARGET_RT_MAC_68881 := FALSE}
  188. {$setc TARGET_RT_MAC_CFM := FALSE}
  189. {$setc TARGET_RT_MAC_MACHO := TRUE}
  190. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  191. {$setc TYPE_BOOL := FALSE}
  192. {$setc TYPE_EXTENDED := FALSE}
  193. {$setc TYPE_LONGLONG := TRUE}
  194. uses MacTypes,AudioComponents,CoreAudioTypes;
  195. {$endc} {not MACOSALLINCLUDE}
  196. {$ALIGN POWER}
  197. //=====================================================================================================================
  198. //#pragma mark Overview
  199. {!
  200. @header AUComponent
  201. @discussion
  202. This file defines the collection of API calls for an audio unit. An audio unit is a plugin
  203. that can be loaded into an application's process and used to process or generate audio. An
  204. audio unit is an AudioComponent type and so
  205. the AudioComponent APIs are used to find specific types of audio units, open and close them.
  206. Audio units use a general notion of description to specify an unique instance. The Type is the
  207. general category of an audio unit. The SubType is an unique identifier specified by the
  208. Manufacturer (provider) of the audio unit. The IDs that are used for Type are specified by
  209. Apple, the Manufacturer ID should be specified by an unique identifier
  210. (as registered with apple). See AudioComponentDescription.
  211. Audio unit types are of the following (see below for more information)
  212. kAudioUnitType_Output = 'auou',
  213. kAudioUnitType_MusicDevice = 'aumu',
  214. kAudioUnitType_MusicEffect = 'aumf',
  215. kAudioUnitType_FormatConverter = 'aufc',
  216. kAudioUnitType_Effect = 'aufx',
  217. kAudioUnitType_Mixer = 'aumx',
  218. kAudioUnitType_Panner = 'aupn',
  219. kAudioUnitType_OfflineEffect = 'auol',
  220. kAudioUnitType_Generator = 'augn',
  221. An audio unit's general operations are:
  222. Open an audio unit (AudioComponentInstanceNew)
  223. Configure it based on the context - AudioUnitSetProperty
  224. Initialise the audio unit (AudioUnitInitialize)
  225. - at this point the audio unit is in a state where it can render audio
  226. Render audio (AudioUnitRender)
  227. An important part of a render operation for an audio unit is to manipulate the various controls
  228. that the unit provides to change the render effects; for instance to change the decay time of
  229. a reverb, the cut off frequency of a filter, etc. These are called parameters, and
  230. AudioUnitGetParameter and AudioUnitSetParameter are used to interact with these.
  231. If any reconfiguration of the audio unit is required, then:
  232. uninitialise (AudioUnitUninitialise)
  233. Configure it based on the context - AudioUnitSetProperty
  234. Initialise the audio unit (AudioUnitInitialize)
  235. Once the host is finished with an audio unit, it closes it:
  236. Dispose audio unit (AudioComponentInstanceDispose)
  237. Audio units can be used programmatically (for instance a mixers could be used to render audio
  238. for a game, a generator to play audio files, etc), or they can be hosted in Digital
  239. Audio Workstation (DAW) applications such as Logic, Garage Band. In the DAW case, it is common
  240. for an audio unit to provide a custom view to allow the user to interact with what can be
  241. complex DSP operations that the audio unit performs. The view is retrieved from an audio unit
  242. through AudioUnitGetProperty and then the host instantiates it
  243. (see <AudioUnit/AUCocoaUIView.h>)
  244. }
  245. //#if !__LP64__
  246. // #if PRAGMA_STRUCT_ALIGN
  247. // #pragma options align=mac68k
  248. // #elif PRAGMA_STRUCT_PACKPUSH
  249. // #pragma pack(push, 2)
  250. // #elif PRAGMA_STRUCT_PACK
  251. // #pragma pack(2)
  252. // #endif
  253. //#endif
  254. {$ifc not TARGET_CPU_64}
  255. {$ALIGN MAC68K}
  256. {$endc}
  257. //=====================================================================================================================
  258. //#pragma mark -
  259. //#pragma mark Audio Unit Types
  260. {!
  261. @typedef AudioUnit
  262. @discussion An audio unit is of type AudioComponentInstance as defined in
  263. AudioComponent.h
  264. }
  265. type
  266. AudioUnit = AudioComponentInstance;
  267. {!
  268. @enum Audio Unit Types
  269. @abstract different types of audio units
  270. @discussion Audio unit's are classified into different types, where those types perform
  271. different roles and functions.
  272. There are some general categories of functionality that apply across different
  273. types of audio units:
  274. (1) Real-time usage
  275. The audio unit will complete its operations in less time that is
  276. represented by the render buffer. All audio units with the exception of
  277. the OfflineEffect should meet this criteria
  278. (2) Real-time I/O
  279. Will request the same amount of audio input as it is being asked to
  280. produce for output. Effects, Panners, Mixers and MusicDevices are required
  281. to adhere to this restriction. FormatConverter's can with some constraints
  282. be used in this situation (for instance, sample rate conversion, float-int),
  283. but the host of the audio unit is responsible for insuring this.
  284. (3) UI versus Programmatic usage
  285. UI usage covers the case of using an audio unit in a Digital Audio
  286. Workstation (DAW) with appropriate UI (for example a filter in Garage Band
  287. or Logic). Effects, Panners, MusicDevices are all expected to be usable
  288. within this context.
  289. Programmatic usage is where an audio unit is used by a host app as part of
  290. a general signal processing chain.
  291. For instance, a mixer audio unit can be used to take several different
  292. audio sources in a game and mix them together. Mixers, Output units are
  293. for programmatic usage. FormatConverter and Generator types are generally
  294. programmatic audio units, but if they can be used in a UI situation, they
  295. specify a custom view. The app can then use that to decide that, with
  296. appropriate constraints, the audio unit could be presented in a DAW type
  297. application. For instance, the AUConverter audio unit from apple can do
  298. sample rate conversion, etc, but has not general utility for a user in a
  299. DAW app. Apple's Varispeed or AUTimePitch audio units can be used to change
  300. the playback rate and pitch and so could be used to good affect by a user
  301. in a DAW type environment, as well as just providing this general
  302. functionality to any program.
  303. @constant kAudioUnitType_Output
  304. An output unit can be used as the head of an AUGraph. Apple provides a number
  305. of output units that interface directly with an audio device
  306. @constant kAudioUnitType_MusicDevice
  307. Used to describe software musical instruments such as samplers and
  308. synthesisers. They respond to MIDI and create notes, which are then controlled
  309. through parameters or MIDI control messages. See <AudioUnit/MusicDevice.h>
  310. @constant kAudioUnitType_MusicEffect
  311. Is an effect that is also able to respond directly to MIDI control messages,
  312. typically through the mapping of these MIDI messages to different parameters
  313. of the effect's DSP algorithm.
  314. @constant kAudioUnitType_FormatConverter
  315. A format converter is a general category for audio units that can change the
  316. format (for instance, sample rate conversion) from an input to an output, as
  317. well as other, non-I/O type manipulations (like a deferred render or varispeed
  318. type of operation). As such, a format converter can ask for as much or as
  319. little audio input to produce a given output. They are still expected to
  320. complete their rendering within the time represented by the output buffer.
  321. For format converters that have some utility as an "audio effect or processor",
  322. it is quite common to provide an offline version of this audio unit as well.
  323. For instance, Apple ships a format converter (for use in a "real-time" like
  324. situation) and an offline version (for processing audio files) of the Time
  325. Pitch and Varispeed audio units.
  326. @constant kAudioUnitType_Effect
  327. An audio unit that will process some x number of audio input samples to produce
  328. x number of audio output samples. The common case for an effect is to have a
  329. single input to a single output, though some effects take side-chain inputs as
  330. well. Effects can be run in "offline" contexts (such as processing a file), but
  331. they are expected to run in real-time. A delay unit or reverb is a good
  332. example of this.
  333. @constant kAudioUnitType_Mixer
  334. An audio unit that takes some number of inputs, mixing them to provide 1 or
  335. more audio outputs. A stere mixer (mono and stereo inputs to produce one
  336. stereo output) is an example of this.
  337. @constant kAudioUnitType_Panner
  338. A panner is a specialised effect that will pan a single audio input to a single
  339. output. Panner units are required to support a collection of standardised
  340. parameters that specify the panning coordinates (aside from whatever custom
  341. parameters the panner may provide). A surround panner is an example of this
  342. @constant kAudioUnitType_Generator
  343. A generator will have no audio input, but will just produce audio output. In
  344. some ways it is similar to a MusicDevice, except that a generator provides no
  345. MIDI input, or notion of "notes". A tone generator is a good example of this.
  346. @constant kAudioUnitType_OfflineEffect
  347. An offline effect is used to process data from a file and is also used to
  348. publish a capability that cannot be run in real-time. For instance, the process
  349. of normalisation requires seeing the entire audio input before the scalar to
  350. apply in the normalisation process can be estimated. As such, offline effects
  351. also have a notion of a priming stage that can be performed before the actual
  352. rendering/processing phase is executed.
  353. }
  354. const
  355. kAudioUnitType_Output = FourCharCode('auou');
  356. kAudioUnitType_MusicDevice = FourCharCode('aumu');
  357. kAudioUnitType_MusicEffect = FourCharCode('aumf');
  358. kAudioUnitType_FormatConverter = FourCharCode('aufc');
  359. kAudioUnitType_Effect = FourCharCode('aufx');
  360. kAudioUnitType_Mixer = FourCharCode('aumx');
  361. kAudioUnitType_Panner = FourCharCode('aupn');
  362. kAudioUnitType_Generator = FourCharCode('augn');
  363. kAudioUnitType_OfflineEffect = FourCharCode('auol');
  364. //=====================================================================================================================
  365. //#pragma mark -
  366. //#pragma mark Apple Audio Units
  367. {!
  368. @enum Apple audio unit manufacturer ID.
  369. @discussion the unique ID used to identifier audio units provided by Apple, Inc.
  370. }
  371. const
  372. kAudioUnitManufacturer_Apple = FourCharCode('appl');
  373. {!
  374. @enum Apple output audio unit sub types
  375. @discussion These are the subtypes for the various output units that apple ships. Output
  376. units add an additional notion of Start and Stop
  377. see <AudioUnit/AudioOutputUnit.h>
  378. @constant kAudioUnitSubType_GenericOutput
  379. A generic output unit provides the start/stop API, and provides the basic
  380. services to convert Linear PCM formats.
  381. @constant kAudioUnitSubType_HALOutput
  382. - desktop only
  383. The audio unit that interfaces to any audio device. The user specifies which
  384. audio device to track. The audio unit can do input from the device as well as
  385. output to the device. Bus 0 is used for the output side, bus 1 is used
  386. to get audio input from the device.
  387. @constant kAudioUnitSubType_DefaultOutput
  388. - desktop only
  389. A specialisation of AUHAL that is used to track the user's selection of the
  390. default device as set in the Sound Prefs
  391. @constant kAudioUnitSubType_SystemOutput
  392. - desktop only
  393. A specialisation of AUHAL that is used to track the user's selection of the
  394. device to use for sound effects, alerts
  395. and other UI sounds.
  396. @constant kAudioUnitSubType_RemoteIO
  397. - iPhone only
  398. The audio unit that interfaces to the audio I/O pathways of the iPhone. The
  399. audio unit can do input as well as output. Bus 0 is used for the output side,
  400. bus 1 is used to get audio input.
  401. @constant kAudioUnitSubType_VoiceProcessingIO
  402. - Available on the desktop and with iPhone 3.0 or greater
  403. This audio unit can do input as well as output. Bus 0 is used for the output
  404. side, bus 1 is used to get audio input (thus, on the iPhone, it works in a
  405. very similar way to the Remote I/O). This audio unit does signal processing on
  406. the incoming audio (taking out any of the audio that is played from the device
  407. at a given time from the incoming audio).
  408. }
  409. const
  410. kAudioUnitSubType_GenericOutput = FourCharCode('genr');
  411. //#if !TARGET_OS_IPHONE
  412. {$ifc not TARGET_OS_IPHONE}
  413. kAudioUnitSubType_HALOutput = FourCharCode('ahal');
  414. kAudioUnitSubType_DefaultOutput = FourCharCode('def ');
  415. kAudioUnitSubType_SystemOutput = 'sys ';
  416. //#else
  417. {$elsec} { not TARGET_OS_IPHONE }
  418. kAudioUnitSubType_RemoteIO = 'rioc';
  419. //#endif;
  420. {$endc} { not TARGET_OS_IPHONE }
  421. kAudioUnitSubType_VoiceProcessingIO = FourCharCode('vpio');
  422. {!
  423. @enum Apple music instrument audio unit sub types
  424. @constant kAudioUnitSubType_DLSSynth
  425. - desktop only
  426. A multi-timbral music device that can use sample banks in either DLS or
  427. SoundFont formats. It fully supports GM-MIDI and the basic extensions of
  428. GS-MIDI
  429. @constant kAudioUnitSubType_Sampler
  430. A mono-timbral music device which is a sampler synthesizer and supports full
  431. interactive editing of all state.
  432. }
  433. //#if !TARGET_OS_IPHONE
  434. {$ifc not TARGET_OS_IPHONE}
  435. const
  436. kAudioUnitSubType_DLSSynth = FourCharCode('dls ');
  437. //#endif
  438. {$endc} { not TARGET_OS_IPHONE }
  439. kAudioUnitSubType_Sampler = FourCharCode('samp');
  440. {!
  441. @enum Apple converter audio unit sub types
  442. @discussion These are the subtypes for the various converter units that apple ships.
  443. Except for AUConverter, which is available on both desktop and iPhone, these
  444. audio units are only available on the desktop.
  445. @constant kAudioUnitSubType_AUConverter
  446. An audio unit that uses an AudioConverter to do Linear PCM conversions (sample
  447. rate, bit depth, interleaving).
  448. @constant kAudioUnitSubType_TimePitch
  449. - desktop only
  450. An audio unit that can be used to have independent control of both playback
  451. rate and pitch. It provides a generic view, so can be used in both a UI and
  452. programmatic context. It also comes in an Offline version so can be used to
  453. process audio files.
  454. @constant kAudioUnitSubType_Varispeed
  455. An audio unit that can be used to control playback rate (as the rate is faster,
  456. the pitch is higher). It provides a generic view, so can be used in both a UI
  457. and programmatic context. It also comes in an Offline version so can be used
  458. to process audio files.
  459. @constant kAudioUnitSubType_DeferredRenderer
  460. - desktop only
  461. An audio unit that is used to get its input from a separate thread than the
  462. thread that its render method is called. It thus allows an application to
  463. introduce multiple threads into a rendering graph. There is a buffer sized
  464. delay introduced between the input and output
  465. @constant kAudioUnitSubType_Splitter
  466. - desktop only
  467. An audio unit that provides 2 output buses and 1 input bus. The audio unit
  468. splits (duplicates) the input signal to the two output buses
  469. @constant kAudioUnitSubType_Merger
  470. - desktop only
  471. An audio unit that provides 2 input buses and 2 output bus. The audio unit
  472. merges the two inputs to the single output
  473. @constant kAudioUnitSubType_NewTimePitch
  474. An audio unit that provides good quality time stretching and pitch shifting
  475. while still being very fast.
  476. @constant kAudioUnitSubType_AUiPodTime
  477. - iPhone only
  478. An audio unit that provides simple (and limited) control over playback rate
  479. and time.
  480. }
  481. const
  482. kAudioUnitSubType_AUConverter = FourCharCode('conv');
  483. //#if !TARGET_OS_IPHONE
  484. {$ifc not TARGET_OS_IPHONE}
  485. kAudioUnitSubType_NewTimePitch = FourCharCode('nutp');
  486. kAudioUnitSubType_TimePitch = FourCharCode('tmpt');
  487. kAudioUnitSubType_DeferredRenderer = FourCharCode('defr');
  488. kAudioUnitSubType_Splitter = FourCharCode('splt');
  489. kAudioUnitSubType_Merger = FourCharCode('merg');
  490. kAudioUnitSubType_Varispeed = FourCharCode('vari');
  491. kAudioUnitSubType_RoundTripAAC = 'raac';
  492. //#else
  493. {$elsec} { not TARGET_OS_IPHONE }
  494. kAudioUnitSubType_AUiPodTime = 'iptm';
  495. kAudioUnitSubType_AUiPodTimeOther = 'ipto';
  496. //#endif;
  497. {$endc} { not TARGET_OS_IPHONE }
  498. {!
  499. @enum Apple effect audio unit sub types
  500. @discussion These are the subtypes for the various effect units that apple ships
  501. @constant kAudioUnitSubType_Delay
  502. - desktop only
  503. A delay audio unit
  504. @constant kAudioUnitSubType_LowPassFilter
  505. A filter that passes frequencies below a specified cut-off frequency
  506. @constant kAudioUnitSubType_HighPassFilter
  507. A filter that passes frequencies above a specified cut-off frequency
  508. @constant kAudioUnitSubType_BandPassFilter
  509. A filter that passes frequencies between a low and high cut-off frequency.
  510. @constant kAudioUnitSubType_HighShelfFilter
  511. A filter that can be used to implement a "treble" control
  512. @constant kAudioUnitSubType_LowShelfFilter
  513. A filter that can be used to implement a "bass" control
  514. @constant kAudioUnitSubType_ParametricEQ
  515. A parametric EQ filter
  516. @constant kAudioUnitSubType_GraphicEQ
  517. - desktop only
  518. A 10 or 31 band Graphic EQ
  519. @constant kAudioUnitSubType_PeakLimiter
  520. A peak limiter
  521. @constant kAudioUnitSubType_DynamicsProcessor
  522. A dynamics compressor/expander
  523. @constant kAudioUnitSubType_MultiBandCompressor
  524. - desktop only
  525. A 4 band compressor/expander
  526. @constant kAudioUnitSubType_MatrixReverb
  527. - desktop only
  528. A reverb that can be used to simulate various and different spaces
  529. @constant kAudioUnitSubType_SampleDelay
  530. - desktop only
  531. A delay that is used to delay the input a specified number of samples until
  532. the output
  533. @constant kAudioUnitSubType_Pitch
  534. - desktop only
  535. An audio unit used to change the pitch
  536. @constant kAudioUnitSubType_AUFilter
  537. - desktop only
  538. A filter unit that combines 5 different filters (low, 3 mids, high)
  539. @constant kAudioUnitSubType_NetSend
  540. - desktop only
  541. An audio unit that is used in conjunction with _NetReceive to send audio
  542. across the network (or between different applications)
  543. @constant kAudioUnitSubType_Distortion
  544. A distortion audio unit
  545. @constant kAudioUnitSubType_RogerBeep
  546. - desktop only
  547. An audio unit that can be used to emit a short tone in gaps between speech
  548. - similar to the tones used in a walkie-talkie
  549. @constant kAudioUnitSubType_AUiPodEQ
  550. - iPhone only
  551. A simple graphic EQ with common presets
  552. @constant kAudioUnitSubType_NBandEQ
  553. - iPhone only
  554. A generalized N-band graphic EQ with specifiable filter types per-band
  555. @constant kAudioUnitSubType_Reverb2
  556. - iPhone only
  557. A reverb for iOS
  558. }
  559. const
  560. kAudioUnitSubType_PeakLimiter = FourCharCode('lmtr');
  561. kAudioUnitSubType_DynamicsProcessor = FourCharCode('dcmp');
  562. kAudioUnitSubType_LowPassFilter = FourCharCode('lpas');
  563. kAudioUnitSubType_HighPassFilter = FourCharCode('hpas');
  564. kAudioUnitSubType_BandPassFilter = FourCharCode('bpas');
  565. kAudioUnitSubType_HighShelfFilter = FourCharCode('hshf');
  566. kAudioUnitSubType_LowShelfFilter = FourCharCode('lshf');
  567. kAudioUnitSubType_ParametricEQ = FourCharCode('pmeq');
  568. kAudioUnitSubType_Distortion = FourCharCode('dist');
  569. {$ifc not TARGET_OS_IPHONE}
  570. kAudioUnitSubType_Delay = FourCharCode('dely');
  571. kAudioUnitSubType_GraphicEQ = FourCharCode('greq');
  572. kAudioUnitSubType_MultiBandCompressor = FourCharCode('mcmp');
  573. kAudioUnitSubType_MatrixReverb = FourCharCode('mrev');
  574. kAudioUnitSubType_SampleDelay = FourCharCode('sdly');
  575. kAudioUnitSubType_Pitch = FourCharCode('tmpt');
  576. kAudioUnitSubType_AUFilter = FourCharCode('filt');
  577. kAudioUnitSubType_NetSend = FourCharCode('nsnd');
  578. kAudioUnitSubType_RogerBeep = FourCharCode('rogr');
  579. {$elsec} { not TARGET_OS_IPHONE }
  580. kAudioUnitSubType_Reverb2 = FourCharCode('rvb2');
  581. kAudioUnitSubType_AUiPodEQ = FourCharCode('ipeq');
  582. kAudioUnitSubType_NBandEQ = 'nbeq';
  583. {$endif} { not TARGET_OS_IPHONE }
  584. {!
  585. @enum Apple mixer audio unit sub types
  586. @discussion These are the subtypes for the various mixer units that apple ships
  587. @constant kAudioUnitSubType_MultiChannelMixer
  588. Can have any number of inputs, with any number of channels on any input to one
  589. output bus with any number of channels on the desktop. On iPhone the output
  590. number of channels is 2.
  591. @constant kAudioUnitSubType_StereoMixer
  592. - desktop only
  593. Inputs can be mono or stereo. Single stereo output
  594. @constant kAudioUnitSubType_3DMixer
  595. - desktop only
  596. Inputs can be mono, in which case they can be panned around using 3D
  597. coordinates and parameters.
  598. Stereo inputs are passed directly through to the output.
  599. 4 channel "ambisonic" inputs will be rendered to the output configuration
  600. A single output of 2, 4, 5, 6, 7 or 8 channels.
  601. @constant kAudioUnitSubType_MatrixMixer
  602. - desktop only
  603. Any number of input and output buses with any number of channels on any bus.
  604. The mix is presented as a matrix of channels that can be controlled through
  605. input volume per channel, "cross-point" volume (a given input channel to a
  606. given output channel), output volume per channel and a global volume across
  607. the whole matrix
  608. @constant kAudioUnitSubType_AU3DMixerEmbedded
  609. - iPhone only
  610. A scaled-down version of the AU3DMixer that presents a stereo output, mono or
  611. stereo inputs
  612. }
  613. const
  614. kAudioUnitSubType_MultiChannelMixer = FourCharCode('mcmx');
  615. //#if !TARGET_OS_IPHONE
  616. {$ifc not TARGET_OS_IPHONE}
  617. kAudioUnitSubType_StereoMixer = FourCharCode('smxr');
  618. kAudioUnitSubType_3DMixer = FourCharCode('3dmx');
  619. kAudioUnitSubType_MatrixMixer = FourCharCode('mxmx');
  620. //#else
  621. {$elsec} { not TARGET_OS_IPHONE }
  622. kAudioUnitSubType_AU3DMixerEmbedded = FourCharCode('3dem');
  623. //#endif;
  624. {$endc} { not TARGET_OS_IPHONE }
  625. {!
  626. @enum Apple panner audio unit sub types
  627. @discussion These are the subtypes for the various panner units that apple ships
  628. @constant kAudioUnitSubType_SphericalHeadPanner
  629. - desktop only
  630. A panner unit that uses the spherical head model to pan to a stereo output
  631. @constant kAudioUnitSubType_VectorPanner
  632. - desktop only
  633. A panner unit that uses a moving pan between the two closes, adjacent channels
  634. in a 3D space to a
  635. surround output
  636. @constant kAudioUnitSubType_SoundFieldPanner
  637. - desktop only
  638. A panner unit that uses a sound-field notion to pan to a surround output
  639. @constant kAudioUnitSubType_HRTFPanner
  640. - desktop only
  641. A panner unit that uses a generic "HRTF" model to pan to a stereo output
  642. }
  643. //#if !TARGET_OS_IPHONE
  644. {$ifc not TARGET_OS_IPHONE}
  645. const
  646. kAudioUnitSubType_SphericalHeadPanner = FourCharCode('sphr');
  647. kAudioUnitSubType_VectorPanner = FourCharCode('vbas');
  648. kAudioUnitSubType_SoundFieldPanner = FourCharCode('ambi');
  649. kAudioUnitSubType_HRTFPanner = FourCharCode('hrtf');
  650. //#endif
  651. {$endc} { not TARGET_OS_IPHONE }
  652. {!
  653. @enum Apple generator audio unit sub types
  654. @discussion These are the subtypes for the various generator units that apple ships
  655. @constant kAudioUnitSubType_ScheduledSoundPlayer
  656. A generator unit that can be used to schedule slices of audio to be played at
  657. a specified time. The audio is scheduled using the time stamps for the render
  658. operation, and can be scheduled from any thread.
  659. @constant kAudioUnitSubType_AudioFilePlayer
  660. A generator unit that is used to play a file. It presents a custom UI so can
  661. be used in a UI context as well
  662. @constant kAudioUnitSubType_NetReceive
  663. - desktop only
  664. A generator unit that is paired with _NetSend to receive the audio that unit
  665. sends. It presents a custom UI so can be used in a UI context as well
  666. }
  667. const
  668. kAudioUnitSubType_NetReceive = FourCharCode('nrcv');
  669. {$ifc not TARGET_OS_IPHONE}
  670. kAudioUnitSubType_ScheduledSoundPlayer = FourCharCode('sspl');
  671. kAudioUnitSubType_AudioFilePlayer = FourCharCode('afpl');
  672. {$endc} { not TARGET_OS_IPHONE }
  673. //=====================================================================================================================
  674. //#pragma mark -
  675. //#pragma mark Audio Unit Constants and typedefs
  676. {!
  677. @enum AudioUnitRenderActionFlags
  678. @discussion These flags can be set in a callback from an audio unit during an audio unit
  679. render operation from either the RenderNotify Proc or the render input
  680. callback.
  681. @constant kAudioUnitRenderAction_PreRender
  682. Called on a render notification Proc - which is called either before or after
  683. the render operation of the audio unit. If this flag is set, the proc is being
  684. called before the render operation is performed.
  685. @constant kAudioUnitRenderAction_PostRender
  686. Called on a render notification Proc - which is called either before or after
  687. the render operation of the audio unit. If this flag is set, the proc is being
  688. called after the render operation is completed.
  689. @constant kAudioUnitRenderAction_OutputIsSilence
  690. This flag can be set in a render input callback (or in the audio unit's render
  691. operation itself) and is used to indicate that the render buffer contains only
  692. silence. It can then be used by the caller as a hint to whether the buffer
  693. needs to be processed or not.
  694. @constant kAudioOfflineUnitRenderAction_Preflight
  695. This is used with offline audio units (of type 'auol'). It is used when an
  696. offline unit is being preflighted, which is performed prior to the actual
  697. offline rendering actions are performed. It is used for those cases where the
  698. offline process needs it (for example, with an offline unit that normalises an
  699. audio file, it needs to see all of the audio data first before it can perform
  700. its normalisation)
  701. @constant kAudioOfflineUnitRenderAction_Render
  702. Once an offline unit has been successfully preflighted, it is then put into
  703. its render mode. So this flag is set to indicate to the audio unit that it is
  704. now in that state and that it should perform its processing on the input data.
  705. @constant kAudioOfflineUnitRenderAction_Complete
  706. This flag is set when an offline unit has completed either its preflight or
  707. performed render operations
  708. @constant kAudioUnitRenderAction_PostRenderError
  709. If this flag is set on the post-render call an error was returned by the
  710. AUs render operation. In this case, the error can be retrieved through the
  711. lastRenderError property and the audio data in ioData handed to the post-render
  712. notification will be invalid.
  713. @constant kAudioUnitRenderAction_DoNotCheckRenderArgs
  714. If this flag is set, then checks that are done on the arguments provided to render
  715. are not performed. This can be useful to use to save computation time in
  716. situations where you are sure you are providing the correct arguments
  717. and structures to the various render calls
  718. }
  719. const
  720. kAudioUnitRenderAction_PreRender = 1 shl 2;
  721. kAudioUnitRenderAction_PostRender = 1 shl 3;
  722. kAudioUnitRenderAction_OutputIsSilence = 1 shl 4;
  723. kAudioOfflineUnitRenderAction_Preflight = 1 shl 5;
  724. kAudioOfflineUnitRenderAction_Render = 1 shl 6;
  725. kAudioOfflineUnitRenderAction_Complete = 1 shl 7;
  726. kAudioUnitRenderAction_PostRenderError = 1 shl 8;
  727. kAudioUnitRenderAction_DoNotCheckRenderArgs = 1 shl 9;
  728. type
  729. AudioUnitRenderActionFlags = UInt32;
  730. {!
  731. @enum Audio unit errors
  732. @discussion These are the various errors that can be returned by AudioUnit... API calls
  733. @constant kAudioUnitErr_InvalidProperty
  734. The property is not supported
  735. @constant kAudioUnitErr_InvalidParameter
  736. The parameter is not supported
  737. @constant kAudioUnitErr_InvalidElement
  738. The specified element is not valid
  739. @constant kAudioUnitErr_NoConnection
  740. There is no connection (generally an audio unit is asked to render but it has
  741. not input from which to gather data)
  742. @constant kAudioUnitErr_FailedInitialization
  743. The audio unit is unable to be initialised
  744. @constant kAudioUnitErr_TooManyFramesToProcess
  745. When an audio unit is initialised it has a value which specifies the max
  746. number of frames it will be asked to render at any given time. If an audio
  747. unit is asked to render more than this, this error is returned.
  748. @constant kAudioUnitErr_InvalidFile
  749. If an audio unit uses external files as a data source, this error is returned
  750. if a file is invalid (Apple's DLS synth returns this error)
  751. @constant kAudioUnitErr_FormatNotSupported
  752. Returned if an input or output format is not supported
  753. @constant kAudioUnitErr_Uninitialized
  754. Returned if an operation requires an audio unit to be initialised and it is
  755. not.
  756. @constant kAudioUnitErr_InvalidScope
  757. The specified scope is invalid
  758. @constant kAudioUnitErr_PropertyNotWritable
  759. The property cannot be written
  760. @constant kAudioUnitErr_CannotDoInCurrentContext
  761. Returned when an audio unit is in a state where it can't perform the requested
  762. action now - but it could later. Its usually used to guard a render operation
  763. when a reconfiguration of its internal state is being performed.
  764. @constant kAudioUnitErr_InvalidPropertyValue
  765. The property is valid, but the value of the property being provided is not
  766. @constant kAudioUnitErr_PropertyNotInUse
  767. Returned when a property is valid, but it hasn't been set to a valid value at
  768. this time.
  769. @constant kAudioUnitErr_Initialized
  770. Indicates the operation cannot be performed because the audio unit is
  771. initialized.
  772. @constant kAudioUnitErr_InvalidOfflineRender
  773. Used to indicate that the offline render operation is invalid. For instance,
  774. when the audio unit needs to be pre-flighted,
  775. but it hasn't been.
  776. @constant kAudioUnitErr_Unauthorized
  777. Returned by either Open or Initialise, this error is used to indicate that the
  778. audio unit is not authorised, that it cannot be used. A host can then present
  779. a UI to notify the user the audio unit is not able to be used in its current
  780. state.
  781. }
  782. const
  783. kAudioUnitErr_InvalidProperty = -10879;
  784. kAudioUnitErr_InvalidParameter = -10878;
  785. kAudioUnitErr_InvalidElement = -10877;
  786. kAudioUnitErr_NoConnection = -10876;
  787. kAudioUnitErr_FailedInitialization = -10875;
  788. kAudioUnitErr_TooManyFramesToProcess = -10874;
  789. kAudioUnitErr_InvalidFile = -10871;
  790. kAudioUnitErr_FormatNotSupported = -10868;
  791. kAudioUnitErr_Uninitialized = -10867;
  792. kAudioUnitErr_InvalidScope = -10866;
  793. kAudioUnitErr_PropertyNotWritable = -10865;
  794. kAudioUnitErr_CannotDoInCurrentContext = -10863;
  795. kAudioUnitErr_InvalidPropertyValue = -10851;
  796. kAudioUnitErr_PropertyNotInUse = -10850;
  797. kAudioUnitErr_Initialized = -10849;
  798. kAudioUnitErr_InvalidOfflineRender = -10848;
  799. kAudioUnitErr_Unauthorized = -10847;
  800. {!
  801. @typedef AudioUnitPropertyID
  802. @discussion Type used for audio unit properties.
  803. Properties are used to describe the state of an audio unit (for instance,
  804. the input or output audio format)
  805. }
  806. type
  807. AudioUnitPropertyID = UInt32;
  808. {!
  809. @typedef AudioUnitScope
  810. @discussion Type used for audio unit scopes. Apple reserves the 0 < 1024 range for
  811. audio unit scope identifiers.
  812. Scopes are used to delineate a major attribute of an audio unit
  813. (for instance, global, input, output)
  814. }
  815. type
  816. AudioUnitScope = UInt32;
  817. {!
  818. @typedef AudioUnitElement
  819. @discussion Type used for audio unit elements.
  820. Scopes can have one or more member, and a member of a scope is
  821. addressed / described by its element
  822. For instance, input bus 1 is input scope, element 1
  823. }
  824. type
  825. AudioUnitElement = UInt32;
  826. {!
  827. @typedef AudioUnitParameterID
  828. @discussion Type used for audio unit parameters.
  829. Parameters are typically used to control and set render state
  830. (for instance, filter cut-off frequency)
  831. }
  832. type
  833. AudioUnitParameterID = UInt32;
  834. {!
  835. @typedef AudioUnitParameterValue
  836. @discussion Type used for audio unit parameter values.
  837. The value of a given parameter is specified using this type
  838. (typically a Float32)
  839. }
  840. type
  841. AudioUnitParameterValue = Float32;
  842. AudioUnitParameterValuePtr = ^AudioUnitParameterValue;
  843. {!
  844. @enum AUParameterEventType
  845. @discussion The type of a parameter event (see AudioUnitScheduleParameter)
  846. @constant kParameterEvent_Immediate
  847. The parameter event describes an immediate change to the parameter value to
  848. the new value
  849. @constant kParameterEvent_Ramped
  850. The parameter event describes a change to the parameter value that should
  851. be applied over the specified period of time
  852. }
  853. const
  854. kParameterEvent_Immediate = 1;
  855. kParameterEvent_Ramped = 2;
  856. type
  857. AUParameterEventType = UInt32;
  858. {!
  859. @struct AudioUnitParameterEvent
  860. @discussion A parameter event describes a change to a parameter's value, where the type of
  861. the event describes how that change is to be applied (see AUParameterEventType).
  862. A parameter is uniquely defined through the triplet of scope, element and
  863. parameterID.
  864. See AudioUnitScheduleParameters
  865. @field scope
  866. The scope for the parameter
  867. @field element
  868. The element for the parameter
  869. @field parameter
  870. The parameterID for the parameter
  871. @field eventType
  872. The event type. This field further defines how the union described by
  873. eventValues is to be interpreted.
  874. @field eventValues
  875. If the parameter event type is _Immediate, then the immediate struct of this
  876. union should be used.
  877. If the parameter event type is _Ramped, then the ramp struct of this union
  878. should be used.
  879. }
  880. type
  881. AudioUnitParameterEventRampRec = record
  882. startBufferOffset: SInt32;
  883. durationInFrames: UInt32;
  884. startValue: AudioUnitParameterValue;
  885. endValue: AudioUnitParameterValue;
  886. end;
  887. AudioUnitParameterEventImmediateRec = record
  888. bufferOffset: UInt32;
  889. value: AudioUnitParameterValue;
  890. end;
  891. AudioUnitParameterEventEventValues = record
  892. case UInt8 of
  893. 0: (ramp : AudioUnitParameterEventRampRec);
  894. 1: (immediate : AudioUnitParameterEventImmediateRec);
  895. end;
  896. AudioUnitParameterEvent = record
  897. scope: AudioUnitScope;
  898. element: AudioUnitElement;
  899. parameter: AudioUnitParameterID;
  900. eventType: AUParameterEventType;
  901. eventValues: AudioUnitParameterEventEventValues;
  902. end;
  903. AudioUnitParameterEventPtr = ^AudioUnitParameterEvent;
  904. {!
  905. @struct AudioUnitParameter
  906. @discussion An audio unit parameter is defined by the triplet of audio unit scope, element
  907. and parameterID. This struct is used with the functions in AudioUnitUtilities.h
  908. to deal with audio unit parameters, but is included in this header file for
  909. completeness
  910. @field mAudioUnit
  911. The audio unit instance which the specified parameter applies too
  912. @field mParameterID
  913. The parameterID for the parameter
  914. @field mScope
  915. The scope for the parameter
  916. @field mElement
  917. The element for the parameter
  918. }
  919. type
  920. AudioUnitParameter = record
  921. mAudioUnit: AudioUnit;
  922. mParameterID: AudioUnitParameterID;
  923. mScope: AudioUnitScope;
  924. mElement: AudioUnitElement;
  925. end;
  926. AudioUnitParameterPtr = ^AudioUnitParameter;
  927. {!
  928. @struct AudioUnitProperty
  929. @discussion An audio unit property is defined by the triplet of audio unit scope, element
  930. and propertyID. This struct is used with the functions in AudioUnitUtilities.h
  931. to deal with audio unit properties, but is included in this header file for
  932. completeness
  933. @field mAudioUnit
  934. The audio unit instance which the specified property applies too
  935. @field mPropertyID
  936. The propertyID for the property
  937. @field mScope
  938. The scope for the property
  939. @field mElement
  940. The element for the property
  941. }
  942. type
  943. AudioUnitProperty = record
  944. mAudioUnit: AudioUnit;
  945. mPropertyID: AudioUnitPropertyID;
  946. mScope: AudioUnitScope;
  947. mElement: AudioUnitElement;
  948. end;
  949. AudioUnitPropertyPtr = ^AudioUnitProperty;
  950. {!
  951. @typedef AURenderCallback
  952. @discussion This is the prototype for a function callback Proc that is used both with the
  953. AudioUnit render notification API and the render input callback. See
  954. kAudioUnitProperty_SetRenderCallback property or AudioUnitAddRenderNotify.
  955. This callback is part of the process of a call to AudioUnitRender. As a
  956. notification it is called either before or after the audio unit's render
  957. operations. As a render input callback, it is called to provide input data for
  958. the particular input bus the callback is attached too.
  959. @param inRefCon
  960. The client data that is provided either with the AURenderCallbackStruct or as
  961. specified with the Add API call
  962. @param ioActionFlags
  963. Flags used to describe more about the context of this call (pre or post in the
  964. notify case for instance)
  965. @param inTimeStamp
  966. The times stamp associated with this call of audio unit render
  967. @param inBusNumber
  968. The bus number associated with this call of audio unit render
  969. @param inNumberFrames
  970. The number of sample frames that will be represented in the audio data in the
  971. provided ioData parameter
  972. @param ioData
  973. The AudioBufferList that will be used to contain the rendered or provided
  974. audio data. These buffers will be aligned to 16 byte boundaries (which is
  975. normally what malloc will return).
  976. }
  977. type
  978. AURenderCallback = function( inRefCon: UnivPtr; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inBusNumber: UInt32; inNumberFrames: UInt32; var ioData: AudioBufferList ): OSStatus;
  979. {!
  980. @typedef AudioUnitPropertyListenerProc
  981. @discussion This is the prototype for a function callback Proc that is registered with an
  982. audio unit to notify the caller of any changes to a value of an audio unit
  983. property. See AudioUnitAddPropertyListener
  984. @param inRefCon
  985. The client data that is provided with the add property listener registration
  986. @param inUnit
  987. The audio unit upon which the specified property value has changed
  988. @param inID
  989. The property whose value has changed
  990. @param inScope
  991. The scope of the property whose value has changed
  992. @param inElement
  993. The element ID on the scope of the property whose value has changed
  994. }
  995. type
  996. AudioUnitPropertyListenerProc = procedure( inRefCon: UnivPtr; inUnit: AudioUnit; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement );
  997. {!
  998. @typedef AUInputSamplesInOutputCallback
  999. @discussion This is the prototype for a function callback Proc that is registered with an
  1000. audio unit to notify the caller of for the user of a varispeed or AUTimePitch
  1001. audio unit where it is not clear what input sample is represented in the
  1002. rendered output samples.
  1003. @param inRefCon
  1004. The client data that is provided with the add property listener registration
  1005. @param inOutputTimeStamp
  1006. The time stamp that corresponds to the first sample of audio data produced in
  1007. AudioUnitRender (its output data)
  1008. @param inInputSample
  1009. The sample number of the input that is represented in the first sample of that
  1010. output time stamp
  1011. @param inNumberInputSamples
  1012. The number of input samples that are represented in an output buffer
  1013. }
  1014. type
  1015. AUInputSamplesInOutputCallback = procedure( inRefCon: UnivPtr; const (*var*) inOutputTimeStamp: AudioTimeStamp; inInputSample: Float64; inNumberInputSamples: Float64 );
  1016. //=====================================================================================================================
  1017. //#pragma mark -
  1018. //#pragma mark Functions
  1019. {!
  1020. @function AudioUnitInitialize
  1021. @abstract initialize an audio unit
  1022. @discussion Upon success, the audio unit has been successfully initialised. This means
  1023. that the formats for input and output are valid and can be supported and it
  1024. has based its allocations on the max number of frames that it is able to
  1025. render at any given time. Once initialised, it is in a state where it can be
  1026. asked to render.
  1027. In common practice major state of an audio unit (such as its I/O formats,
  1028. memory allocations) cannot be changed while an audio unit is inialized.
  1029. @param inUnit
  1030. The audio unit to initialise
  1031. @result noErr, or an error representing the reasons why the audio unit was not able
  1032. to be initialised successfully
  1033. }
  1034. function AudioUnitInitialize( inUnit: AudioUnit ): OSStatus; external name '_AudioUnitInitialize';
  1035. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1036. {!
  1037. @function AudioUnitUninitialize
  1038. @abstract uninitialize and audio unit
  1039. @discussion Once an audio unit has been initialised, to change its state in response to
  1040. some kind of environmental change, the audio unit should be uninitialised.
  1041. This will have the effect of the audio unit de-allocating its resources.
  1042. The caller can then reconfigure the audio unit to match the new environment
  1043. (for instance, the sample rate to process audio is different than it was) and
  1044. then re-initialise the audio unit when those changes have been applied.
  1045. @param inUnit
  1046. The audio unit to uninitialise
  1047. @result noErr, or an error representing the reasons why the audio unit was not able
  1048. to be initialised successfully. Typically this call won't return an error
  1049. unless the audio unit in question is no longer valid.
  1050. }
  1051. function AudioUnitUninitialize( inUnit: AudioUnit ): OSStatus; external name '_AudioUnitUninitialize';
  1052. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1053. {!
  1054. @function AudioUnitGetPropertyInfo
  1055. @abstract retrieves information about a specified property
  1056. @discussion The API can be used to retrieve both the size of the property, and whether it
  1057. is writable or not. In order to get a general answer on the capability of an
  1058. audio unit, this function should be called before the audio unit
  1059. is initialized (as some properties are writable when the audio unit is
  1060. initialized, and others not)
  1061. @param inUnit
  1062. the audio unit
  1063. @param inID
  1064. the property identifier
  1065. @param inScope
  1066. the scope of the property
  1067. @param inElement
  1068. the element of the scope
  1069. @param outDataSize
  1070. if not null, then will retrieve the maximum size for the property. if null,
  1071. then it is ignored
  1072. @param outWritable
  1073. if not null, then will retrieve whether the property can be written or not.
  1074. if null, then it is ignored
  1075. @result noErr, or various audio unit errors related to properties
  1076. }
  1077. function AudioUnitGetPropertyInfo( inUnit: AudioUnit; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; outDataSize: UInt32Ptr; outWritable: BooleanPtr ): OSStatus; external name '_AudioUnitGetPropertyInfo';
  1078. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1079. {!
  1080. @function AudioUnitGetProperty
  1081. @abstract retrieves the value of a specified property
  1082. @discussion The API can is used to retrieve the value of the property. Property values for
  1083. audio units are always passed by reference
  1084. @param inUnit
  1085. the audio unit
  1086. @param inID
  1087. the property identifier
  1088. @param inScope
  1089. the scope of the property
  1090. @param inElement
  1091. the element of the scope
  1092. @param outData
  1093. used to retrieve the value of the property. It should point to memory at least
  1094. as large as the value
  1095. described by ioDataSize
  1096. @param ioDataSize
  1097. on input contains the size of the data pointed to by outData, on output, the
  1098. size of the data that was returned.
  1099. @result noErr, or various audio unit errors related to properties
  1100. }
  1101. function AudioUnitGetProperty( inUnit: AudioUnit; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; outData: UnivPtr; var ioDataSize: UInt32 ): OSStatus; external name '_AudioUnitGetProperty';
  1102. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1103. {!
  1104. @function AudioUnitSetProperty
  1105. @abstract sets the value of a specified property
  1106. @discussion The API can is used to set the value of the property. Property values for
  1107. audio units are always passed by reference
  1108. @param inUnit
  1109. the audio unit
  1110. @param inID
  1111. the property identifier
  1112. @param inScope
  1113. the scope of the property
  1114. @param inElement
  1115. the element of the scope
  1116. @param inData
  1117. if not null, then is the new value for the property that will be set. If null,
  1118. then inDataSize should be zero, and the call is then used to remove a
  1119. previously set value for a property. This removal is only valid for
  1120. some properties, as most properties will always have a default value if not
  1121. set.
  1122. @param inDataSize
  1123. the size of the data being provided in inData
  1124. @result noErr, or various audio unit errors related to properties
  1125. }
  1126. function AudioUnitSetProperty( inUnit: AudioUnit; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; inData: {const} UnivPtr; inDataSize: UInt32 ): OSStatus; external name '_AudioUnitSetProperty';
  1127. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1128. {!
  1129. @function AudioUnitAddPropertyListener
  1130. @abstract registration call to receive notifications for when a property changes
  1131. @discussion When an audio unit property value changes, a notification callback can be
  1132. called by the audio unit to inform interested parties that this event has
  1133. occurred. The notification is defined by the tuple of inProc and
  1134. inProcUserData as paired to the specified property ID, so the previously
  1135. defined AudioUnitRemovePropertyListener is deprecated because it didn't allow
  1136. for the provision of the inProcUserData to remove a given listener (so,
  1137. you should use AudioUnitRemovePropertyListenerWithUserData).
  1138. @param inUnit
  1139. the audio unit
  1140. @param inID
  1141. the property identifier
  1142. @param inProc
  1143. the procedure to call when the property changes (on any scope or element)
  1144. @param inProcUserData
  1145. the user data to provide with the callback
  1146. @result noErr, or various audio unit errors related to properties
  1147. }
  1148. function AudioUnitAddPropertyListener( inUnit: AudioUnit; inID: AudioUnitPropertyID; inProc: AudioUnitPropertyListenerProc; inProcUserData: UnivPtr ): OSStatus; external name '_AudioUnitAddPropertyListener';
  1149. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1150. {!
  1151. @function AudioUnitRemovePropertyListenerWithUserData
  1152. @abstract remove a previously registered property listener
  1153. @discussion Removes a previously registered property listener as specified by the inProc
  1154. and inProcUser data as paired to the property identifier
  1155. @param inUnit
  1156. the audio unit
  1157. @param inID
  1158. the property identifier
  1159. @param inProc
  1160. the procedure previously registered
  1161. @param inProcUserData
  1162. the user data paired with the provided inProc
  1163. @result noErr, or various audio unit errors related to properties
  1164. }
  1165. function AudioUnitRemovePropertyListenerWithUserData( inUnit: AudioUnit; inID: AudioUnitPropertyID; inProc: AudioUnitPropertyListenerProc; inProcUserData: UnivPtr ): OSStatus; external name '_AudioUnitRemovePropertyListenerWithUserData';
  1166. (* __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0) *)
  1167. {!
  1168. @function AudioUnitAddRenderNotify
  1169. @abstract a notification callback to call when an audio unit is asked to render
  1170. @discussion allows an application to register a callback with an audio unit for whenever
  1171. the audio unit is asked to render. The callback is called both before the
  1172. audio unit performs its render operations (the render flag's pre-render bit
  1173. is set) and after the audio unit has completed its render operations (the
  1174. render flag's post-render bit is set). On post-render, the audio buffer list
  1175. (ioData) will contain valid audio data that was rendered by the audio unit.
  1176. The inProc and inProcUserData are treated as a tuple entity, so when wanting
  1177. to remove one, both the inProc and its inProcUserData must be specified
  1178. @param inUnit
  1179. the audio unit
  1180. @param inProc
  1181. an AURenderCallback proc
  1182. @param inProcUserData
  1183. the user data that will be provided with the proc when it is called
  1184. @result noErr, or an audio unit error code
  1185. }
  1186. function AudioUnitAddRenderNotify( inUnit: AudioUnit; inProc: AURenderCallback; inProcUserData: UnivPtr ): OSStatus; external name '_AudioUnitAddRenderNotify';
  1187. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  1188. {!
  1189. @function AudioUnitRemoveRenderNotify
  1190. @abstract remove a previously registered render notification proc
  1191. @param inUnit
  1192. the audio unit
  1193. @param inProc
  1194. an AURenderCallback proc
  1195. @param inProcUserData
  1196. the user data that was provided with the proc when it was previously
  1197. registered
  1198. @result noErr, or an audio unit error code
  1199. }
  1200. function AudioUnitRemoveRenderNotify( inUnit: AudioUnit; inProc: AURenderCallback; inProcUserData: UnivPtr ): OSStatus; external name '_AudioUnitRemoveRenderNotify';
  1201. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  1202. {!
  1203. @function AudioUnitGetParameter
  1204. @abstract Get the value of a parameter
  1205. @discussion Get the value of a parameter as specified by its ID, scope and element.
  1206. @param inUnit
  1207. the audio unit
  1208. @param inID
  1209. the parameter ID
  1210. @param inScope
  1211. the scope for the parameter
  1212. @param inElement
  1213. the element on the scope for the parameter
  1214. @param outValue
  1215. Must be non-null, and upon success will contain the current value for the
  1216. specified parameter
  1217. @result noErr, or an audio unit error code (such as InvalidParameter)
  1218. }
  1219. function AudioUnitGetParameter( inUnit: AudioUnit; inID: AudioUnitParameterID; inScope: AudioUnitScope; inElement: AudioUnitElement; var outValue: AudioUnitParameterValue ): OSStatus; external name '_AudioUnitGetParameter';
  1220. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1221. {!
  1222. @function AudioUnitSetParameter
  1223. @abstract Set the value of a parameter
  1224. @discussion Set the value of a parameter as specified by its ID, scope and element.
  1225. Parameter IDs are consistent across all of the elements in a scope - so for a
  1226. mixer, the "input volume" parameter can be applied on any input, and the
  1227. particular input is specified by the elementID.
  1228. @param inUnit
  1229. the audio unit
  1230. @param inID
  1231. the parameter ID
  1232. @param inScope
  1233. the scope for the parameter
  1234. @param inElement
  1235. the element on the scope for the parameter
  1236. @param inValue
  1237. the new value for the parameter.
  1238. @param inBufferOffsetInFrames
  1239. generally should be set to zero - see AudioUnitScheduleParameters
  1240. @result noErr, or an audio unit error code (such as InvalidParameter)
  1241. }
  1242. function AudioUnitSetParameter( inUnit: AudioUnit; inID: AudioUnitParameterID; inScope: AudioUnitScope; inElement: AudioUnitElement; inValue: AudioUnitParameterValue; inBufferOffsetInFrames: UInt32 ): OSStatus; external name '_AudioUnitSetParameter';
  1243. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1244. {!
  1245. @function AudioUnitScheduleParameters
  1246. @abstract Schedule changes to the value of a parameter
  1247. @discussion This API is used to schedule intra-buffer changes to the value of a parameter
  1248. (immediate) or to ramp a parameter from a start value to an end value for a
  1249. specified number of samples (ramp)
  1250. The API allows for the scheduling of multiple parameter events with the one
  1251. call. All of the parameter events must apply to the current (and only apply to
  1252. the current) audio unit render call, so the events are scheduled as a part of
  1253. the pre-render notification callback.
  1254. When scheduling an immediate parameter event, the new value at the specified
  1255. sample buffer offset is provided
  1256. When scheduling a ramped parameter, the ramp is scheduled each audio unit
  1257. render for the duration of the ramp. Each schedule of the the new audio unit
  1258. render specifies the progress of the ramp.
  1259. Parameters that can have events scheduled to them will indicate this through
  1260. their parameter info struct
  1261. @param inUnit
  1262. the audio unit
  1263. @param inParameterEvent
  1264. a pointer to an array of parameter event structs
  1265. @param inNumParamEvents
  1266. the number of parameter event structs pointed to by inParameterEvent
  1267. @result noErr, or an audio unit error code (such as InvalidParameter)
  1268. }
  1269. function AudioUnitScheduleParameters( inUnit: AudioUnit; const inParameterEvent: AudioUnitParameterEventPtr; inNumParamEvents: UInt32 ): OSStatus; external name '_AudioUnitScheduleParameters';
  1270. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  1271. {!
  1272. @function AudioUnitRender
  1273. @abstract the render operation where ioData will contain the results of the audio unit's
  1274. render operations
  1275. @discussion an audio unit will render the amount of audio data described by
  1276. inNumberOfFrames and the results of that render will be contained within
  1277. ioData. The caller should provide audio time stamps where at least the sample
  1278. time is valid and it is incrementing sequentially from its previous call
  1279. (so, the next time stamp will be the current time stamp + inNumberFrames)
  1280. If the sample time is not incrementing sequentially, the audio unit will infer
  1281. that there is some discontinuity with the timeline it is rendering for
  1282. The caller must provide a valid ioData AudioBufferList that matches the
  1283. expected topology for the current audio format for the given bus. The buffer
  1284. list can be of two variants:
  1285. (1) If the mData pointers are non-null then the audio unit will render its
  1286. output into those buffers. These buffers should be aligned to 16 byte
  1287. boundaries (which is normally what malloc will return).
  1288. (2) If the mData pointers are null, then the audio unit can provide pointers
  1289. to its own buffers. In this case the audio unit is required to keep those
  1290. buffers valid for the duration of the calling thread's I/O cycle
  1291. @param inUnit
  1292. the audio unit
  1293. @param ioActionFlags
  1294. any appropriate action flags for the render operation
  1295. @param inTimeStamp
  1296. the time stamp that applies to this particular render operation. when
  1297. rendering for multiple output buses the time stamp will generally be the same
  1298. for each output bus, so the audio unit is able to determine without doubt that
  1299. this the same render operation
  1300. @param inOutputBusNumber
  1301. the output bus to render for
  1302. @param inNumberFrames
  1303. the number of sample frames to render
  1304. @param ioData
  1305. the audio buffer list that the audio unit is to render into.
  1306. @result noErr, or an audio unit render error
  1307. }
  1308. function AudioUnitRender( inUnit: AudioUnit; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inOutputBusNumber: UInt32; inNumberFrames: UInt32; ioData: AudioBufferListPtr ): OSStatus; external name '_AudioUnitRender';
  1309. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  1310. {$ifc TARGET_OS_MAC}
  1311. function AudioUnitProcess( inUnit: AudioUnit; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inNumberFrames: UInt32; var ioData: AudioBufferList ): OSStatus; external name '_AudioUnitProcess';
  1312. (* __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_NA) *)
  1313. function AudioUnitProcessMultiple( inUnit: AudioUnit; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inNumberFrames: UInt32; inNumberInputBufferLists: UInt32; {const} inInputBufferLists: AudioBufferListPtrPtr; inNumberOutputBufferLists: UInt32; ioOutputBufferLists: AudioBufferListPtrPtr ): OSStatus; external name '_AudioUnitProcessMultiple';
  1314. (* __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_NA) *)
  1315. {$endc} {TARGET_OS_MAC}
  1316. {!
  1317. @function AudioUnitReset
  1318. @abstract reset an audio unit's render state
  1319. @discussion This call will clear any render state of an audio unit. For instance, with a
  1320. delay or reverb type of audio unit reset will clear any of the delay lines
  1321. maintained within the audio unit. Typically, this call is made when an
  1322. audio unit was previously rendering, and was taken out of the render chain
  1323. (say, the track it is in was muted) and is being added back in (unmuted).
  1324. The host should reset the audio unit before adding it back so that it doesn't
  1325. produce audio from its delay lines that is no longer valid.
  1326. The call should only clear memory, it should NOT allocate or free memory
  1327. resources (this is done in the Initialize calls).
  1328. @param inUnit
  1329. the audio unit
  1330. @param inScope
  1331. the scope - typically this is set to GlobalScope
  1332. @param inElement
  1333. the element - typically this is set to 0
  1334. @result noErr, or an audio unit error
  1335. }
  1336. function AudioUnitReset( inUnit: AudioUnit; inScope: AudioUnitScope; inElement: AudioUnitElement ): OSStatus; external name '_AudioUnitReset';
  1337. (* __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_2_0) *)
  1338. {!
  1339. @enum AudioUnitRange
  1340. @discussion the range of selectors that are used to dispatch through to the various audio
  1341. unit API
  1342. @constant kAudioUnitRange
  1343. @constant kAudioUnitInitializeSelect
  1344. @constant kAudioUnitUninitializeSelect
  1345. @constant kAudioUnitGetPropertyInfoSelect
  1346. @constant kAudioUnitGetPropertySelect
  1347. @constant kAudioUnitSetPropertySelect
  1348. @constant kAudioUnitAddPropertyListenerSelect
  1349. @constant kAudioUnitRemovePropertyListenerSelect
  1350. @constant kAudioUnitRemovePropertyListenerWithUserDataSelect
  1351. @constant kAudioUnitAddRenderNotifySelect
  1352. @constant kAudioUnitRemoveRenderNotifySelect
  1353. @constant kAudioUnitGetParameterSelect
  1354. @constant kAudioUnitSetParameterSelect
  1355. @constant kAudioUnitScheduleParametersSelect
  1356. @constant kAudioUnitRenderSelect
  1357. @constant kAudioUnitResetSelect
  1358. @constant kAudioUnitComplexRenderSelect
  1359. @constant kAudioUnitProcessSelect
  1360. @constant kAudioUnitProcessMultipleSelect
  1361. }
  1362. const
  1363. kAudioUnitRange = $0000; // range of selectors for audio units
  1364. kAudioUnitInitializeSelect = $0001;
  1365. kAudioUnitUninitializeSelect = $0002;
  1366. kAudioUnitGetPropertyInfoSelect = $0003;
  1367. kAudioUnitGetPropertySelect = $0004;
  1368. kAudioUnitSetPropertySelect = $0005;
  1369. kAudioUnitAddPropertyListenerSelect = $000A;
  1370. kAudioUnitRemovePropertyListenerSelect = $000B;
  1371. kAudioUnitRemovePropertyListenerWithUserDataSelect = $0012;
  1372. kAudioUnitAddRenderNotifySelect = $000F;
  1373. kAudioUnitRemoveRenderNotifySelect = $0010;
  1374. kAudioUnitGetParameterSelect = $0006;
  1375. kAudioUnitSetParameterSelect = $0007;
  1376. kAudioUnitScheduleParametersSelect = $0011;
  1377. kAudioUnitRenderSelect = $000E;
  1378. kAudioUnitResetSelect = $0009;
  1379. kAudioUnitComplexRenderSelect = $0013;
  1380. kAudioUnitProcessSelect = $0014;
  1381. kAudioUnitProcessMultipleSelect = $0015;
  1382. //================================================================================================
  1383. //#pragma mark -
  1384. //#pragma mark Dispatch function prototypes
  1385. type
  1386. AudioUnitInitializeProc = function( self: UnivPtr ): OSStatus;
  1387. type
  1388. AudioUnitUninitializeProc = function( self: UnivPtr ): OSStatus;
  1389. type
  1390. AudioUnitGetPropertyInfoProc = function( self: UnivPtr; prop: AudioUnitPropertyID; scope: AudioUnitScope; elem: AudioUnitElement; var outDataSize: UInt32; var outWritable: Boolean ): OSStatus;
  1391. type
  1392. AudioUnitGetPropertyProc = function( self: UnivPtr; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; outData: UnivPtr; var ioDataSize: UInt32 ): OSStatus;
  1393. type
  1394. AudioUnitSetPropertyProc = function( self: UnivPtr; inID: AudioUnitPropertyID; inScope: AudioUnitScope; inElement: AudioUnitElement; inData: {const} UnivPtr; inDataSize: UInt32 ): OSStatus;
  1395. type
  1396. AudioUnitAddPropertyListenerProc = function( self: UnivPtr; prop: AudioUnitPropertyID; proc: AudioUnitPropertyListenerProc; userData: UnivPtr ): OSStatus;
  1397. type
  1398. AudioUnitRemovePropertyListenerProc = function( self: UnivPtr; prop: AudioUnitPropertyID; proc: AudioUnitPropertyListenerProc ): OSStatus;
  1399. type
  1400. AudioUnitRemovePropertyListenerWithUserDataProc = function( self: UnivPtr; prop: AudioUnitPropertyID; proc: AudioUnitPropertyListenerProc; userData: UnivPtr ): OSStatus;
  1401. type
  1402. AudioUnitAddRenderNotifyProc = function( self: UnivPtr; proc: AURenderCallback; userData: UnivPtr ): OSStatus;
  1403. type
  1404. AudioUnitRemoveRenderNotifyProc = function( self: UnivPtr; proc: AURenderCallback; userData: UnivPtr ): OSStatus;
  1405. type
  1406. AudioUnitScheduleParametersProc = function( self: UnivPtr; const (*var*) events: AudioUnitParameterEvent; numEvents: UInt32 ): OSStatus;
  1407. type
  1408. AudioUnitResetProc = function( self: UnivPtr; inScope: AudioUnitScope; inElement: AudioUnitElement ): OSStatus;
  1409. type
  1410. AudioUnitComplexRenderProc = function( self: UnivPtr; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inOutputBusNumber: UInt32; inNumberOfPackets: UInt32; var outNumberOfPackets: UInt32; var outPacketDescriptions: AudioStreamPacketDescription; ioData: AudioBufferListPtr; outMetadata: UnivPtr; var outMetadataByteSize: UInt32 ): OSStatus;
  1411. type
  1412. AudioUnitProcessProc = function( self: UnivPtr; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inNumberFrames: UInt32; ioData: AudioBufferListPtr ): OSStatus;
  1413. type
  1414. AudioUnitProcessMultipleProc = function( self: UnivPtr; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inNumberFrames: UInt32; inNumberInputBufferLists: UInt32; {const} inInputBufferLists: AudioBufferListPtrPtr; inNumberOutputBufferLists: UInt32; ioOutputBufferLists: AudioBufferListPtrPtr ): OSStatus;
  1415. {!
  1416. @typedef AudioUnitGetParameterProc
  1417. @discussion This proc can be exported through the FastDispatch property or is used as the prototype for
  1418. an audio component dispatch for this selector.
  1419. The arguments are the same as are provided to the corresponding API call
  1420. @param inComponentStorage
  1421. For a component manager component, this is the component instance storage
  1422. pointer
  1423. @param inID
  1424. @param inScope
  1425. @param inElement
  1426. @param outValue
  1427. }
  1428. type
  1429. AudioUnitGetParameterProc = function( inComponentStorage: UnivPtr; inID: AudioUnitParameterID; inScope: AudioUnitScope; inElement: AudioUnitElement; var outValue: AudioUnitParameterValue ): OSStatus;
  1430. {!
  1431. @typedef AudioUnitSetParameterProc
  1432. @discussion This proc can be exported through the FastDispatch property or is used as the prototype for
  1433. an audio component dispatch for this selector.
  1434. The arguments are the same as are provided to the corresponding API call
  1435. @param inComponentStorage
  1436. For a component manager component, this is the component instance storage
  1437. pointer
  1438. @param inID
  1439. @param inScope
  1440. @param inElement
  1441. @param inValue
  1442. @param inBufferOffsetInFrames
  1443. }
  1444. type
  1445. AudioUnitSetParameterProc = function( inComponentStorage: UnivPtr; inID: AudioUnitParameterID; inScope: AudioUnitScope; inElement: AudioUnitElement; inValue: AudioUnitParameterValue; inBufferOffsetInFrames: UInt32 ): OSStatus;
  1446. {!
  1447. @typedef AudioUnitRenderProc
  1448. @discussion This proc can be exported through the FastDispatch property or is used as the prototype for
  1449. an audio component dispatch for this selector.
  1450. The arguments are the same as are provided to the corresponding API call
  1451. @param inComponentStorage
  1452. For a component manager component, this is the component instance storage
  1453. pointer
  1454. @param ioActionFlags
  1455. @param inTimeStamp
  1456. @param inOutputBusNumber
  1457. @param inNumberFrames
  1458. @param ioData
  1459. }
  1460. type
  1461. AudioUnitRenderProc = function( inComponentStorage: UnivPtr; var ioActionFlags: AudioUnitRenderActionFlags; const (*var*) inTimeStamp: AudioTimeStamp; inOutputBusNumber: UInt32; inNumberFrames: UInt32; ioData: AudioBufferListPtr ): OSStatus;
  1462. //=====================================================================================================================
  1463. //#pragma mark -
  1464. //#pragma mark Deprecated
  1465. {!
  1466. @enum deprecated - Audio unit errors
  1467. @discussion These are the various errors that can be returned by AudioUnit... API calls
  1468. @constant kAudioUnitErr_IllegalInstrument
  1469. Apple's DLS synth returns this error if information about a particular
  1470. instrument patch is requested, but is not valid.
  1471. @constant kAudioUnitErr_InstrumentTypeNotFound
  1472. Apple's DLS synth returns this error if information about a particular
  1473. instrument patch is requested, but is not valid.
  1474. @constant kAudioUnitErr_UnknownFileType
  1475. If an audio unit uses external files as a data source, this error is returned
  1476. if a file is invalid (Apple's DLS synth returns this error)
  1477. @constant kAudioUnitErr_FileNotSpecified
  1478. If an audio unit uses external files as a data source, this error is returned
  1479. if a file hasn't been set on it
  1480. (Apple's DLS synth returns this error)
  1481. }
  1482. const
  1483. kAudioUnitErr_IllegalInstrument = -10873;
  1484. kAudioUnitErr_InstrumentTypeNotFound = -10872;
  1485. kAudioUnitErr_UnknownFileType = -10870;
  1486. kAudioUnitErr_FileNotSpecified = -10869;
  1487. //#if !__LP64__ && !TARGET_OS_IPHONE
  1488. {$ifc not TARGET_CPU_64 and not TARGET_OS_IPHONE}
  1489. // this call is deprecated and replaced by AudioUnitRemovePropertyListenerWithUserData
  1490. // this allows apps to use the same function pointer more than once
  1491. // you provide the same function ptr and user data as provided when you add a property listener
  1492. function AudioUnitRemovePropertyListener( inUnit: AudioUnit; inID: AudioUnitPropertyID; inProc: AudioUnitPropertyListenerProc ): OSStatus; external name '_AudioUnitRemovePropertyListener';
  1493. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  1494. //#endif
  1495. {$endc}
  1496. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  1497. end.
  1498. {$endc} {not MACOSALLINCLUDE}