AudioHardware.pas 95 KB

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