AudioHardware.pas 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605
  1. {==================================================================================================
  2. File: CoreAudio/AudioHardware.h
  3. Contains: API for communicating with audio hardware.
  4. Copyright: (c) 1985-2011 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: Gale R Paeper, <[email protected]>, 2006 }
  10. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  11. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  12. {
  13. Modified for use with Free Pascal
  14. Version 308
  15. Please report any bugs to <[email protected]>
  16. }
  17. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  18. {$mode macpas}
  19. {$packenum 1}
  20. {$macro on}
  21. {$inline on}
  22. {$calling mwpascal}
  23. unit AudioHardware;
  24. interface
  25. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  26. {$setc GAP_INTERFACES_VERSION := $0308}
  27. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  28. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  29. {$endc}
  30. {$ifc defined CPUPOWERPC and defined CPUI386}
  31. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  32. {$endc}
  33. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  34. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  35. {$endc}
  36. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  37. {$setc __ppc__ := 1}
  38. {$elsec}
  39. {$setc __ppc__ := 0}
  40. {$endc}
  41. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  42. {$setc __ppc64__ := 1}
  43. {$elsec}
  44. {$setc __ppc64__ := 0}
  45. {$endc}
  46. {$ifc not defined __i386__ and defined CPUI386}
  47. {$setc __i386__ := 1}
  48. {$elsec}
  49. {$setc __i386__ := 0}
  50. {$endc}
  51. {$ifc not defined __x86_64__ and defined CPUX86_64}
  52. {$setc __x86_64__ := 1}
  53. {$elsec}
  54. {$setc __x86_64__ := 0}
  55. {$endc}
  56. {$ifc not defined __arm__ and defined CPUARM}
  57. {$setc __arm__ := 1}
  58. {$elsec}
  59. {$setc __arm__ := 0}
  60. {$endc}
  61. {$ifc not defined __arm64__ and defined CPUAARCH64}
  62. {$setc __arm64__ := 1}
  63. {$elsec}
  64. {$setc __arm64__ := 0}
  65. {$endc}
  66. {$ifc defined cpu64}
  67. {$setc __LP64__ := 1}
  68. {$elsec}
  69. {$setc __LP64__ := 0}
  70. {$endc}
  71. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  72. {$error Conflicting definitions for __ppc__ and __i386__}
  73. {$endc}
  74. {$ifc defined __ppc__ and __ppc__}
  75. {$setc TARGET_CPU_PPC := TRUE}
  76. {$setc TARGET_CPU_PPC64 := FALSE}
  77. {$setc TARGET_CPU_X86 := FALSE}
  78. {$setc TARGET_CPU_X86_64 := FALSE}
  79. {$setc TARGET_CPU_ARM := FALSE}
  80. {$setc TARGET_CPU_ARM64 := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_IPHONE := FALSE}
  83. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  84. {$setc TARGET_OS_EMBEDDED := FALSE}
  85. {$elifc defined __ppc64__ and __ppc64__}
  86. {$setc TARGET_CPU_PPC := FALSE}
  87. {$setc TARGET_CPU_PPC64 := TRUE}
  88. {$setc TARGET_CPU_X86 := FALSE}
  89. {$setc TARGET_CPU_X86_64 := FALSE}
  90. {$setc TARGET_CPU_ARM := FALSE}
  91. {$setc TARGET_CPU_ARM64 := FALSE}
  92. {$setc TARGET_OS_MAC := TRUE}
  93. {$setc TARGET_OS_IPHONE := FALSE}
  94. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  95. {$setc TARGET_OS_EMBEDDED := FALSE}
  96. {$elifc defined __i386__ and __i386__}
  97. {$setc TARGET_CPU_PPC := FALSE}
  98. {$setc TARGET_CPU_PPC64 := FALSE}
  99. {$setc TARGET_CPU_X86 := TRUE}
  100. {$setc TARGET_CPU_X86_64 := FALSE}
  101. {$setc TARGET_CPU_ARM := FALSE}
  102. {$setc TARGET_CPU_ARM64 := FALSE}
  103. {$ifc defined(iphonesim)}
  104. {$setc TARGET_OS_MAC := FALSE}
  105. {$setc TARGET_OS_IPHONE := TRUE}
  106. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  107. {$elsec}
  108. {$setc TARGET_OS_MAC := TRUE}
  109. {$setc TARGET_OS_IPHONE := FALSE}
  110. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  111. {$endc}
  112. {$setc TARGET_OS_EMBEDDED := FALSE}
  113. {$elifc defined __x86_64__ and __x86_64__}
  114. {$setc TARGET_CPU_PPC := FALSE}
  115. {$setc TARGET_CPU_PPC64 := FALSE}
  116. {$setc TARGET_CPU_X86 := FALSE}
  117. {$setc TARGET_CPU_X86_64 := TRUE}
  118. {$setc TARGET_CPU_ARM := FALSE}
  119. {$setc TARGET_CPU_ARM64 := FALSE}
  120. {$setc TARGET_OS_MAC := TRUE}
  121. {$setc TARGET_OS_IPHONE := FALSE}
  122. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  123. {$setc TARGET_OS_EMBEDDED := FALSE}
  124. {$elifc defined __arm__ and __arm__}
  125. {$setc TARGET_CPU_PPC := FALSE}
  126. {$setc TARGET_CPU_PPC64 := FALSE}
  127. {$setc TARGET_CPU_X86 := FALSE}
  128. {$setc TARGET_CPU_X86_64 := FALSE}
  129. {$setc TARGET_CPU_ARM := TRUE}
  130. {$setc TARGET_CPU_ARM64 := FALSE}
  131. { will require compiler define when/if other Apple devices with ARM cpus ship }
  132. {$setc TARGET_OS_MAC := FALSE}
  133. {$setc TARGET_OS_IPHONE := TRUE}
  134. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  135. {$setc TARGET_OS_EMBEDDED := TRUE}
  136. {$elifc defined __arm64__ and __arm64__}
  137. {$setc TARGET_CPU_PPC := FALSE}
  138. {$setc TARGET_CPU_PPC64 := FALSE}
  139. {$setc TARGET_CPU_X86 := FALSE}
  140. {$setc TARGET_CPU_X86_64 := FALSE}
  141. {$setc TARGET_CPU_ARM := FALSE}
  142. {$setc TARGET_CPU_ARM64 := TRUE}
  143. { will require compiler define when/if other Apple devices with ARM cpus ship }
  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. {$elsec}
  149. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  150. {$endc}
  151. {$ifc defined __LP64__ and __LP64__ }
  152. {$setc TARGET_CPU_64 := TRUE}
  153. {$elsec}
  154. {$setc TARGET_CPU_64 := FALSE}
  155. {$endc}
  156. {$ifc defined FPC_BIG_ENDIAN}
  157. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  158. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  159. {$elifc defined FPC_LITTLE_ENDIAN}
  160. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  161. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  162. {$elsec}
  163. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  164. {$endc}
  165. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  166. {$setc CALL_NOT_IN_CARBON := FALSE}
  167. {$setc OLDROUTINENAMES := FALSE}
  168. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  169. {$setc OPAQUE_UPP_TYPES := TRUE}
  170. {$setc OTCARBONAPPLICATION := TRUE}
  171. {$setc OTKERNEL := FALSE}
  172. {$setc PM_USE_SESSION_APIS := TRUE}
  173. {$setc TARGET_API_MAC_CARBON := TRUE}
  174. {$setc TARGET_API_MAC_OS8 := FALSE}
  175. {$setc TARGET_API_MAC_OSX := TRUE}
  176. {$setc TARGET_CARBON := TRUE}
  177. {$setc TARGET_CPU_68K := FALSE}
  178. {$setc TARGET_CPU_MIPS := FALSE}
  179. {$setc TARGET_CPU_SPARC := FALSE}
  180. {$setc TARGET_OS_UNIX := FALSE}
  181. {$setc TARGET_OS_WIN32 := FALSE}
  182. {$setc TARGET_RT_MAC_68881 := FALSE}
  183. {$setc TARGET_RT_MAC_CFM := FALSE}
  184. {$setc TARGET_RT_MAC_MACHO := TRUE}
  185. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  186. {$setc TYPE_BOOL := FALSE}
  187. {$setc TYPE_EXTENDED := FALSE}
  188. {$setc TYPE_LONGLONG := TRUE}
  189. uses MacTypes, CFRunLoop, CoreAudioTypes, AudioHardwareBase;
  190. {$endc} {not MACOSALLINCLUDE}
  191. {$ALIGN POWER}
  192. //==================================================================================================
  193. //#pragma mark Overview
  194. {!
  195. @header AudioHardware
  196. The audio HAL provides an abstraction through which applications can access audio hardware. To
  197. do this, the HAL provides a small set of AudioObjects that provide access to the various pieces
  198. of the system.
  199. AudioObjects all have a set of properties that describe and manipulate their state. A property
  200. is accessed via an ordered triple. The first ordinate is the selector which describes the
  201. property. The other two ordinates are the scope and element that identify the particular part of
  202. the object in which to look for the selector. The AudioObjectPropertyAddress structure
  203. encapsulates the property address. The value of a property is an untyped block of data whose
  204. content depends on the specifics of the selector. Some selectors also require the use of a
  205. qualifier when querying. The qualifier allows for additional information to be provided to be
  206. used in the manipulation of the property. Changing the value of a property is always considered
  207. asynchronous.
  208. Applications use the routines AudioObjectHasProperty(), AudioObjectIsPropertySettable() and
  209. AudioObjectGetPropertyDataSize() to find useful meta-information about the property. Apps use
  210. AudioObjectGetPropertyData() and AudioObjectSetPropertyData() to manipulate the value of the
  211. property. Apps use AudioObjectAddPropertyListener() and AudioObjectRemovePropertyListener() to
  212. register/unregister a function that is to be called when a given property's value changes.
  213. The class of an AudioObject determines the basic functionality of the object in terms of what
  214. functions will operate on it as well as the set of properties that can be expected to be
  215. implemented by the object. The set of available classes for objects is limited to those defined
  216. here. There are no other classes. The set of classes is arranged in a hierarchy such that one
  217. class inherits the properties/routines of it's super class.
  218. The base class for all AudioObjects is the class AudioObject. As such, each AudioObject will
  219. provide basic properties such as it's class, it's human readable name, and the other
  220. AudioObjects it contains. Other important classes include AudioSystemObject, AudioDevice, and
  221. AudioStream.
  222. The AudioObjects in the HAL are arranged in a containment hierarchy. The root of the hierarchy
  223. is the one and only instance of the AudioSystemObject class. The properties of the
  224. AudioSystemObject describe the process global settings such as the various default devices and
  225. the notification run loop. The AudioSystemObject also contains all the AudioDevices that are
  226. available.
  227. Instances of the AudioDevice class encapsulate individual audio devices. An AudioDevice serves
  228. as the basic unit of IO. It provides a single IO cycle, a timing source based on it, and all the
  229. buffers synchronized to it. The IO cycle presents all the synchronized buffers to the client in
  230. the same call out along with time stamps that specify the current time, when the input data was
  231. acquired and when the output data will be presented.
  232. AudioDevices contain instances of the AudioStream class. An AudioStream represents a single
  233. buffer of data for transferring across the user/kernel boundary. As such, AudioStreams are the
  234. gatekeepers of format information. Each has it's own format and list of available formats.
  235. AudioStreams can provide data in any format, including encoded formats and non-audio formats. If
  236. the format is a linear PCM format, the data will always be presented as 32 bit, native endian
  237. floating point. All conversions to and from the true physical format of the hardware is handled
  238. by the device's driver.
  239. Both AudioDevices and AudioStreams can contain instances of the AudioControl class or it's many
  240. subclasses. An AudioControl provides properties that describe/manipulate a particular aspect of
  241. the object such as gain, mute, data source selection, etc. Many common controls are also
  242. also available as properties on the AudioDevice or AudioStream.
  243. }
  244. //==================================================================================================
  245. // Includes
  246. //==================================================================================================
  247. //#if PRAGMA_ENUM_ALWAYSINT
  248. // #pragma enumsalwaysint off
  249. //#endif
  250. //==================================================================================================
  251. //#pragma mark Basic Constants
  252. {!
  253. @enum Predefined AudioObjectID values
  254. @abstract ObjectIDs that are always the same
  255. @constant kAudioObjectSystemObject
  256. The AudioObjectID that always refers to the one and only instance of the
  257. AudioSystemObject class.
  258. }
  259. const
  260. kAudioObjectSystemObject = 1;
  261. //==================================================================================================
  262. //#pragma mark -
  263. //#pragma mark AudioObject Types
  264. {!
  265. @typedef AudioObjectPropertyListenerProc
  266. @abstract Clients register an AudioObjectPropertyListenerProc with an AudioObject in order
  267. to receive notifications when the properties of the object change.
  268. @discussion Listeners will be called when possibly many properties have changed.
  269. Consequently, the implementation of a listener must go through the array of
  270. addresses to see what exactly has changed. Note that the array of addresses will
  271. always have at least one address in it for which the listener is signed up to
  272. receive notifications about but may contain addresses for properties for which
  273. the listener is not signed up to receive notifications.
  274. @param inObjectID
  275. The AudioObject whose properties have changed.
  276. @param inNumberAddresses
  277. The number of elements in the inAddresses array.
  278. @param inAddresses
  279. An array of AudioObjectPropertyAddresses indicating which properties
  280. changed.
  281. @param inClientData
  282. A pointer to client data established when the listener proc was registered
  283. with the AudioObject.
  284. @result The return value is currently unused and should always be 0.
  285. }
  286. type
  287. AudioObjectPropertyListenerProc = function( inObjectID: AudioObjectID; inNumberAddresses: UInt32; {const} inAddresses: {variable-size-array} AudioObjectPropertyAddressPtr; inClientData: UnivPtr ): OSStatus;
  288. //==================================================================================================
  289. //#pragma mark AudioObject Properties
  290. {!
  291. @enum AudioObject Property Selectors
  292. @abstract AudioObjectPropertySelector values provided by objects of the AudioObject class.
  293. @discussion The AudioObject class is the base class for all classes. As such, all classes
  294. inherit this set of properties.
  295. @constant kAudioObjectPropertyCreator
  296. A CFString that contains the bundle ID of the plug-in that instantiated the
  297. object. The caller is responsible for releasing the returned CFObject.
  298. @constant kAudioObjectPropertyListenerAdded
  299. An AudioObjectPropertyAddress indicating the address to which a new listener
  300. was added. Note that this property is not for applications to use. Rather,
  301. this property is for the HAL shell to notify AudioObjects implemented by an
  302. AudioPlugIn when a listener is added.
  303. @constant kAudioObjectPropertyListenerRemoved
  304. An AudioObjectPropertyAddress indicating the address to which a listener was
  305. removed. Note that this property is not for applications to use. Rather,
  306. this property is for the HAL shell to notify AudioObjects implemented by an
  307. AudioPlugIn when a listener is removed.
  308. }
  309. const
  310. kAudioObjectPropertyCreator = FourCharCode('oplg');
  311. kAudioObjectPropertyListenerAdded = FourCharCode('lisa');
  312. kAudioObjectPropertyListenerRemoved = FourCharCode('lisr');
  313. //==================================================================================================
  314. //#pragma mark AudioObject Functions
  315. {!
  316. @functiongroup AudioObject
  317. }
  318. {!
  319. @function AudioObjectShow
  320. @abstract Prints to standard out a textural description of the AudioObject.
  321. @param inObjectID
  322. The AudioObject to show.
  323. }
  324. procedure AudioObjectShow( inObjectID: AudioObjectID ); external name '_AudioObjectShow';
  325. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  326. {!
  327. @function AudioObjectHasProperty
  328. @abstract Queries an AudioObject about whether or not it has the given property.
  329. @param inObjectID
  330. The AudioObject to query.
  331. @param inAddress
  332. An AudioObjectPropertyAddress indicating which property is being queried.
  333. @result A Boolean indicating whether or not the AudioObject has the given property.
  334. }
  335. function AudioObjectHasProperty( inObjectID: AudioObjectID; const (*var*) inAddress: AudioObjectPropertyAddress ): Boolean; external name '_AudioObjectHasProperty';
  336. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  337. {!
  338. @function AudioObjectIsPropertySettable
  339. @abstract Queries an AudioObject about whether or not the given property can be set using
  340. AudioObjectSetPropertyData.
  341. @param inObjectID
  342. The AudioObject to query.
  343. @param inAddress
  344. An AudioObjectPropertyAddress indicating which property is being queried.
  345. @param outIsSettable
  346. A Boolean indicating whether or not the property can be set.
  347. @result An OSStatus indicating success or failure.
  348. }
  349. function AudioObjectIsPropertySettable( inObjectID: AudioObjectID; const (*var*) inAddress: AudioObjectPropertyAddress; var outIsSettable: Boolean ): OSStatus; external name '_AudioObjectIsPropertySettable';
  350. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  351. {!
  352. @function AudioObjectGetPropertyDataSize
  353. @abstract Queries an AudioObject to find the size of the data for the given property.
  354. @param inObjectID
  355. The AudioObject to query.
  356. @param inAddress
  357. An AudioObjectPropertyAddress indicating which property is being queried.
  358. @param inQualifierDataSize
  359. A UInt32 indicating the size of the buffer pointed to by inQualifierData.
  360. Note that not all properties require qualification, in which case this
  361. value will be 0.
  362. @param inQualifierData,
  363. A buffer of data to be used in determining the data of the property being
  364. queried. Note that not all properties require qualification, in which case
  365. this value will be NULL.
  366. @param outDataSize
  367. A UInt32 indicating how many bytes the data for the given property occupies.
  368. @result An OSStatus indicating success or failure.
  369. }
  370. function AudioObjectGetPropertyDataSize( inObjectID: AudioObjectID; const (*var*) inAddress: AudioObjectPropertyAddress; inQualifierDataSize: UInt32; inQualifierData: {const} UnivPtr; var outDataSize: UInt32 ): OSStatus; external name '_AudioObjectGetPropertyDataSize';
  371. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  372. {!
  373. @function AudioObjectGetPropertyData
  374. @abstract Queries an AudioObject to get the data of the given property and places it in
  375. the provided buffer.
  376. @param inObjectID
  377. The AudioObject to query.
  378. @param inAddress
  379. An AudioObjectPropertyAddress indicating which property is being queried.
  380. @param inQualifierDataSize
  381. A UInt32 indicating the size of the buffer pointed to by inQualifierData.
  382. Note that not all properties require qualification, in which case this
  383. value will be 0.
  384. @param inQualifierData,
  385. A buffer of data to be used in determining the data of the property being
  386. queried. Note that not all properties require qualification, in which case
  387. this value will be NULL.
  388. @param ioDataSize
  389. A UInt32 which on entry indicates the size of the buffer pointed to by
  390. outData and on exit indicates how much of the buffer was used.
  391. @param outData
  392. The buffer into which the AudioObject will put the data for the given
  393. property.
  394. @result An OSStatus indicating success or failure.
  395. }
  396. function AudioObjectGetPropertyData( inObjectID: AudioObjectID; const (*var*) inAddress: AudioObjectPropertyAddress; inQualifierDataSize: UInt32; inQualifierData: {const} UnivPtr; var ioDataSize: UInt32; outData: UnivPtr ): OSStatus; external name '_AudioObjectGetPropertyData';
  397. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  398. {!
  399. @function AudioObjectSetPropertyData
  400. @abstract Tells an AudioObject to change the value of the given property using the
  401. provided data.
  402. @discussion Note that the value of the property should not be considered changed until the
  403. HAL has called the listeners as many properties values are changed
  404. asynchronously.
  405. @param inObjectID
  406. The AudioObject to change.
  407. @param inAddress
  408. An AudioObjectPropertyAddress indicating which property is being changed.
  409. @param inQualifierDataSize
  410. A UInt32 indicating the size of the buffer pointed to by inQualifierData.
  411. Note that not all properties require qualification, in which case this
  412. value will be 0.
  413. @param inQualifierData,
  414. A buffer of data to be used in determining the data of the property being
  415. queried. Note that not all properties require qualification, in which case
  416. this value will be NULL.
  417. @param inDataSize
  418. A UInt32 indicating the size of the buffer pointed to by inData.
  419. @param inData
  420. The buffer containing the data to be used to change the property's value.
  421. @result An OSStatus indicating success or failure.
  422. }
  423. function AudioObjectSetPropertyData( inObjectID: AudioObjectID; const (*var*) inAddress: AudioObjectPropertyAddress; inQualifierDataSize: UInt32; inQualifierData: {const} UnivPtr; inDataSize: UInt32; inData: {const} UnivPtr ): OSStatus; external name '_AudioObjectSetPropertyData';
  424. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  425. {!
  426. @function AudioObjectAddPropertyListener
  427. @abstract Registers the given AudioObjectPropertyListenerProc to receive notifications
  428. when the given properties change.
  429. @param inObjectID
  430. The AudioObject to register the listener with.
  431. @param inAddress
  432. The AudioObjectPropertyAddresses indicating which property the listener
  433. should be notified about.
  434. @param inListener
  435. The AudioObjectPropertyListenerProc to call.
  436. @param inClientData
  437. A pointer to client data that is passed to the listener when it is called.
  438. @result An OSStatus indicating success or failure.
  439. }
  440. function AudioObjectAddPropertyListener( inObjectID: AudioObjectID; const (*var*) inAddress: AudioObjectPropertyAddress; inListener: AudioObjectPropertyListenerProc; inClientData: UnivPtr ): OSStatus; external name '_AudioObjectAddPropertyListener';
  441. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  442. {!
  443. @function AudioObjectRemovePropertyListener
  444. @abstract Unregisters the given AudioObjectPropertyListenerProc from receiving
  445. notifications when the given properties change.
  446. @param inObjectID
  447. The AudioObject to unregister the listener from.
  448. @param inNumberAddresses
  449. The number of elements in the inAddresses array.
  450. @param inAddresses
  451. The AudioObjectPropertyAddress indicating which property the listener should
  452. be removed from.
  453. @param inListener
  454. The AudioObjectPropertyListenerProc being removed.
  455. @param inClientData
  456. A pointer to client data that is passed to the listener when it is called.
  457. @result An OSStatus indicating success or failure.
  458. }
  459. function AudioObjectRemovePropertyListener( inObjectID: AudioObjectID; const (*var*) inAddress: AudioObjectPropertyAddress; inListener: AudioObjectPropertyListenerProc; inClientData: UnivPtr ): OSStatus; external name '_AudioObjectRemovePropertyListener';
  460. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) *)
  461. //==================================================================================================
  462. //#pragma mark AudioSystemObject Constants
  463. {!
  464. @enum AudioSystemObject Class Constants
  465. @abstract Various constants related to the AudioSystemObject class.
  466. @discussion Note that there is only ever one instance of the AudioSystemObject class and it
  467. is available via the AudioObjectID, kAudioObjectSystemObject.
  468. @constant kAudioSystemObjectClassID
  469. The AudioClassID that identifies the AudioSystemObject class.
  470. }
  471. const
  472. kAudioSystemObjectClassID = FourCharCode('asys');
  473. //==================================================================================================
  474. //#pragma mark AudioSystemObject Properties
  475. {!
  476. @enum AudioSystemObject Properties
  477. @abstract AudioObjectPropertySelector values provided by the AudioSystemObject class.
  478. @discussion The AudioSystemObject class is a subclass of the AudioObject class. the class
  479. has just the global scope, kAudioObjectPropertyScopeGlobal, and only a master element.
  480. @constant kAudioHardwarePropertyDevices
  481. An array of the AudioObjectIDs that represent all the devices currently
  482. available to the system.
  483. @constant kAudioHardwarePropertyDefaultInputDevice
  484. The AudioObjectID of the default input AudioDevice.
  485. @constant kAudioHardwarePropertyDefaultOutputDevice
  486. The AudioObjectID of the default output AudioDevice.
  487. @constant kAudioHardwarePropertyDefaultSystemOutputDevice
  488. The AudioObjectID of the output AudioDevice to use for system related sound
  489. from the alert sound to digital call progress.
  490. @constant kAudioHardwarePropertyTranslateUIDToDevice
  491. This property fetches the AudioObjectID that corresponds to the AudioDevice
  492. that has the given UID. The UID is passed in via the qualifier as a CFString
  493. while the AudioObjectID for the AudioDevice is returned to the caller as the
  494. property's data. Note that an error is not returned if the UID doesn't refer
  495. to any AudioDevices. Rather, this property will return kAudioObjectUnknown
  496. as the value of the property.
  497. @constant kAudioHardwarePropertyMixStereoToMono
  498. A UInt32 where a value other than 0 indicates that AudioDevices should mix
  499. stereo signals down to mono. Note that the two channels on the device that
  500. comprise the stereo signal are defined on the device by
  501. kAudioDevicePropertyPreferredChannelsForStereo.
  502. @constant kAudioHardwarePropertyTransportManagerList
  503. An array of the AudioObjectIDs for all the AudioTransportManager objects.
  504. @constant kAudioHardwarePropertyTranslateBundleIDToTransportManager
  505. This property fetches the AudioObjectID that corresponds to the
  506. AudioTransportManager whose bundle has the given bundle ID. The bundle ID is
  507. passed in via the qualifier as a CFString while the AudioObjectID for the
  508. AudioTransportManager is returned to the caller as the property's data. Note
  509. that an error is not returned if the bundle ID doesn't refer to any
  510. AudioTransportManagers. Rather, this property will return
  511. kAudioObjectUnknown as the value of the property.
  512. @constant kAudioHardwarePropertyProcessIsMaster
  513. A UInt32 where 1 means that the current process contains the master instance
  514. of the HAL. The master instance of the HAL is the only instance in which
  515. plug-ins should save/restore their devices' settings.
  516. @constant kAudioHardwarePropertyIsInitingOrExiting
  517. A UInt32 whose value will be non-zero if the HAL is either in the midst of
  518. initializing or in the midst of exiting the process.
  519. @constant kAudioHardwarePropertyUserIDChanged
  520. This property exists so that clients can tell the HAL when they are changing
  521. the effective user ID of the process. The way it works is that a client will
  522. set the value of this property and the HAL will flush all its cached per-
  523. user preferences such as the default devices. The value of this property is
  524. a UInt32, but it's value has no currently defined meaning and clients may
  525. pass any value when setting it to trigger the cache flush.
  526. @constant kAudioHardwarePropertyProcessIsAudible
  527. A UInt32 where a non-zero value indicates that the audio of the process will
  528. be heard. A value of 0 indicates that all audio in the process will not be
  529. heard.
  530. @constant kAudioHardwarePropertySleepingIsAllowed
  531. A UInt32 where 1 means that the process will allow the CPU to idle sleep
  532. even if there is audio IO in progress. A 0 means that the CPU will not be
  533. allowed to idle sleep. Note that this property won't affect when the CPU is
  534. forced to sleep.
  535. @constant kAudioHardwarePropertyUnloadingIsAllowed
  536. A UInt32 where 1 means that this process wants the HAL to unload itself
  537. after a period of inactivity where there are no IOProcs and no listeners
  538. registered with any AudioObject.
  539. @constant kAudioHardwarePropertyHogModeIsAllowed
  540. A UInt32 where 1 means that this process wants the HAL to automatically take
  541. hog mode and 0 means that the HAL should not automatically take hog mode on
  542. behalf of the process. Processes that only ever use the default device are
  543. the sort of that should set this property's value to 0.
  544. @constant kAudioHardwarePropertyPlugInForBundleID
  545. Using an AudioValueTranslation structure, this property translates the input
  546. CFString containing a bundle ID into the AudioObjectID of the AudioPlugIn
  547. that corresponds to it. This property will return kAudioObjectUnkown if the
  548. given bundle ID doesn't match any AudioPlugIns.
  549. @constant kAudioHardwarePropertyUserSessionIsActiveOrHeadless
  550. A UInt32 where a value other than 0 indicates that the login session of the
  551. user of the process is either an active console session or a headless
  552. session.
  553. @constant kAudioHardwarePropertyServiceRestarted
  554. A UInt32 whose value has no meaning. Rather, this property exists so that
  555. clients can be informed when the service has been reset for some reason.
  556. When a reset happens, any state the client has , such as cached data or
  557. added listeners, must be re-established by the client.
  558. }
  559. const
  560. kAudioHardwarePropertyDevices = FourCharCode('dev#');
  561. kAudioHardwarePropertyDefaultInputDevice = FourCharCode('dIn ');
  562. kAudioHardwarePropertyDefaultOutputDevice = FourCharCode('dOut');
  563. kAudioHardwarePropertyDefaultSystemOutputDevice = FourCharCode('sOut');
  564. kAudioHardwarePropertyTranslateUIDToDevice = FourCharCode('uidd');
  565. kAudioHardwarePropertyMixStereoToMono = FourCharCode('stmo');
  566. kAudioHardwarePropertyTransportManagerList = FourCharCode('tmg#');
  567. kAudioHardwarePropertyTranslateBundleIDToTransportManager = FourCharCode('tmbi');
  568. kAudioHardwarePropertyProcessIsMaster = FourCharCode('mast');
  569. kAudioHardwarePropertyIsInitingOrExiting = FourCharCode('inot');
  570. kAudioHardwarePropertyUserIDChanged = FourCharCode('euid');
  571. kAudioHardwarePropertyProcessIsAudible = FourCharCode('pmut');
  572. kAudioHardwarePropertySleepingIsAllowed = FourCharCode('slep');
  573. kAudioHardwarePropertyUnloadingIsAllowed = FourCharCode('unld');
  574. kAudioHardwarePropertyHogModeIsAllowed = FourCharCode('hogr');
  575. kAudioHardwarePropertyPlugInForBundleID = FourCharCode('pibi');
  576. kAudioHardwarePropertyUserSessionIsActiveOrHeadless = FourCharCode('user');
  577. kAudioHardwarePropertyServiceRestarted = FourCharCode('srst');
  578. //==================================================================================================
  579. //#pragma mark AudioSystemObject Functions
  580. {!
  581. @functiongroup AudioSystemObject
  582. }
  583. {!
  584. @function AudioHardwareUnload
  585. @abstract When this routine is called, all IO on all devices within a process will be
  586. terminated and all resources capable of being released will be released. This
  587. routine essentially returns the HAL to its uninitialized state.
  588. @result An OSStatus indicating success or failure.
  589. }
  590. function AudioHardwareUnload: OSStatus; external name '_AudioHardwareUnload';
  591. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0) *)
  592. //==================================================================================================
  593. //#pragma mark AudioPlugIn Properties
  594. {!
  595. @enum AudioPlugIn Properties
  596. @abstract AudioObjectPropertySelector values provided by the AudioPlugIn class.
  597. @discussion The AudioPlugIn class is a subclass of the AudioObject class. the class has just
  598. the global scope, kAudioObjectPropertyScopeGlobal, and only a master element.
  599. @constant kAudioPlugInCreateAggregateDevice
  600. This property is used to tell a plug-in to create a new
  601. AudioAggregateDevice. It's value is only read. The qualifier data for this
  602. property is a CFDictionary containing a description of the
  603. AudioAggregateDevice to create. The keys for the CFDictionary are defined in
  604. the AudioAggregateDevice Constants section. The value of the property that
  605. gets returned is the AudioObjectID of the newly created device.
  606. @constant kAudioPlugInDestroyAggregateDevice
  607. This property is used to tell a plug-in to destroy an AudioAggregateDevice.
  608. Like kAudioPlugInCreateAggregateDevice, this property is read only. The
  609. value of the property is the AudioObjectID of the AudioAggregateDevice to
  610. destroy.
  611. }
  612. const
  613. kAudioPlugInCreateAggregateDevice = FourCharCode('cagg');
  614. kAudioPlugInDestroyAggregateDevice = FourCharCode('dagg');
  615. //==================================================================================================
  616. //#pragma mark AudioDevice Types
  617. {!
  618. @enum AudioTransportManager Properties
  619. @abstract AudioObjectPropertySelector values provided by the AudioTransportManager class.
  620. @discussion The AudioTransportManager class is a subclass of the AudioPlugIn class. The
  621. class has just the global scope, kAudioObjectPropertyScopeGlobal, and only a
  622. master element.
  623. @constant kAudioTransportManagerCreateEndPointDevice
  624. This property is used to tell a transport manager to create a new
  625. AudioDevice. It's value is only read. The qualifier data for this
  626. property is a CFDictionary containing a description of the
  627. AudioDevice to create. The standard keys for the CFDictionary are defined in
  628. the AudioEndPointDevice Constants section. The value of the property that
  629. gets returned is the AudioObjectID of the newly created device.
  630. @constant kAudioTransportManagerDestroyEndPointDevice
  631. This property is used to tell a transport manager to destroy an AudioDevice.
  632. Like kAudioTransportManagerCreateDevice, this property is read only. The
  633. value of the property is the AudioObjectID of the AudioAggregateDevice to
  634. destroy.
  635. }
  636. const
  637. kAudioTransportManagerCreateEndPointDevice = FourCharCode('cdev');
  638. kAudioTransportManagerDestroyEndPointDevice = FourCharCode('ddev');
  639. //==================================================================================================
  640. //#pragma mark -
  641. //#pragma mark AudioDevice Types
  642. {!
  643. @typedef AudioDeviceIOProc
  644. @abstract An AudioDeviceIOProc is called by an AudioDevice to provide input data read from
  645. the device and collect output data to be written to the device for the current
  646. IO cycle.
  647. @param inDevice
  648. The AudioDevice doing the IO.
  649. @param inNow
  650. An AudioTimeStamp that indicates the IO cycle started. Note that this time
  651. includes any scheduling latency that may have been incurred waking the
  652. thread on which IO is being done.
  653. @param inInputData
  654. An AudioBufferList containing the input data for the current IO cycle. For
  655. streams that are disabled, the AudioBuffer's mData field will be NULL but
  656. the mDataByteSize field will still say how much data would have been there
  657. if it was enabled. Note that the contents of this structure should never be
  658. modified.
  659. @param inInputTime
  660. An AudioTimeStamp that indicates the time at which the first frame in the
  661. data was acquired from the hardware. If the device has no input streams, the
  662. time stamp will be zeroed out.
  663. @param outOutputData
  664. An AudioBufferList in which the output data for the current IO cycle is to
  665. be placed. On entry, each AudioBuffer's mDataByteSize field indicates the
  666. maximum amount of data that can be placed in the buffer and the buffer's
  667. memory has been zeroed out. For formats where the number of bytes per packet
  668. can vary (as with AC-3, for example), the client has to fill out on exit
  669. each mDataByteSize field in each AudioBuffer with the amount of data that
  670. was put in the buffer. Otherwise, the mDataByteSize field should not be
  671. changed. For streams that are disabled, the AudioBuffer's mData field will
  672. be NULL but the mDataByteSize field will still say how much data would have
  673. been there if it was enabled. Except as noted above, the contents of this
  674. structure should not other wise be modified.
  675. @param inOutputTime
  676. An AudioTimeStamp that indicates the time at which the first frame in the
  677. data will be passed to the hardware. If the device has no output streams,
  678. the time stamp will be zeroed out.
  679. @param inClientData
  680. A pointer to client data established when the AudioDeviceIOProc was
  681. registered with the AudioDevice.
  682. @result The return value is currently unused and should always be 0.
  683. }
  684. type
  685. AudioDeviceIOProc = function( inDevice: AudioObjectID; const (*var*) inNow: AudioTimeStamp; const (*var*) inInputData: AudioBufferList; const (*var*) inInputTime: AudioTimeStamp; var outOutputData: AudioBufferList; const (*var*) inOutputTime: AudioTimeStamp; inClientData: UnivPtr ): OSStatus;
  686. {!
  687. @typedef AudioDeviceIOProcID
  688. @abstract An AudioDeviceIOProcID represents both an IOProc and the client data that goes
  689. with it. Once created, an AudioDeviceIOProcID can be used everywhere one would
  690. use a regular IOProc. The purpose for an AudioDeviceIOProcID is to allow a
  691. client to register the same function pointer as an IOProc with a device multiple
  692. times provided
  693. }
  694. type
  695. AudioDeviceIOProcID = AudioDeviceIOProc;
  696. {!
  697. @struct AudioHardwareIOProcStreamUsage
  698. @abstract This structure describes which streams a given AudioDeviceIOProc will use. It is
  699. used in conjunction with kAudioDevicePropertyIOProcStreamUsage.
  700. @field mIOProc
  701. The IOProc whose stream usage is being specified.
  702. @field mNumberStreams
  703. The number of streams being specified.
  704. @field mStreamIsOn
  705. An array of UInt32's whose length is specified by mNumberStreams. Each
  706. element of the array corresponds to a stream. A value of 0 means the stream
  707. is not to be enabled. Any other value means the stream is to be used.
  708. }
  709. type
  710. AudioHardwareIOProcStreamUsage = record
  711. mIOProc: UnivPtr;
  712. mNumberStreams: UInt32;
  713. mStreamIsOn: array[0..0] of UInt32;
  714. end;
  715. //==================================================================================================
  716. //#pragma mark AudioDevice Constants
  717. {!
  718. @enum StartAtTime/GetNearestStartTime Flags
  719. @abstract The flags that can be passed to control the behavior of AudioDeviceStartAtTime()
  720. andAudioDeviceGetNearestStartTime().
  721. @constant kAudioDeviceStartTimeIsInputFlag
  722. Set to indicate that the requested time refers to an input time. Clear to
  723. indicate that it is an output time.
  724. @constant kAudioDeviceStartTimeDontConsultDeviceFlag
  725. Set to indicate that the device should not be consulted when determining the
  726. start time. Clear to indicate that the device should be consulted. This flag
  727. cannot be set if kAudioDeviceStartTimeDontConsultHALFlag is set.
  728. @constant kAudioDeviceStartTimeDontConsultHALFlag
  729. Set to indicate that the HAL should not be consulted when determining the
  730. start time. Clear to indicate that the HAL should be consulted. This flag
  731. cannot be set if kAudioDeviceStartTimeDontConsultDeviceFlag is set.
  732. }
  733. const
  734. kAudioDeviceStartTimeIsInputFlag = 1 shl 0;
  735. kAudioDeviceStartTimeDontConsultDeviceFlag = 1 shl 1;
  736. kAudioDeviceStartTimeDontConsultHALFlag = 1 shl 2;
  737. //==================================================================================================
  738. //#pragma mark AudioDevice Properties
  739. {!
  740. @enum AudioDevice Properties
  741. @abstract AudioObjectPropertySelector values provided by the AudioDevice class.
  742. @discussion The AudioDevice class is a subclass of the AudioObjectClass. The class has four
  743. scopes, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeInput,
  744. kAudioObjectPropertyScopeOutput, and kAudioObjectPropertyScopePlayThrough. The
  745. class has a master element and an element for each channel in each stream
  746. numbered according to the starting channel number of each stream.
  747. @constant kAudioDevicePropertyPlugIn
  748. An OSStatus that contains any error codes generated by loading the IOAudio
  749. driver plug-in for the AudioDevice or kAudioHardwareNoError if the plug-in
  750. loaded successfully. This property only exists for IOAudio-based
  751. AudioDevices whose driver has specified a plug-in to load.
  752. @constant kAudioDevicePropertyDeviceHasChanged
  753. The type of this property is a UInt32, but it's value has no meaning. This
  754. property exists so that clients can listen to it and be told when the
  755. configuration of the AudioDevice has changed in ways that cannot otherwise
  756. be conveyed through other notifications. In response to this notification,
  757. clients should re-evaluate everything they need to know about the device,
  758. particularly the layout and values of the controls.
  759. @constant kAudioDevicePropertyDeviceIsRunningSomewhere
  760. A UInt32 where 1 means that the AudioDevice is running in at least one
  761. process on the system and 0 means that it isn't running at all.
  762. @constant kAudioDeviceProcessorOverload
  763. A UInt32 where the value has no meaning. This property exists so that
  764. clients can be notified when the AudioDevice detects that an IO cycle has
  765. run past it's deadline. Note that the notification for this property is
  766. usually sent from the AudioDevice's IO thread.
  767. @constant kAudioDevicePropertyHogMode
  768. A pid_t indicating the process that currently owns exclusive access to the
  769. AudioDevice or a value of -1 indicating that the device is currently
  770. available to all processes. If the AudioDevice is in a non-mixable mode,
  771. the HAL will automatically take hog mode on behalf of the first process to
  772. start an IOProc.
  773. Note that when setting this property, the value passed in is ignored. If
  774. another process owns exclusive access, that remains unchanged. If the
  775. current process owns exclusive access, it is released and made available to
  776. all processes again. If no process has exclusive access (meaning the current
  777. value is -1), this process gains ownership of exclusive access. On return,
  778. the pid_t pointed to by inPropertyData will contain the new value of the
  779. property.
  780. @constant kAudioDevicePropertyBufferFrameSize
  781. A UInt32 whose value indicates the number of frames in the IO buffers.
  782. @constant kAudioDevicePropertyBufferFrameSizeRange
  783. An AudioValueRange indicating the minimum and maximum values, inclusive, for
  784. kAudioDevicePropertyBufferFrameSize.
  785. @constant kAudioDevicePropertyUsesVariableBufferFrameSizes
  786. A UInt32 that, if implemented by a device, indicates that the sizes of the
  787. buffers passed to an IOProc will vary by a small amount. The value of this
  788. property will indicate the largest buffer that will be passed and
  789. kAudioDevicePropertyBufferFrameSize will indicate the smallest buffer that
  790. will get passed to the IOProc. The usage of this property is narrowed to
  791. only allow for devices whose buffer sizes vary by small amounts greater than
  792. kAudioDevicePropertyBufferFrameSize. It is not intended to be a license for
  793. devices to be able to send buffers however they please. Rather, it is
  794. intended to allow for hardware whose natural rhythms lead to this necessity.
  795. @constant kAudioDevicePropertyIOCycleUsage
  796. A Float32 whose range is from 0 to 1. This value indicates how much of the
  797. client portion of the IO cycle the process will use. The client portion of
  798. the IO cycle is the portion of the cycle in which the device calls the
  799. IOProcs so this property does not the apply to the duration of the entire
  800. cycle.
  801. @constant kAudioDevicePropertyStreamConfiguration
  802. This property returns the stream configuration of the device in an
  803. AudioBufferList (with the buffer pointers set to NULL) which describes the
  804. list of streams and the number of channels in each stream. This corresponds
  805. to what will be passed into the IOProc.
  806. @constant kAudioDevicePropertyIOProcStreamUsage
  807. An AudioHardwareIOProcStreamUsage structure which details the stream usage
  808. of a given IO proc. If a stream is marked as not being used, the given
  809. IOProc will see a corresponding NULL buffer pointer in the AudioBufferList
  810. passed to it's IO proc. Note that the number of streams detailed in the
  811. AudioHardwareIOProcStreamUsage must include all the streams of that
  812. direction on the device. Also, when getting the value of the property, one
  813. must fill out the mIOProc field of the AudioHardwareIOProcStreamUsage with
  814. the address of the of the IOProc whose stream usage is to be retrieved.
  815. @constant kAudioDevicePropertyActualSampleRate
  816. A Float64 that indicates the current actual sample rate of the AudioDevice
  817. as measured by it's time stamps.
  818. }
  819. const
  820. kAudioDevicePropertyPlugIn = FourCharCode('plug');
  821. kAudioDevicePropertyDeviceHasChanged = FourCharCode('diff');
  822. kAudioDevicePropertyDeviceIsRunningSomewhere = FourCharCode('gone');
  823. kAudioDeviceProcessorOverload = FourCharCode('over');
  824. kAudioDevicePropertyHogMode = FourCharCode('oink');
  825. kAudioDevicePropertyBufferFrameSize = FourCharCode('fsiz');
  826. kAudioDevicePropertyBufferFrameSizeRange = FourCharCode('fsz#');
  827. kAudioDevicePropertyUsesVariableBufferFrameSizes = FourCharCode('vfsz');
  828. kAudioDevicePropertyIOCycleUsage = FourCharCode('ncyc');
  829. kAudioDevicePropertyStreamConfiguration = FourCharCode('slay');
  830. kAudioDevicePropertyIOProcStreamUsage = FourCharCode('suse');
  831. kAudioDevicePropertyActualSampleRate = FourCharCode('asrt');
  832. {!
  833. @enum AudioDevice Properties Implemented via AudioControl objects
  834. @abstract AudioObjectPropertySelector values for AudioDevice properties that are
  835. implemented by AudioControl objects.
  836. @discussion These properties are also accessible by locating the AudioControl object
  837. attached to the AudioDevice and using that object to access the properties of
  838. the control.
  839. @constant kAudioDevicePropertyJackIsConnected
  840. A UInt32 where a value of 0 means that there isn't anything plugged into the
  841. jack associated withe given element and scope. This property is implemented
  842. by an AudioJackControl, a subclass of AudioBooleanControl.
  843. @constant kAudioDevicePropertyVolumeScalar
  844. A Float32 that represents the value of the volume control. The range is
  845. between 0.0 and 1.0 (inclusive). Note that the set of all Float32 values
  846. between 0.0 and 1.0 inclusive is much larger than the set of actual values
  847. that the hardware can select. This means that the Float32 range has a many
  848. to one mapping with the underlying hardware values. As such, setting a
  849. scalar value will result in the control taking on the value nearest to what
  850. was set. This property is implemented by an AudioControl object that is a
  851. subclass of AudioVolumeControl.
  852. @constant kAudioDevicePropertyVolumeDecibels
  853. A Float32 that represents the value of the volume control in dB. Note that
  854. the set of all Float32 values in the dB range for the control is much larger
  855. than the set of actual values that the hardware can select. This means that
  856. the Float32 range has a many to one mapping with the underlying hardware
  857. values. As such, setting a dB value will result in the control taking on the
  858. value nearest to what was set. This property is implemented by an
  859. AudioControl object that is a subclass of AudioVolumeControl.
  860. @constant kAudioDevicePropertyVolumeRangeDecibels
  861. An AudioValueRange that contains the minimum and maximum dB values the
  862. control can have. This property is implemented by an AudioControl object
  863. that is a subclass of AudioVolumeControl.
  864. @constant kAudioDevicePropertyVolumeScalarToDecibels
  865. A Float32 that on input contains a scalar volume value for the and on exit
  866. contains the equivalent dB value. This property is implemented by an
  867. AudioControl object that is a subclass of AudioVolumeControl.
  868. @constant kAudioDevicePropertyVolumeDecibelsToScalar
  869. A Float32 that on input contains a dB volume value for the and on exit
  870. contains the equivalent scalar value. This property is implemented by an
  871. AudioControl object that is a subclass of AudioVolumeControl.
  872. @constant kAudioDevicePropertyStereoPan
  873. A Float32 where 0.0 is full left, 1.0 is full right, and 0.5 is center. This
  874. property is implemented by an AudioControl object that is a subclass of
  875. AudioStereoPanControl.
  876. @constant kAudioDevicePropertyStereoPanChannels
  877. An array of two UInt32s that indicate which elements of the owning object
  878. the signal is being panned between. This property is implemented by an
  879. AudioControl object that is a subclass of AudioStereoPanControl.
  880. @constant kAudioDevicePropertyMute
  881. A UInt32 where a value of 1 means that mute is enabled making that element
  882. inaudible. The property is implemented by an AudioControl object that is a
  883. subclass of AudioMuteControl.
  884. @constant kAudioDevicePropertySolo
  885. A UInt32 where a value of 1 means that just that element is audible and the
  886. other elements are inaudible. The property is implemented by an AudioControl
  887. object that is a subclass of AudioSoloControl.
  888. @constant kAudioDevicePropertyPhantomPower
  889. A UInt32 where a value of 1 means that the AudioDevice has enabled phantom
  890. power for the given element. The property is implemented by an AudioControl
  891. object that is a subclass of AudioPhantomPowerControl.
  892. @constant kAudioDevicePropertyPhaseInvert
  893. A UInt32 where a value of 1 means that phase of the signal for the given
  894. element has been flipped 180 degrees. The property is implemented by an
  895. AudioControl object that is a subclass of AudioPhaseInvertControl.
  896. @constant kAudioDevicePropertyClipLight
  897. A UInt32 where a value of 1 means that the signal for the element has
  898. exceeded the sample range. Once a clip light is turned on, it is to stay on
  899. until either the value of the control is set to false or the current IO
  900. session stops and a new IO session starts. The property is implemented by an
  901. AudioControl object that is a subclass of AudioClipLightControl.
  902. @constant kAudioDevicePropertyTalkback
  903. A UInt32 where a value of 1 means that the talkback channel is enabled. The
  904. property is implemented by an AudioControl object that is a subclass of
  905. AudioTalkbackControl.
  906. @constant kAudioDevicePropertyListenback
  907. A UInt32 where a value of 1 means that the listenback channel is enabled.
  908. The property is implemented by an AudioControl object that is a subclass of
  909. AudioListenbackControl.
  910. @constant kAudioDevicePropertyDataSource
  911. An array of UInt32s whose values are the item IDs for the currently selected
  912. data sources. This property is implemented by an AudioControl object that is
  913. a subclass of AudioDataSourceControl.
  914. @constant kAudioDevicePropertyDataSources
  915. An array of UInt32s that are represent all the IDs of all the data sources
  916. currently available. This property is implemented by an AudioControl object
  917. that is a subclass of AudioDataSourceControl.
  918. @constant kAudioDevicePropertyDataSourceNameForIDCFString
  919. This property translates the given data source item ID into a human readable
  920. name using an AudioValueTranslation structure. The input data is the UInt32
  921. containing the item ID to translated and the output data is a CFString. The
  922. caller is responsible for releasing the returned CFObject. This property is
  923. implemented by an AudioControl object that is a subclass of
  924. AudioDataSourceControl.
  925. @constant kAudioDevicePropertyDataSourceKindForID
  926. This property returns a UInt32 that identifies the kind of data source
  927. the item ID refers to using an AudioValueTranslation structure. The input
  928. data is the UInt32 containing the item ID and the output data is the UInt32.
  929. @constant kAudioDevicePropertyClockSource
  930. An array of UInt32s whose values are the item IDs for the currently selected
  931. clock sources. This property is implemented by an AudioControl object that
  932. is a subclass of AudioClockControl.
  933. @constant kAudioDevicePropertyClockSources
  934. An array of UInt32s that are represent all the IDs of all the clock sources
  935. currently available. This property is implemented by an AudioControl object
  936. that is a subclass of AudioClockControl.
  937. @constant kAudioDevicePropertyClockSourceNameForIDCFString
  938. This property translates the given clock source item ID into a human
  939. readable name using an AudioValueTranslation structure. The input data is
  940. the UInt32 containing the item ID to translated and the output data is a
  941. CFString. The caller is responsible for releasing the returned CFObject.
  942. This property is implemented by an AudioControl object that is a subclass of
  943. AudioClockControl.
  944. @constant kAudioDevicePropertyClockSourceKindForID
  945. This property returns a UInt32 that identifies the kind of clock source
  946. the item ID refers to using an AudioValueTranslation structure. The input
  947. data is the UInt32 containing the item ID and the output data is the UInt32.
  948. @constant kAudioDevicePropertyPlayThru
  949. A UInt32 where a value of 0 means that play through is off and a value of 1
  950. means that it is on. This property is implemented by an AudioControl object
  951. that is a subclass of AudioMuteControl. Further, the control that implements
  952. this property is only available through
  953. kAudioDevicePropertyScopePlayThrough.
  954. @constant kAudioDevicePropertyPlayThruSolo
  955. A UInt32 where a value of 1 means that just that play through element is
  956. audible and the other elements are inaudible. The property is implemented by
  957. an AudioControl object that is a subclass of AudioSoloControl. Further, the
  958. control that implements this property is only available through
  959. kAudioDevicePropertyScopePlayThrough.
  960. @constant kAudioDevicePropertyPlayThruVolumeScalar
  961. A Float32 that represents the value of the volume control. The range is
  962. between 0.0 and 1.0 (inclusive). Note that the set of all Float32 values
  963. between 0.0 and 1.0 inclusive is much larger than the set of actual values
  964. that the hardware can select. This means that the Float32 range has a many
  965. to one mapping with the underlying hardware values. As such, setting a
  966. scalar value will result in the control taking on the value nearest to what
  967. was set. This property is implemented by an AudioControl object that is a
  968. subclass of AudioVolumeControl.Further, the control that implements this
  969. property is only available through kAudioDevicePropertyScopePlayThrough.
  970. @constant kAudioDevicePropertyPlayThruVolumeDecibels
  971. A Float32 that represents the value of the volume control in dB. Note that
  972. the set of all Float32 values in the dB range for the control is much larger
  973. than the set of actual values that the hardware can select. This means that
  974. the Float32 range has a many to one mapping with the underlying hardware
  975. values. As such, setting a dB value will result in the control taking on the
  976. value nearest to what was set. This property is implemented by an
  977. AudioControl object that is a subclass of AudioVolumeControl. Further, the
  978. control that implements this property is only available through
  979. kAudioDevicePropertyScopePlayThrough.
  980. @constant kAudioDevicePropertyPlayThruVolumeRangeDecibels
  981. An AudioValueRange that contains the minimum and maximum dB values the
  982. control can have. This property is implemented by an AudioControl object
  983. that is a subclass of AudioVolumeControl. Further, the control that
  984. implements this property is only available through
  985. kAudioDevicePropertyScopePlayThrough.
  986. @constant kAudioDevicePropertyPlayThruVolumeScalarToDecibels
  987. A Float32 that on input contains a scalar volume value for the and on exit
  988. contains the equivalent dB value. This property is implemented by an
  989. AudioControl object that is a subclass of AudioVolumeControl. Further, the
  990. control that implements this property is only available through
  991. kAudioDevicePropertyScopePlayThrough.
  992. @constant kAudioDevicePropertyPlayThruVolumeDecibelsToScalar
  993. A Float32 that on input contains a dB volume value for the and on exit
  994. contains the equivalent scalar value. This property is implemented by an
  995. AudioControl object that is a subclass of AudioVolumeControl. Further, the
  996. control that implements this property is only available through
  997. kAudioDevicePropertyScopePlayThrough.
  998. @constant kAudioDevicePropertyPlayThruStereoPan
  999. A Float32 where 0.0 is full left, 1.0 is full right, and 0.5 is center. This
  1000. property is implemented by an AudioControl object that is a subclass of
  1001. AudioStereoPanControl. Further, the control that implements this property is
  1002. only available through kAudioDevicePropertyScopePlayThrough.
  1003. @constant kAudioDevicePropertyPlayThruStereoPanChannels
  1004. An array of two UInt32s that indicate which elements of the owning object
  1005. the signal is being panned between. This property is implemented by an
  1006. AudioControl object that is a subclass of AudioStereoPanControl. Further,
  1007. the control that implements this property is only available through
  1008. kAudioDevicePropertyScopePlayThrough.
  1009. @constant kAudioDevicePropertyPlayThruDestination
  1010. An array of UInt32s whose values are the item IDs for the currently selected
  1011. play through data destinations. This property is implemented by an
  1012. AudioControl object that is a subclass of AudioDataDestinationControl.
  1013. Further, the control that implements this property is only available through
  1014. kAudioDevicePropertyScopePlayThrough.
  1015. @constant kAudioDevicePropertyPlayThruDestinations
  1016. An array of UInt32s that are represent all the IDs of all the play through
  1017. data destinations currently available. This property is implemented by an
  1018. AudioControl object that is a subclass of AudioDataDestinationControl.
  1019. Further, the control that implements this property is only available through
  1020. kAudioDevicePropertyScopePlayThrough.
  1021. @constant kAudioDevicePropertyPlayThruDestinationNameForIDCFString
  1022. This property translates the given play through data destination item ID
  1023. into a human readable name using an AudioValueTranslation structure. The
  1024. input data is the UInt32 containing the item ID to translated and the output
  1025. data is a CFString. The caller is responsible for releasing the returned
  1026. CFObject. This property is implemented by an AudioControl object that is a
  1027. subclass of AudioDataDestinationControl. Further, the control that
  1028. implements this property is only available through
  1029. kAudioDevicePropertyScopePlayThrough.
  1030. @constant kAudioDevicePropertyChannelNominalLineLevel
  1031. An array of UInt32s whose values are the item IDs for the currently selected
  1032. nominal line levels. This property is implemented by an AudioControl object
  1033. that is a subclass of AudioLineLevelControl.
  1034. @constant kAudioDevicePropertyChannelNominalLineLevels
  1035. An array of UInt32s that represent all the IDs of all the nominal line
  1036. levels currently available. This property is implemented by an AudioControl
  1037. object that is a subclass of AudioLineLevelControl.
  1038. @constant kAudioDevicePropertyChannelNominalLineLevelNameForIDCFString
  1039. This property translates the given nominal line level item ID into a human
  1040. readable name using an AudioValueTranslation structure. The input data is
  1041. the UInt32 containing the item ID to be translated and the output data is a
  1042. CFString. The caller is responsible for releasing the returned CFObject.
  1043. This property is implemented by an AudioControl object that is a subclass of
  1044. AudioLineLevelControl.
  1045. @constant kAudioDevicePropertyHighPassFilterSetting
  1046. An array of UInt32s whose values are the item IDs for the currently selected
  1047. high pass filter setting. This property is implemented by an AudioControl
  1048. object that is a subclass of AudioHighPassFilterControl.
  1049. @constant kAudioDevicePropertyHighPassFilterSettings
  1050. An array of UInt32s that represent all the IDs of all the high pass filter
  1051. settings currently available. This property is implemented by an
  1052. AudioControl object that is a subclass of AudioHighPassFilterControl.
  1053. @constant kAudioDevicePropertyHighPassFilterSettingNameForIDCFString
  1054. This property translates the given high pass filter setting item ID into a
  1055. human readable name using an AudioValueTranslation structure. The input data
  1056. is the UInt32 containing the item ID to be translated and the output data is
  1057. a CFString. The caller is responsible for releasing the returned CFObject.
  1058. This property is implemented by an AudioControl object that is a subclass of
  1059. AudioHighPassFilterControl.
  1060. @constant kAudioDevicePropertySubVolumeScalar
  1061. A Float32 that represents the value of the LFE volume control. The range is
  1062. between 0.0 and 1.0 (inclusive). Note that the set of all Float32 values
  1063. between 0.0 and 1.0 inclusive is much larger than the set of actual values
  1064. that the hardware can select. This means that the Float32 range has a many
  1065. to one mapping with the underlying hardware values. As such, setting a
  1066. scalar value will result in the control taking on the value nearest to what
  1067. was set. This property is implemented by an AudioControl object that is a
  1068. subclass of AudioLFEVolumeControl.
  1069. @constant kAudioDevicePropertySubVolumeDecibels
  1070. A Float32 that represents the value of the LFE volume control in dB. Note
  1071. that the set of all Float32 values in the dB range for the control is much
  1072. larger than the set of actual values that the hardware can select. This
  1073. means that the Float32 range has a many to one mapping with the underlying
  1074. hardware values. As such, setting a dB value will result in the control
  1075. taking on the value nearest to what was set. This property is implemented by
  1076. an AudioControl object that is a subclass of AudioLFE VolumeControl.
  1077. @constant kAudioDevicePropertySubVolumeRangeDecibels
  1078. An AudioValueRange that contains the minimum and maximum dB values the
  1079. control can have. This property is implemented by an AudioControl object
  1080. that is a subclass of AudioLFEVolumeControl.
  1081. @constant kAudioDevicePropertySubVolumeScalarToDecibels
  1082. A Float32 that on input contains a scalar volume value for the and on exit
  1083. contains the equivalent dB value. This property is implemented by an
  1084. AudioControl object that is a subclass of AudioLFEVolumeControl.
  1085. @constant kAudioDevicePropertySubVolumeDecibelsToScalar
  1086. A Float32 that on input contains a dB volume value for the and on exit
  1087. contains the equivalent scalar value. This property is implemented by an
  1088. AudioControl object that is a subclass of AudioLFEVolumeControl.
  1089. @constant kAudioDevicePropertySubMute
  1090. A UInt32 where a value of 1 means that mute is enabled making the LFE on
  1091. that element inaudible. The property is implemented by an AudioControl
  1092. object that is a subclass of AudioLFEMuteControl.
  1093. }
  1094. const
  1095. kAudioDevicePropertyJackIsConnected = FourCharCode('jack');
  1096. kAudioDevicePropertyVolumeScalar = FourCharCode('volm');
  1097. kAudioDevicePropertyVolumeDecibels = FourCharCode('vold');
  1098. kAudioDevicePropertyVolumeRangeDecibels = FourCharCode('vdb#');
  1099. kAudioDevicePropertyVolumeScalarToDecibels = FourCharCode('v2db');
  1100. kAudioDevicePropertyVolumeDecibelsToScalar = FourCharCode('db2v');
  1101. kAudioDevicePropertyStereoPan = FourCharCode('span');
  1102. kAudioDevicePropertyStereoPanChannels = FourCharCode('spn#');
  1103. kAudioDevicePropertyMute = FourCharCode('mute');
  1104. kAudioDevicePropertySolo = FourCharCode('solo');
  1105. kAudioDevicePropertyPhantomPower = FourCharCode('phan');
  1106. kAudioDevicePropertyPhaseInvert = FourCharCode('phsi');
  1107. kAudioDevicePropertyClipLight = FourCharCode('clip');
  1108. kAudioDevicePropertyTalkback = FourCharCode('talb');
  1109. kAudioDevicePropertyListenback = FourCharCode('lsnb');
  1110. kAudioDevicePropertyDataSource = FourCharCode('ssrc');
  1111. kAudioDevicePropertyDataSources = FourCharCode('ssc#');
  1112. kAudioDevicePropertyDataSourceNameForIDCFString = FourCharCode('lscn');
  1113. kAudioDevicePropertyDataSourceKindForID = FourCharCode('ssck');
  1114. kAudioDevicePropertyClockSource = FourCharCode('csrc');
  1115. kAudioDevicePropertyClockSources = FourCharCode('csc#');
  1116. kAudioDevicePropertyClockSourceNameForIDCFString = FourCharCode('lcsn');
  1117. kAudioDevicePropertyClockSourceKindForID = FourCharCode('csck');
  1118. kAudioDevicePropertyPlayThru = FourCharCode('thru');
  1119. kAudioDevicePropertyPlayThruSolo = FourCharCode('thrs');
  1120. kAudioDevicePropertyPlayThruVolumeScalar = FourCharCode('mvsc');
  1121. kAudioDevicePropertyPlayThruVolumeDecibels = FourCharCode('mvdb');
  1122. kAudioDevicePropertyPlayThruVolumeRangeDecibels = FourCharCode('mvd#');
  1123. kAudioDevicePropertyPlayThruVolumeScalarToDecibels = FourCharCode('mv2d');
  1124. kAudioDevicePropertyPlayThruVolumeDecibelsToScalar = FourCharCode('mv2s');
  1125. kAudioDevicePropertyPlayThruStereoPan = FourCharCode('mspn');
  1126. kAudioDevicePropertyPlayThruStereoPanChannels = FourCharCode('msp#');
  1127. kAudioDevicePropertyPlayThruDestination = FourCharCode('mdds');
  1128. kAudioDevicePropertyPlayThruDestinations = FourCharCode('mdd#');
  1129. kAudioDevicePropertyPlayThruDestinationNameForIDCFString = FourCharCode('mddc');
  1130. kAudioDevicePropertyChannelNominalLineLevel = FourCharCode('nlvl');
  1131. kAudioDevicePropertyChannelNominalLineLevels = FourCharCode('nlv#');
  1132. kAudioDevicePropertyChannelNominalLineLevelNameForIDCFString = FourCharCode('lcnl');
  1133. kAudioDevicePropertyHighPassFilterSetting = FourCharCode('hipf');
  1134. kAudioDevicePropertyHighPassFilterSettings = FourCharCode('hip#');
  1135. kAudioDevicePropertyHighPassFilterSettingNameForIDCFString = FourCharCode('hipl');
  1136. kAudioDevicePropertySubVolumeScalar = FourCharCode('svlm');
  1137. kAudioDevicePropertySubVolumeDecibels = FourCharCode('svld');
  1138. kAudioDevicePropertySubVolumeRangeDecibels = FourCharCode('svd#');
  1139. kAudioDevicePropertySubVolumeScalarToDecibels = FourCharCode('sv2d');
  1140. kAudioDevicePropertySubVolumeDecibelsToScalar = FourCharCode('sd2v');
  1141. kAudioDevicePropertySubMute = FourCharCode('smut');
  1142. //==================================================================================================
  1143. //#pragma mark AudioDevice Functions
  1144. {!
  1145. @functiongroup AudioDevice
  1146. }
  1147. {!
  1148. @function AudioDeviceCreateIOProcID
  1149. @abstract Creates an AudioDeviceIOProcID from an AudioDeviceIOProc and a client data
  1150. pointer.
  1151. @discussion AudioDeviceIOProcIDs allow for the client to register the same function pointer
  1152. with a device multiple times
  1153. @param inDevice
  1154. The AudioDevice to register the IOProc with.
  1155. @param inProc
  1156. The AudioDeviceIOProc to register.
  1157. @param inClientData
  1158. A pointer to client data that is passed back to the IOProc when it is
  1159. called.
  1160. @param outIOProcID
  1161. The newly created AudioDeviceIOProcID.
  1162. @result An OSStatus indicating success or failure.
  1163. }
  1164. function AudioDeviceCreateIOProcID( inDevice: AudioObjectID; inProc: AudioDeviceIOProc; inClientData: UnivPtr; var outIOProcID: AudioDeviceIOProcID ): OSStatus; external name '_AudioDeviceCreateIOProcID';
  1165. (* __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  1166. {!
  1167. @function AudioDeviceDestroyIOProcID
  1168. @abstract Destroys an AudioDeviceIOProcID.
  1169. @discussion AudioDeviceIOProcIDs allow for the client to register the same function pointer
  1170. with a device multiple times
  1171. @param inDevice
  1172. The AudioDevice from which the ID came.
  1173. @param inIOProcID
  1174. The AudioDeviceIOProcID to get rid of.
  1175. @result An OSStatus indicating success or failure.
  1176. }
  1177. function AudioDeviceDestroyIOProcID( inDevice: AudioObjectID; inIOProcID: AudioDeviceIOProcID ): OSStatus; external name '_AudioDeviceDestroyIOProcID';
  1178. (* __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) *)
  1179. {!
  1180. @function AudioDeviceStart
  1181. @abstract Starts IO for the given AudioDeviceIOProcID.
  1182. @param inDevice
  1183. The AudioDevice to start the IOProc on.
  1184. @param inProcID
  1185. The AudioDeviceIOProcID to start. Note that this can be NULL, which starts
  1186. the hardware regardless of whether or not there are any IOProcs registered.
  1187. This is necessary if any of the AudioDevice's timing services are to be
  1188. used. A balancing call to AudioDeviceStop with a NULL IOProc is required to
  1189. stop the hardware.
  1190. @result An OSStatus indicating success or failure.
  1191. }
  1192. function AudioDeviceStart( inDevice: AudioObjectID; inProcID: AudioDeviceIOProcID ): OSStatus; external name '_AudioDeviceStart';
  1193. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  1194. {!
  1195. @function AudioDeviceStartAtTime
  1196. @abstract Starts IO for the given AudioDeviceIOProcID and aligns the IO cycle of the
  1197. AudioDevice with the given time.
  1198. @param inDevice
  1199. The AudioDevice to start the IOProc on.
  1200. @param inProcID
  1201. The AudioDeviceIOProcID to start. Note that this can be NULL, which starts
  1202. the hardware regardless of whether or not there are any IOProcs registered.
  1203. @param ioRequestedStartTime
  1204. A pointer to an AudioTimeStamp that, on entry, is the requested time to
  1205. start the IOProc. On exit, it will be the actual time the IOProc will start.
  1206. @param inFlags
  1207. A UInt32 containing flags that modify how this function behaves.
  1208. @result An OSStatus indicating success or failure.
  1209. kAudioHardwareUnsupportedOperationError will be returned if the AudioDevice does
  1210. not support starting at a specific time and inProc and ioRequestedStartTime are
  1211. not NULL.
  1212. }
  1213. function AudioDeviceStartAtTime( inDevice: AudioObjectID; inProcID: AudioDeviceIOProcID; ioRequestedStartTime: AudioTimeStampPtr; inFlags: UInt32 ): OSStatus; external name '_AudioDeviceStartAtTime';
  1214. (* __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  1215. {!
  1216. @function AudioDeviceStop
  1217. @abstract Stops IO for the given AudioDeviceIOProcID.
  1218. @param inDevice
  1219. The AudioDevice to stop the IOProc on.
  1220. @param inProcID
  1221. The AudioDeviceIOProcID to stop.
  1222. @result An OSStatus indicating success or failure.
  1223. }
  1224. function AudioDeviceStop( inDevice: AudioObjectID; inProcID: AudioDeviceIOProcID ): OSStatus; external name '_AudioDeviceStop';
  1225. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  1226. {!
  1227. @function AudioDeviceGetCurrentTime
  1228. @abstract Retrieves the current time from an AudioDevice. Note that the device has to be
  1229. running.
  1230. @param inDevice
  1231. The AudioDevice to from which to get the time.
  1232. @param outTime
  1233. An AudioTimeStamp into which the current time is put.
  1234. @result An OSStatus indicating success or failure. kAudioHardwareNotRunningError will be
  1235. returned if the AudioDevice isn't running.
  1236. }
  1237. function AudioDeviceGetCurrentTime( inDevice: AudioObjectID; var outTime: AudioTimeStamp ): OSStatus; external name '_AudioDeviceGetCurrentTime';
  1238. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  1239. {!
  1240. @function AudioDeviceTranslateTime
  1241. @abstract Translates the time in the AudioDevice's time base from one representation to
  1242. another. Note that the device has to be running
  1243. @param inDevice
  1244. The AudioDevice whose time base governs the translation.
  1245. @param inTime
  1246. An AudioTimeStamp containing the time to be translated.
  1247. @param outTime
  1248. An AudioTimeStamp into which the translated time is put. On entry, the
  1249. mFlags field specifies which representations to translate the input time
  1250. into. Because not every device supports all time representations, on exit,
  1251. the mFlags field will indicate which translations were actually done.
  1252. @result An OSStatus indicating success or failure. kAudioHardwareNotRunningError will be
  1253. returned if the AudioDevice isn't running.
  1254. }
  1255. function AudioDeviceTranslateTime( inDevice: AudioObjectID; const (*var*) inTime: AudioTimeStamp; var outTime: AudioTimeStamp ): OSStatus; external name '_AudioDeviceTranslateTime';
  1256. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0) *)
  1257. {!
  1258. @function AudioDeviceGetNearestStartTime
  1259. @abstract Query an AudioDevice to get a time equal to or later than the given time that is
  1260. the best time to start IO.
  1261. @discussion The time that is returned is dictated by the constraints of the device and the
  1262. system. For instance, the driver of a device that provides both audio and video
  1263. data may only allow start times that coincide with the edge of a video frame.
  1264. Also, if the device already has one or more active IOProcs, the start time will
  1265. be shifted to the beginning of the next IO cycle so as not to cause
  1266. discontinuities in the existing IOProcs. Another reason the start time may shift
  1267. is to allow for aligning the buffer accesses in an optimal fashion. Note that
  1268. the device must be running to use this function.
  1269. @param inDevice
  1270. The AudioDevice to query.
  1271. @param ioRequestedStartTime
  1272. A pointer to an AudioTimeStamp that, on entry, is the requested start time.
  1273. On exit, it will have the a time equal to or later than the requested time,
  1274. as dictated by the device's constraints.
  1275. @param inFlags
  1276. A UInt32 containing flags that modify how this function behaves.
  1277. @result An OSStatus indicating success or failure. kAudioHardwareNotRunningError will be
  1278. returned if the AudioDevice isn't running.
  1279. kAudioHardwareUnsupportedOperationError will be returned if the AudioDevice does
  1280. not support starting at a specific time.
  1281. }
  1282. function AudioDeviceGetNearestStartTime( inDevice: AudioObjectID; var ioRequestedStartTime: AudioTimeStamp; inFlags: UInt32 ): OSStatus; external name '_AudioDeviceGetNearestStartTime';
  1283. (* __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0) *)
  1284. //==================================================================================================
  1285. //#pragma mark AudioAggregateDevice Constants
  1286. {!
  1287. @enum AudioAggregateDevice Class Constants
  1288. @abstract Various constants related to the AudioAggregateDevice class.
  1289. @constant kAudioAggregateDeviceClassID
  1290. The AudioClassID that identifies the AudioAggregateDevice class.
  1291. }
  1292. const
  1293. kAudioAggregateDeviceClassID = FourCharCode('aagg');
  1294. {!
  1295. @defined kAudioAggregateDeviceUIDKey
  1296. @discussion The key used in a CFDictionary that describes the composition of an
  1297. AudioAggregateDevice. The value for this key is a CFString that contains the UID
  1298. of the AudioAggregateDevice.
  1299. }
  1300. const
  1301. kAudioAggregateDeviceUIDKey = 'uid';
  1302. {!
  1303. @defined kAudioAggregateDeviceNameKey
  1304. @discussion The key used in a CFDictionary that describes the composition of an
  1305. AudioAggregateDevice. The value for this key is a CFString that contains the
  1306. human readable name of the AudioAggregateDevice.
  1307. }
  1308. const
  1309. kAudioAggregateDeviceNameKey = 'name';
  1310. {!
  1311. @defined kAudioAggregateDeviceSubDeviceListKey
  1312. @discussion The key used in a CFDictionary that describes the composition of an
  1313. AudioAggregateDevice. The value for this key is a CFArray of CFDictionaries that
  1314. describe each sub-device in the AudioAggregateDevice. The keys for this
  1315. CFDictionary are defined in the AudioSubDevice section.
  1316. }
  1317. const
  1318. kAudioAggregateDeviceSubDeviceListKey = 'subdevices';
  1319. {!
  1320. @defined kAudioAggregateDeviceMasterSubDeviceKey
  1321. @discussion The key used in a CFDictionary that describes the composition of an
  1322. AudioAggregateDevice. The value for this key is a CFString that contains the
  1323. UID for the sub-device that is the master time source for the
  1324. AudioAggregateDevice.
  1325. }
  1326. const
  1327. kAudioAggregateDeviceMasterSubDeviceKey = 'master';
  1328. {!
  1329. @defined kAudioAggregateDeviceIsPrivateKey
  1330. @discussion The key used in a CFDictionary that describes the composition of an
  1331. AudioAggregateDevice. The value for this key is a CFNumber where a value of 0
  1332. means that the AudioAggregateDevice is to be published to the entire system and
  1333. a value of 1 means that the AudioAggregateDevice is private to the process that
  1334. created it. Note that a private AudioAggregateDevice is not persistent across
  1335. launches of the process that created it. Note that if this key is not present,
  1336. it implies that the AudioAggregateDevice is published to the entire system.
  1337. }
  1338. const
  1339. kAudioAggregateDeviceIsPrivateKey = 'private';
  1340. {!
  1341. @defined kAudioAggregateDeviceIsStackedKey
  1342. @discussion The key used in a CFDictionary that describes the composition of an
  1343. AudioAggregateDevice. The value for this key is a CFNumber where a value of 0
  1344. means that the sub-devices of the AudioAggregateDevice are arranged such that
  1345. the output streams are all fed the same data.
  1346. }
  1347. const
  1348. kAudioAggregateDeviceIsStackedKey = 'stacked';
  1349. //==================================================================================================
  1350. //#pragma mark AudioAggregateDevice Properties
  1351. {!
  1352. @enum AudioAggregateDevice Properties
  1353. @abstract AudioObjectPropertySelector values provided by the AudioAggregateDevice class.
  1354. @discussion AudioAggregateDevice is a subclass of AudioDevice and has the same scope and
  1355. element structure.
  1356. @constant kAudioAggregateDevicePropertyFullSubDeviceList
  1357. A CFArray of CFStrings that contain the UIDs of all the devices, active or
  1358. inactive, contained in the AudioAggregateDevice. The order of the items in
  1359. the array is significant and is used to determine the order of the streams
  1360. of the AudioAggregateDevice. The caller is responsible for releasing the
  1361. returned CFObject.
  1362. @constant kAudioAggregateDevicePropertyActiveSubDeviceList
  1363. An array of AudioObjectIDs for all the active sub-devices in the aggregate
  1364. device.
  1365. @constant kAudioAggregateDevicePropertyComposition
  1366. A CFDictionary that describes the composition of the AudioAggregateDevice.
  1367. The keys for this CFDicitionary are defined in the AudioAggregateDevice
  1368. Constants section. The caller is responsible for releasing the returned
  1369. CFObject.
  1370. @constant kAudioAggregateDevicePropertyMasterSubDevice
  1371. A CFString that contains the UID for the AudioDevice that is currently
  1372. serving as the master time base of the aggregate device. The caller is
  1373. responsible for releasing the returned CFObject.
  1374. }
  1375. const
  1376. kAudioAggregateDevicePropertyFullSubDeviceList = FourCharCode('grup');
  1377. kAudioAggregateDevicePropertyActiveSubDeviceList = FourCharCode('agrp');
  1378. kAudioAggregateDevicePropertyComposition = FourCharCode('acom');
  1379. kAudioAggregateDevicePropertyMasterSubDevice = FourCharCode('amst');
  1380. //==================================================================================================
  1381. //#pragma mark AudioSubDevice Constants
  1382. {!
  1383. @enum AudioSubDevice Class Constants
  1384. @abstract Various constants related to the AudioSubDevice class.
  1385. @constant kAudioSubDeviceClassID
  1386. The AudioClassID that identifies the AudioSubDevice class.
  1387. }
  1388. const
  1389. kAudioSubDeviceClassID = FourCharCode('asub');
  1390. {!
  1391. @enum AudioSubDevice Clock Drift Compensation Methods
  1392. @abstract Constants that describe the range of values the property
  1393. kAudioSubDevicePropertyDriftCompensation. It is a continuous range from
  1394. kAudioSubDeviceDriftCompensationMinQuality to
  1395. kAudioSubDeviceDriftCompensationMaxQuality, with some commonly used settings
  1396. called out.
  1397. }
  1398. const
  1399. kAudioSubDeviceDriftCompensationMinQuality = 0;
  1400. kAudioSubDeviceDriftCompensationLowQuality = $20;
  1401. kAudioSubDeviceDriftCompensationMediumQuality = $40;
  1402. kAudioSubDeviceDriftCompensationHighQuality = $60;
  1403. kAudioSubDeviceDriftCompensationMaxQuality = $7F;
  1404. {!
  1405. @defined kAudioSubDeviceUIDKey
  1406. @discussion The key used in a CFDictionary that describes the state of an AudioSubDevice.
  1407. The value for this key is a CFString that contains the UID for the
  1408. AudioSubDevice.
  1409. }
  1410. const
  1411. kAudioSubDeviceUIDKey = 'uid';
  1412. {!
  1413. @defined kAudioAggregateDeviceSubDeviceNameKey
  1414. @discussion The key used in a CFDictionary that describes the state of an AudioSubDevice.
  1415. The value for this key is a CFString that contains the human readable
  1416. name of the AudioSubDevice.
  1417. }
  1418. const
  1419. kAudioSubDeviceNameKey = 'name';
  1420. {!
  1421. @defined kAudioSubDeviceInputChannelsKey
  1422. @discussion The key used in a CFDictionary that describes the state of an AudioSubDevice.
  1423. The value for this key is a CFNumber that indicates the total number of input
  1424. channels for the AudioSubDevice.
  1425. }
  1426. const
  1427. kAudioSubDeviceInputChannelsKey = 'channels-in';
  1428. {!
  1429. @defined kAudioSubDeviceOutputChannelsKey
  1430. @discussion The key used in a CFDictionary that describes the state of an AudioSubDevice.
  1431. The value for this key is a CFNumber that indicates the total number of output
  1432. channels for the AudioSubDevice.
  1433. }
  1434. const
  1435. kAudioSubDeviceOutputChannelsKey = 'channels-out';
  1436. {!
  1437. @defined kAudioSubDeviceExtraInputLatencyKey
  1438. @discussion The key used in a CFDictionary that describes the state of an AudioSubDevice.
  1439. The value for this key is a CFNumber that indicates the total number of frames
  1440. of additional latency that will be added to the input side of the
  1441. AudioSubDevice.
  1442. }
  1443. const
  1444. kAudioSubDeviceExtraInputLatencyKey = 'latency-in';
  1445. {!
  1446. @defined kAudioSubDeviceExtraOutputLatencyKey
  1447. @discussion The key used in a CFDictionary that describes the state of an AudioSubDevice.
  1448. The value for this key is a CFNumber that indicates the total number of frames
  1449. of additional latency that will be added to the output side of the
  1450. AudioSubDevice.
  1451. }
  1452. const
  1453. kAudioSubDeviceExtraOutputLatencyKey = 'latency-out';
  1454. {!
  1455. @defined kAudioSubDeviceDriftCompensationKey
  1456. @discussion The key used in a CFDictionary that describes the state of an AudioSubDevice.
  1457. The value for this key is a CFNumber where a non-zero value indicates that drift
  1458. compensation is enabled for the AudioSubDevice
  1459. }
  1460. const
  1461. kAudioSubDeviceDriftCompensationKey = 'drift';
  1462. {!
  1463. @defined kAudioSubDeviceDriftCompensationQualityKey
  1464. @discussion The key used in a CFDictionary that describes the state of an AudioSubDevice.
  1465. The value for this key is a CFNumber that indicates the quality of the drifty
  1466. compensation for the AudioSubDevice
  1467. }
  1468. const
  1469. kAudioSubDeviceDriftCompensationQualityKey = 'drift quality';
  1470. //==================================================================================================
  1471. //#pragma mark AudioSubDevice Properties
  1472. {!
  1473. @enum AudioSubDevice Properties
  1474. @abstract AudioObjectPropertySelector values provided by the AudioSubDevice class.
  1475. @discussion The AudioSubDevice class is a subclass of AudioDevice class and has the same
  1476. scope and element structure. However, AudioSubDevice objects do not implement an
  1477. IO path of their own and as such do not implmenent any AudioDevice properties
  1478. associated with the IO path. They also don't have any streams.
  1479. @constant kAudioSubDevicePropertyExtraLatency
  1480. A Float64 indicating the number of sample frames to add to or subtract from
  1481. the latency compensation used for this AudioSubDevice.
  1482. @constant kAudioSubDevicePropertyDriftCompensation
  1483. A UInt32 where a value of 0 indicates that no drift compensation should be
  1484. done for this AudioSubDevice and a value of 1 means that it should.
  1485. @constant kAudioSubDevicePropertyDriftCompensationQuality
  1486. A UInt32 that controls the trade-off between quality and CPU load in the
  1487. drift compensation. The range of values is from 0 to 128, where the lower
  1488. the number, the worse the quality but also the less CPU is used to do the
  1489. compensation.
  1490. }
  1491. const
  1492. kAudioSubDevicePropertyExtraLatency = FourCharCode('xltc');
  1493. kAudioSubDevicePropertyDriftCompensation = FourCharCode('drft');
  1494. kAudioSubDevicePropertyDriftCompensationQuality = FourCharCode('drfq');
  1495. //==================================================================================================
  1496. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  1497. end.
  1498. {$endc} {not MACOSALLINCLUDE}