MIDIServices.pas 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228
  1. {
  2. File: CoreMIDI/MIDIServices.h
  3. Contains: API for communicating with MIDI hardware
  4. Copyright: (c) 2000-2008 by Apple Inc., all rights reserved.
  5. Bugs?: For bug reports, consult the following page on
  6. the World Wide Web:
  7. http://bugs.freepascal.org
  8. }
  9. { Pascal Translation: Gorazd Krosl <[email protected]>, October 2009 }
  10. { Pascal Translation Update: Jonas Maebe <[email protected]>, October 2012 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 308
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  17. {$mode macpas}
  18. {$modeswitch cblocks}
  19. {$packenum 1}
  20. {$macro on}
  21. {$inline on}
  22. {$calling mwpascal}
  23. unit MIDIServices;
  24. interface
  25. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  26. {$setc GAP_INTERFACES_VERSION := $0308}
  27. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  28. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  29. {$endc}
  30. {$ifc defined CPUPOWERPC and defined CPUI386}
  31. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  32. {$endc}
  33. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  34. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  35. {$endc}
  36. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  37. {$setc __ppc__ := 1}
  38. {$elsec}
  39. {$setc __ppc__ := 0}
  40. {$endc}
  41. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  42. {$setc __ppc64__ := 1}
  43. {$elsec}
  44. {$setc __ppc64__ := 0}
  45. {$endc}
  46. {$ifc not defined __i386__ and defined CPUI386}
  47. {$setc __i386__ := 1}
  48. {$elsec}
  49. {$setc __i386__ := 0}
  50. {$endc}
  51. {$ifc not defined __x86_64__ and defined CPUX86_64}
  52. {$setc __x86_64__ := 1}
  53. {$elsec}
  54. {$setc __x86_64__ := 0}
  55. {$endc}
  56. {$ifc not defined __arm__ and defined CPUARM}
  57. {$setc __arm__ := 1}
  58. {$elsec}
  59. {$setc __arm__ := 0}
  60. {$endc}
  61. {$ifc not defined __arm64__ and defined CPUAARCH64}
  62. {$setc __arm64__ := 1}
  63. {$elsec}
  64. {$setc __arm64__ := 0}
  65. {$endc}
  66. {$ifc defined cpu64}
  67. {$setc __LP64__ := 1}
  68. {$elsec}
  69. {$setc __LP64__ := 0}
  70. {$endc}
  71. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  72. {$error Conflicting definitions for __ppc__ and __i386__}
  73. {$endc}
  74. {$ifc defined __ppc__ and __ppc__}
  75. {$setc TARGET_CPU_PPC := TRUE}
  76. {$setc TARGET_CPU_PPC64 := FALSE}
  77. {$setc TARGET_CPU_X86 := FALSE}
  78. {$setc TARGET_CPU_X86_64 := FALSE}
  79. {$setc TARGET_CPU_ARM := FALSE}
  80. {$setc TARGET_CPU_ARM64 := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_IPHONE := FALSE}
  83. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  84. {$setc TARGET_OS_EMBEDDED := FALSE}
  85. {$elifc defined __ppc64__ and __ppc64__}
  86. {$setc TARGET_CPU_PPC := FALSE}
  87. {$setc TARGET_CPU_PPC64 := TRUE}
  88. {$setc TARGET_CPU_X86 := FALSE}
  89. {$setc TARGET_CPU_X86_64 := FALSE}
  90. {$setc TARGET_CPU_ARM := FALSE}
  91. {$setc TARGET_CPU_ARM64 := FALSE}
  92. {$setc TARGET_OS_MAC := TRUE}
  93. {$setc TARGET_OS_IPHONE := FALSE}
  94. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  95. {$setc TARGET_OS_EMBEDDED := FALSE}
  96. {$elifc defined __i386__ and __i386__}
  97. {$setc TARGET_CPU_PPC := FALSE}
  98. {$setc TARGET_CPU_PPC64 := FALSE}
  99. {$setc TARGET_CPU_X86 := TRUE}
  100. {$setc TARGET_CPU_X86_64 := FALSE}
  101. {$setc TARGET_CPU_ARM := FALSE}
  102. {$setc TARGET_CPU_ARM64 := FALSE}
  103. {$ifc defined(iphonesim)}
  104. {$setc TARGET_OS_MAC := FALSE}
  105. {$setc TARGET_OS_IPHONE := TRUE}
  106. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  107. {$elsec}
  108. {$setc TARGET_OS_MAC := TRUE}
  109. {$setc TARGET_OS_IPHONE := FALSE}
  110. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  111. {$endc}
  112. {$setc TARGET_OS_EMBEDDED := FALSE}
  113. {$elifc defined __x86_64__ and __x86_64__}
  114. {$setc TARGET_CPU_PPC := FALSE}
  115. {$setc TARGET_CPU_PPC64 := FALSE}
  116. {$setc TARGET_CPU_X86 := FALSE}
  117. {$setc TARGET_CPU_X86_64 := TRUE}
  118. {$setc TARGET_CPU_ARM := FALSE}
  119. {$setc TARGET_CPU_ARM64 := FALSE}
  120. {$ifc defined(iphonesim)}
  121. {$setc TARGET_OS_MAC := FALSE}
  122. {$setc TARGET_OS_IPHONE := TRUE}
  123. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  124. {$elsec}
  125. {$setc TARGET_OS_MAC := TRUE}
  126. {$setc TARGET_OS_IPHONE := FALSE}
  127. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  128. {$endc}
  129. {$setc TARGET_OS_EMBEDDED := FALSE}
  130. {$elifc defined __arm__ and __arm__}
  131. {$setc TARGET_CPU_PPC := FALSE}
  132. {$setc TARGET_CPU_PPC64 := FALSE}
  133. {$setc TARGET_CPU_X86 := FALSE}
  134. {$setc TARGET_CPU_X86_64 := FALSE}
  135. {$setc TARGET_CPU_ARM := TRUE}
  136. {$setc TARGET_CPU_ARM64 := FALSE}
  137. { will require compiler define when/if other Apple devices with ARM cpus ship }
  138. {$setc TARGET_OS_MAC := FALSE}
  139. {$setc TARGET_OS_IPHONE := TRUE}
  140. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  141. {$setc TARGET_OS_EMBEDDED := TRUE}
  142. {$elifc defined __arm64__ and __arm64__}
  143. {$setc TARGET_CPU_PPC := FALSE}
  144. {$setc TARGET_CPU_PPC64 := FALSE}
  145. {$setc TARGET_CPU_X86 := FALSE}
  146. {$setc TARGET_CPU_X86_64 := FALSE}
  147. {$setc TARGET_CPU_ARM := FALSE}
  148. {$setc TARGET_CPU_ARM64 := TRUE}
  149. { will require compiler define when/if other Apple devices with ARM cpus ship }
  150. {$setc TARGET_OS_MAC := FALSE}
  151. {$setc TARGET_OS_IPHONE := TRUE}
  152. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  153. {$setc TARGET_OS_EMBEDDED := TRUE}
  154. {$elsec}
  155. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  156. {$endc}
  157. {$ifc defined __LP64__ and __LP64__ }
  158. {$setc TARGET_CPU_64 := TRUE}
  159. {$elsec}
  160. {$setc TARGET_CPU_64 := FALSE}
  161. {$endc}
  162. {$ifc defined FPC_BIG_ENDIAN}
  163. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  164. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  165. {$elifc defined FPC_LITTLE_ENDIAN}
  166. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  167. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  168. {$elsec}
  169. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  170. {$endc}
  171. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  172. {$setc CALL_NOT_IN_CARBON := FALSE}
  173. {$setc OLDROUTINENAMES := FALSE}
  174. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  175. {$setc OPAQUE_UPP_TYPES := TRUE}
  176. {$setc OTCARBONAPPLICATION := TRUE}
  177. {$setc OTKERNEL := FALSE}
  178. {$setc PM_USE_SESSION_APIS := TRUE}
  179. {$setc TARGET_API_MAC_CARBON := TRUE}
  180. {$setc TARGET_API_MAC_OS8 := FALSE}
  181. {$setc TARGET_API_MAC_OSX := TRUE}
  182. {$setc TARGET_CARBON := TRUE}
  183. {$setc TARGET_CPU_68K := FALSE}
  184. {$setc TARGET_CPU_MIPS := FALSE}
  185. {$setc TARGET_CPU_SPARC := FALSE}
  186. {$setc TARGET_OS_UNIX := FALSE}
  187. {$setc TARGET_OS_WIN32 := FALSE}
  188. {$setc TARGET_RT_MAC_68881 := FALSE}
  189. {$setc TARGET_RT_MAC_CFM := FALSE}
  190. {$setc TARGET_RT_MAC_MACHO := TRUE}
  191. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  192. {$setc TYPE_BOOL := FALSE}
  193. {$setc TYPE_EXTENDED := FALSE}
  194. {$setc TYPE_LONGLONG := TRUE}
  195. uses MacTypes,CFBase,CFData,CFDictionary;
  196. {$endc} {not MACOSALLINCLUDE}
  197. {$ifc TARGET_OS_MAC}
  198. {$ALIGN POWER}
  199. {!
  200. @header MIDIServices.h
  201. This is the header file for Mac OS X's MIDI system services.
  202. <h2>API Overview</h2>
  203. Drivers own and control Devices, e.g. USB interfaces, PCI cards, etc. A device is defined
  204. as a physical object that would be represented by a single icon if there were a graphical
  205. view of the studio.
  206. Devices may have multiple logically distinct sub-components, e.g. a MIDI synthesizer and a
  207. pair of MIDI ports, both addressable via a USB port. These are called Entities.
  208. Entities have any number of Endpoints, sources and destinations of 16-channel MIDI streams.
  209. By grouping a device's endpoints into entities, the system has enough information for an
  210. application to make reasonable default assumptions about how to communicate in a
  211. bi-directional manner with each entity, as is necessary in MIDI librarian applications.
  212. CoreMIDI attaches a collection of properties to each object it manages. Some properties are
  213. dynamic characteristics of a device (e.g. MIDI receive channel and system-exclusive ID's),
  214. and some are a matter of user preference (choice of icon, whether the device should appear
  215. in lists of possible controllers). Other properties are static and could be looked up in a
  216. database, using the device's manufacturer and model names as a key.
  217. <h2>Implementation overview</h2>
  218. The client API is implemented as the CoreMIDI framework, which uses IPC to communicate with
  219. a server process, MIDIServer.
  220. The server process loads, and manages all communication with, MIDI drivers.
  221. "Drivers" are not I/O Kit drivers. They are bundles containing CFPlugins.
  222. Many MIDI drivers can simply be user-side I/O Kit clients (probably for serial, USB,
  223. Firewire).
  224. PCI card drivers will need their MIDI drivers to communicate with a separate kernel
  225. extension.
  226. <h2>Note about CoreFoundation data types (CFString, CFData, CFDictionary)</h2>
  227. When passing a CF object to a MIDI function, the MIDI function will never consume a
  228. reference to the object; the caller always retains a reference which it is responsible for
  229. releasing with CFRelease().
  230. When receiving a CF object as a return value from a MIDI function, the caller always
  231. receives a new reference to the object, and is responsible for releasing it.
  232. }
  233. //=============================================================================
  234. //#pragma mark Includes
  235. //=============================================================================
  236. //#pragma mark Error Constants
  237. {!
  238. @enum Error Constants
  239. @abstract The error constants unique to Core MIDI.
  240. @discussion These are the error constants that are unique to Core MIDI. Note that Core MIDI
  241. functions may return other codes that are not listed here.
  242. @constant kMIDIInvalidClient
  243. An invalid MIDIClientRef was passed.
  244. @constant kMIDIInvalidPort
  245. An invalid MIDIPortRef was passed.
  246. @constant kMIDIWrongEndpointType
  247. A source endpoint was passed to a function expecting a destination, or vice versa.
  248. @constant kMIDINoConnection
  249. Attempt to close a non-existant connection.
  250. @constant kMIDIUnknownEndpoint
  251. An invalid MIDIEndpointRef was passed.
  252. @constant kMIDIUnknownProperty
  253. Attempt to query a property not set on the object.
  254. @constant kMIDIWrongPropertyType
  255. Attempt to set a property with a value not of the correct type.
  256. @constant kMIDINoCurrentSetup
  257. Internal error; there is no current MIDI setup object.
  258. @constant kMIDIMessageSendErr
  259. Communication with MIDIServer failed.
  260. @constant kMIDIServerStartErr
  261. Unable to start MIDIServer.
  262. @constant kMIDISetupFormatErr
  263. Unable to read the saved state.
  264. @constant kMIDIWrongThread
  265. A driver is calling a non-I/O function in the server from a thread other than
  266. the server's main thread.
  267. @constant kMIDIObjectNotFound
  268. The requested object does not exist.
  269. @constant kMIDIIDNotUnique
  270. Attempt to set a non-unique kMIDIPropertyUniqueID on an object.
  271. }
  272. const
  273. kMIDIInvalidClient = -10830;
  274. kMIDIInvalidPort = -10831;
  275. kMIDIWrongEndpointType = -10832;
  276. kMIDINoConnection = -10833;
  277. kMIDIUnknownEndpoint = -10834;
  278. kMIDIUnknownProperty = -10835;
  279. kMIDIWrongPropertyType = -10836;
  280. kMIDINoCurrentSetup = -10837;
  281. kMIDIMessageSendErr = -10838;
  282. kMIDIServerStartErr = -10839;
  283. kMIDISetupFormatErr = -10840;
  284. kMIDIWrongThread = -10841;
  285. kMIDIObjectNotFound = -10842;
  286. kMIDIIDNotUnique = -10843;
  287. //=============================================================================
  288. //#pragma mark Types
  289. //#if __LP64__
  290. {$ifc TARGET_CPU_64}
  291. {!
  292. @typedef MIDIObjectRef
  293. @abstract The base class of many CoreMIDI objects.
  294. @discussion
  295. MIDIObject is the base class for many of the objects in CoreMIDI. They have properties,
  296. and often an "owner" object, from which they inherit any properties they do not
  297. themselves have.
  298. Developers may add their own private properties, whose names must begin with their
  299. company's inverted domain name, as in Java package names, but with underscores instead
  300. of dots, e.g.: com_apple_APrivateAppleProperty
  301. }
  302. type
  303. MIDIObjectRef = UInt32;
  304. {!
  305. @typedef MIDIClientRef
  306. @abstract An object maintaining per-client state.
  307. @discussion
  308. Derives from MIDIObjectRef, does not have an owner object.
  309. To use CoreMIDI, an application creates a MIDIClientRef, to which it can add
  310. MIDIPortRef's, through which it can send and receive MIDI.
  311. }
  312. type
  313. MIDIClientRef = MIDIObjectRef;
  314. {!
  315. @typedef MIDIPortRef
  316. @abstract A MIDI connection port owned by a client.
  317. @discussion
  318. Derives from MIDIObjectRef, owned by a MIDIClientRef.
  319. A MIDIPortRef, which may be an input port or output port, is an object through which a
  320. client may communicate with any number of MIDI sources or destinations.
  321. }
  322. type
  323. MIDIPortRef = MIDIObjectRef;
  324. {!
  325. @typedef MIDIDeviceRef
  326. @abstract A MIDI device or external device, containing entities.
  327. @discussion
  328. Derives from MIDIObjectRef, does not have an owner object.
  329. A MIDI device, which either attaches directly to the computer and is controlled by a
  330. MIDI driver, or which is "external," meaning that it is connected to a driver-controlled
  331. device via a standard MIDI cable.
  332. A MIDIDeviceRef has properties and contains MIDIEntityRef's.
  333. }
  334. type
  335. MIDIDeviceRef = MIDIObjectRef;
  336. {!
  337. @typedef MIDIEntityRef
  338. @abstract A MIDI entity, owned by a device, containing endpoints.
  339. @discussion
  340. Derives from MIDIObjectRef, owned by a MIDIDeviceRef.
  341. Devices may have multiple logically distinct sub-components, e.g. a MIDI synthesizer and
  342. a pair of MIDI ports, both addressable via a USB port.
  343. By grouping a device's endpoints into entities, the system has enough information for an
  344. application to make reasonable assumptions about how to communicate in a bi-directional
  345. manner with each entity, as is desirable in MIDI librarian applications.
  346. These sub-components are MIDIEntityRef's.
  347. }
  348. type
  349. MIDIEntityRef = MIDIObjectRef;
  350. {!
  351. @typedef MIDIEndpointRef
  352. @abstract A MIDI source or destination, owned by an entity.
  353. @discussion
  354. Derives from MIDIObjectRef, owned by a MIDIEntityRef, unless it is a virtual endpoint,
  355. in which case there is no owning entity.
  356. Entities have any number of MIDIEndpointRef's, sources and destinations of 16-channel
  357. MIDI streams.
  358. }
  359. type
  360. MIDIEndpointRef = MIDIObjectRef;
  361. {$elsec}
  362. type
  363. MIDIObjectRef = UnivPtr;
  364. MIDIClientRef = ^OpaqueMIDIClient; { an opaque type }
  365. OpaqueMIDIClient = record end;
  366. MIDIPortRef = ^OpaqueMIDIPort; { an opaque type }
  367. OpaqueMIDIPort = record end;
  368. MIDIDeviceRef = ^OpaqueMIDIDevice; { an opaque type }
  369. OpaqueMIDIDevice = record end;
  370. MIDIEntityRef = ^OpaqueMIDIEntity; { an opaque type }
  371. OpaqueMIDIEntity = record end;
  372. MIDIEndpointRef = ^OpaqueMIDIEndpoint; { an opaque type }
  373. OpaqueMIDIEndpoint = record end;
  374. {$endc} { TARGET_CPU_64 }
  375. {!
  376. @typedef MIDITimeStamp
  377. @abstract A host clock time.
  378. @discussion
  379. A host clock time representing the time of an event, as returned by
  380. mach_absolute_time() or UpTime().
  381. Since MIDI applications will tend to do a fair amount of math with the times of events,
  382. it's more convenient to use a UInt64 than an AbsoluteTime.
  383. See CoreAudio/HostTime.h.
  384. }
  385. type
  386. MIDITimeStamp = UInt64;
  387. {!
  388. @enum MIDIObjectType
  389. @abstract Signifies the type of a MIDIObject.
  390. @discussion
  391. Signifies the real type of a MIDIObjectRef instance.
  392. }
  393. const
  394. // MIDIObjectType
  395. kMIDIObjectType_Other = -1;
  396. kMIDIObjectType_Device = 0;
  397. kMIDIObjectType_Entity = 1;
  398. kMIDIObjectType_Source = 2;
  399. kMIDIObjectType_Destination = 3;
  400. kMIDIObjectType_ExternalMask = $10;
  401. kMIDIObjectType_ExternalDevice = kMIDIObjectType_ExternalMask or kMIDIObjectType_Device;
  402. kMIDIObjectType_ExternalEntity = kMIDIObjectType_ExternalMask or kMIDIObjectType_Entity;
  403. kMIDIObjectType_ExternalSource = kMIDIObjectType_ExternalMask or kMIDIObjectType_Source;
  404. kMIDIObjectType_ExternalDestination = kMIDIObjectType_ExternalMask or kMIDIObjectType_Destination;
  405. type
  406. MIDIObjectType = SInt32;
  407. {!
  408. @typedef MIDIUniqueID
  409. @abstract A unique identifier for a MIDIObjectRef.
  410. @discussion
  411. An integer which uniquely identifies a MIDIObjectRef.
  412. }
  413. type
  414. MIDIUniqueID = SInt32;
  415. const
  416. kMIDIInvalidUniqueID = 0;
  417. // forward structure declarations
  418. type
  419. MIDIPacketListPtr = ^MIDIPacketList;
  420. MIDISysexSendRequestPtr = ^MIDISysexSendRequest;
  421. MIDINotificationPtr = ^MIDINotification;
  422. //=============================================================================
  423. //#pragma mark Callback Functions
  424. {!
  425. @typedef MIDINotifyProc
  426. @abstract A callback function for notifying clients of state changes.
  427. @discussion
  428. This callback function is called when some aspect of the current MIDI setup changes. It
  429. is called on the runloop (thread) on which MIDIClientCreate was first called.
  430. @param message
  431. A structure containing information about what changed.
  432. @param refCon
  433. The client's refCon passed to MIDIClientCreate.
  434. }
  435. MIDINotifyProc = procedure( (*const*) message: MIDINotificationPtr; refCon: UnivPtr );
  436. {!
  437. @typedef MIDIReadProc
  438. @abstract A function receiving MIDI input.
  439. @discussion
  440. This is a callback function through which a client receives incoming MIDI messages.
  441. A MIDIReadProc function pointer is passed to the MIDIInputPortCreate and
  442. MIDIDestinationCreate functions. The CoreMIDI framework will create a high-priority
  443. receive thread on your client's behalf, and from that thread, your MIDIReadProc will be
  444. called when incoming MIDI messages arrive. Because this function is called from a
  445. separate thread, be aware of the synchronization issues when accessing data in this
  446. callback.
  447. @param pktlist
  448. The incoming MIDI message(s).
  449. @param readProcRefCon
  450. The refCon you passed to MIDIInputPortCreate or
  451. MIDIDestinationCreate
  452. @param srcConnRefCon
  453. A refCon you passed to MIDIPortConnectSource, which
  454. identifies the source of the data.
  455. }
  456. MIDIReadProc = procedure( (*const*) pktlist: MIDIPacketListPtr; readProcRefCon: UnivPtr; srcConnRefCon: UnivPtr );
  457. {!
  458. @typedef MIDICompletionProc
  459. @abstract A function called when a system-exclusive event has been completely sent.
  460. @discussion
  461. Callback function to notify the client of the completion of a call to MIDISendSysex.
  462. @param request
  463. The MIDISysexSendRequest which has completed, or been
  464. aborted.
  465. }
  466. MIDICompletionProc = procedure( request: MIDISysexSendRequestPtr );
  467. //=============================================================================
  468. //#pragma mark Structures
  469. //#pragma pack(push, 4)
  470. {!
  471. @struct MIDIPacket
  472. @abstract A collection of simultaneous MIDI events.
  473. @field timeStamp
  474. The time at which the events occurred, if receiving MIDI,
  475. or, if sending MIDI, the time at which the events are to
  476. be played. Zero means "now." The time stamp applies
  477. to the first MIDI byte in the packet.
  478. @field length
  479. The number of valid MIDI bytes which follow, in data. (It
  480. may be larger than 256 bytes if the packet is dynamically
  481. allocated.)
  482. @field data
  483. A variable-length stream of MIDI messages. Running status
  484. is not allowed. In the case of system-exclusive
  485. messages, a packet may only contain a single message, or
  486. portion of one, with no other MIDI events.
  487. The MIDI messages in the packet must always be complete,
  488. except for system-exclusive.
  489. (This is declared to be 256 bytes in length so clients
  490. don't have to create custom data structures in simple
  491. situations.)
  492. }
  493. MIDIPacket = record
  494. timeStamp: MIDITimeStamp;
  495. length: UInt16;
  496. data: packed array [0..255] of Byte;
  497. end;
  498. MIDIPacketPtr = ^MIDIPacket;
  499. {!
  500. @struct MIDIPacketList
  501. @abstract A list of MIDI events being received from, or being sent to,
  502. one endpoint.
  503. @discussion
  504. The timestamps in the packet list must be in ascending order.
  505. Note that the packets in the list, while defined as an array, may not be
  506. accessed as an array, since they are variable-length. To iterate through
  507. the packets in a packet list, use a loop such as:
  508. <pre>
  509. @textblock
  510. MIDIPacket *packet = &packetList->packet[0];
  511. for (int i = 0; i < packetList->numPackets; ++i) (
  512. ...
  513. packet = MIDIPacketNext(packet);
  514. )
  515. @/textblock
  516. </pre>
  517. The MIDIPacketNext macro is especially important when considering that
  518. the alignment requirements of MIDIPacket may differ between CPU architectures.
  519. On Intel and PowerPC, MIDIPacket is unaligned.
  520. @field numPackets
  521. The number of MIDIPackets in the list.
  522. @field packet
  523. An open-ended array of variable-length MIDIPackets.
  524. }
  525. MIDIPacketList = record
  526. numPackets: UInt32;
  527. packet: array [0..0] of MIDIPacket;
  528. end;
  529. {$ALIGN POWER}
  530. {!
  531. @struct MIDISysexSendRequest
  532. @abstract A request to transmit a system-exclusive event.
  533. @field destination
  534. The endpoint to which the event is to be sent.
  535. @field data
  536. Initially, a pointer to the sys-ex event to be sent.
  537. MIDISendSysex will advance this pointer as bytes are
  538. sent.
  539. @field bytesToSend
  540. Initially, the number of bytes to be sent. MIDISendSysex
  541. will decrement this counter as bytes are sent.
  542. @field complete
  543. The client may set this to true at any time to abort
  544. transmission. The implementation sets this to true when
  545. all bytes have been sent.
  546. @field completionProc
  547. Called when all bytes have been sent, or after the client
  548. has set complete to true.
  549. @field completionRefCon
  550. Passed as a refCon to completionProc.
  551. @discussion
  552. This represents a request to send a single system-exclusive MIDI event to
  553. a MIDI destination asynchronously.
  554. }
  555. MIDISysexSendRequest = record
  556. destination: MIDIEndpointRef;
  557. data: (*const*) BytePtr;
  558. bytesToSend: UInt32;
  559. complete: Boolean;
  560. reserved: packed array [0..2] of Byte;
  561. completionProc: MIDICompletionProc;
  562. completionRefCon: UnivPtr;
  563. end;
  564. { moved here to make type available in MIDINotification }
  565. MIDINotificationMessageID = SInt32;
  566. {!
  567. @struct MIDINotification
  568. @abstract A message describing a system state change.
  569. @discussion
  570. A MIDINotification is a structure passed to a MIDINotifyProc, when CoreMIDI wishes to
  571. inform a client of a change in the state of the system.
  572. @field messageID
  573. type of message
  574. @field messageSize
  575. size of the entire message, including messageID and
  576. messageSize
  577. }
  578. MIDINotification = record
  579. messageID: MIDINotificationMessageID;
  580. messageSize: UInt32;
  581. // additional data may follow, depending on messageID
  582. end;
  583. {!
  584. @enum MIDINotificationMessageID
  585. @abstract Signifies the type of a MIDINotification.
  586. @constant kMIDIMsgSetupChanged Some aspect of the current MIDISetup
  587. has changed. No data. Should ignore this
  588. message if messages 2-6 are handled.
  589. @constant kMIDIMsgObjectAdded A device, entity or endpoint was added.
  590. Structure is MIDIObjectAddRemoveNotification.
  591. New in Mac OS X 10.2.
  592. @constant kMIDIMsgObjectRemoved A device, entity or endpoint was removed.
  593. Structure is MIDIObjectAddRemoveNotification.
  594. New in Mac OS X 10.2.
  595. @constant kMIDIMsgPropertyChanged An object's property was changed.
  596. Structure is MIDIObjectPropertyChangeNotification.
  597. New in Mac OS X 10.2.
  598. @constant kMIDIMsgThruConnectionsChanged A persistent MIDI Thru connection was created
  599. or destroyed. No data. New in Mac OS X 10.2.
  600. @constant kMIDIMsgSerialPortOwnerChanged A persistent MIDI Thru connection was created
  601. or destroyed. No data. New in Mac OS X 10.2.
  602. @constant kMIDIMsgIOError A driver I/O error occurred.
  603. }
  604. const
  605. // MIDINotificationMessageID
  606. kMIDIMsgSetupChanged = 1;
  607. kMIDIMsgObjectAdded = 2;
  608. kMIDIMsgObjectRemoved = 3;
  609. kMIDIMsgPropertyChanged = 4;
  610. kMIDIMsgThruConnectionsChanged = 5;
  611. kMIDIMsgSerialPortOwnerChanged = 6;
  612. kMIDIMsgIOError = 7;
  613. {!
  614. @struct MIDIObjectAddRemoveNotification
  615. @abstract A message describing the addition or removal of an object.
  616. @field messageID
  617. type of message
  618. @field messageSize
  619. size of the entire message, including messageID and messageSize
  620. @field parent
  621. the parent of the added or removed object (possibly NULL)
  622. @field parentType
  623. the type of the parent object (undefined if parent is NULL)
  624. @field child
  625. the added or removed object
  626. @field childType
  627. the type of the added or removed object
  628. }
  629. type
  630. MIDIObjectAddRemoveNotification = record
  631. messageID: MIDINotificationMessageID;
  632. messageSize: UInt32;
  633. parent: MIDIObjectRef;
  634. parentType: MIDIObjectType;
  635. child: MIDIObjectRef;
  636. childType: MIDIObjectType;
  637. end;
  638. {!
  639. @struct MIDIObjectPropertyChangeNotification
  640. @abstract A message describing the addition or removal of an object.
  641. @field messageID
  642. type of message
  643. @field messageSize
  644. size of the entire message, including messageID and messageSize
  645. @field object
  646. the object whose property has changed
  647. @field objectType
  648. the type of the object whose property has changed
  649. @field propertyName
  650. the name of the changed property
  651. }
  652. type
  653. MIDIObjectPropertyChangeNotification = record
  654. messageID: MIDINotificationMessageID;
  655. messageSize: UInt32;
  656. objct: MIDIObjectRef;
  657. objectType: MIDIObjectType;
  658. propertyName: CFStringRef;
  659. end;
  660. type
  661. MIDIIOErrorNotification = record
  662. messageID: MIDINotificationMessageID;
  663. messageSize: UInt32;
  664. driverDevice: MIDIDeviceRef;
  665. errorCode: OSStatus;
  666. end;
  667. //=============================================================================
  668. // Property name constants
  669. //=============================================================================
  670. {!
  671. @constant kMIDIPropertyName
  672. @discussion
  673. device/entity/endpoint property, string
  674. Devices, entities, and endpoints may all have names. The recommended way to display an
  675. endpoint's name is to ask for the endpoint name, and display only that name if it is
  676. unique. If it is non-unique, prepend the device name.
  677. A setup editor may allow the user to set the names of both driver-owned and external
  678. devices.
  679. }
  680. var kMIDIPropertyName: CFStringRef; external name '_kMIDIPropertyName'; (* attribute const *)
  681. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  682. {!
  683. @constant kMIDIPropertyManufacturer
  684. @discussion
  685. device/endpoint property, string
  686. Drivers should set this property on their devices.
  687. Setup editors may allow the user to set this property on external devices.
  688. Creators of virtual endpoints may set this property on their endpoints.
  689. }
  690. var kMIDIPropertyManufacturer: CFStringRef; external name '_kMIDIPropertyManufacturer'; (* attribute const *)
  691. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  692. {!
  693. @constant kMIDIPropertyModel
  694. @discussion
  695. device/endpoint property, string
  696. Drivers should set this property on their devices.
  697. Setup editors may allow the user to set this property on external devices.
  698. Creators of virtual endpoints may set this property on their endpoints.
  699. }
  700. var kMIDIPropertyModel: CFStringRef; external name '_kMIDIPropertyModel'; (* attribute const *)
  701. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  702. {!
  703. @constant kMIDIPropertyUniqueID
  704. @discussion
  705. devices, entities, endpoints all have unique ID's, integer
  706. The system assigns unique ID's to all objects. Creators of virtual endpoints may set
  707. this property on their endpoints, though doing so may fail if the chosen ID is not
  708. unique.
  709. }
  710. var kMIDIPropertyUniqueID: CFStringRef; external name '_kMIDIPropertyUniqueID'; (* attribute const *)
  711. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  712. {!
  713. @constant kMIDIPropertyDeviceID
  714. @discussion
  715. device/entity property, integer
  716. The entity's system-exclusive ID, in user-visible form
  717. Drivers may set this property on their devices or entities.
  718. Setup editors may allow the user to set this property on external devices.
  719. }
  720. var kMIDIPropertyDeviceID: CFStringRef; external name '_kMIDIPropertyDeviceID'; (* attribute const *)
  721. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  722. {!
  723. @constant kMIDIPropertyReceiveChannels
  724. @discussion
  725. endpoint property, integer
  726. The value is a bitmap of channels on which the object receives: 1=ch 1, 2=ch 2, 4=ch 3
  727. ... 0x8000=ch 16.
  728. Drivers may set this property on their entities or endpoints.
  729. Setup editors may allow the user to set this property on external endpoints.
  730. Virtual destination may set this property on their endpoints.
  731. }
  732. var kMIDIPropertyReceiveChannels: CFStringRef; external name '_kMIDIPropertyReceiveChannels'; (* attribute const *)
  733. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  734. {!
  735. @constant kMIDIPropertyTransmitChannels
  736. @discussion
  737. endpoint property, integer
  738. The value is a bitmap of channels on which the object transmits: 1=ch 1, 2=ch 2, 4=ch 3
  739. ... 0x8000=ch 16.
  740. }
  741. var kMIDIPropertyTransmitChannels: CFStringRef; external name '_kMIDIPropertyTransmitChannels'; (* attribute const *)
  742. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  743. {!
  744. @constant kMIDIPropertyMaxSysExSpeed
  745. @discussion
  746. device/entity/endpoint property, integer
  747. Set by the owning driver; should not be touched by other clients.
  748. The value is the maximum rate, in bytes/second, at which sysex messages may
  749. be sent reliably to this object. (The default value is 3125, as with MIDI 1.0)
  750. }
  751. var kMIDIPropertyMaxSysExSpeed: CFStringRef; external name '_kMIDIPropertyMaxSysExSpeed'; (* attribute const *)
  752. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  753. {!
  754. @constant kMIDIPropertyAdvanceScheduleTimeMuSec
  755. @discussion
  756. device/entity/endpoint property, integer
  757. Set by the owning driver; should not be touched by other clients. If it is non-zero,
  758. then it is a recommendation of how many microseconds in advance clients should schedule
  759. output. Clients should treat this value as a minimum. For devices with a non-zero
  760. advance schedule time, drivers will receive outgoing messages to the device at the time
  761. they are sent by the client, via MIDISend, and the driver is responsible for scheduling
  762. events to be played at the right times according to their timestamps.
  763. As of CoreMIDI 1.3, this property may also be set on virtual destinations (but only the
  764. creator of the destination should do so). When a client sends to a virtual destination
  765. with an advance schedule time of 0, the virtual destination receives its messages at
  766. their scheduled delivery time. If a virtual destination has a non-zero advance schedule
  767. time, it receives timestamped messages as soon as they are sent, and must do its own
  768. internal scheduling of received events.
  769. }
  770. var kMIDIPropertyAdvanceScheduleTimeMuSec: CFStringRef; external name '_kMIDIPropertyAdvanceScheduleTimeMuSec'; (* attribute const *)
  771. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  772. {!
  773. @constant kMIDIPropertyIsEmbeddedEntity
  774. @discussion
  775. entity/endpoint property, integer
  776. 0 if there are external MIDI connectors, 1 if not.
  777. }
  778. var kMIDIPropertyIsEmbeddedEntity: CFStringRef; external name '_kMIDIPropertyIsEmbeddedEntity'; (* attribute const *)
  779. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  780. {!
  781. @constant kMIDIPropertyIsBroadcast
  782. @discussion
  783. entity/endpoint property, integer
  784. 1 if the endpoint broadcasts messages to all of the other endpoints in the device, 0 if
  785. not. Set by the owning driver; should not be touched by other clients.
  786. }
  787. var kMIDIPropertyIsBroadcast: CFStringRef; external name '_kMIDIPropertyIsBroadcast'; (* attribute const *)
  788. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  789. {!
  790. @constant kMIDIPropertySingleRealtimeEntity
  791. @discussion
  792. device property, integer
  793. Some MIDI interfaces cannot route MIDI realtime messages to individual outputs; they are
  794. broadcast. On such devices the inverse is usually also true -- incoming realtime
  795. messages cannot be identified as originating from any particular source.
  796. When this property is set on a driver device, it signifies the 0-based index of the
  797. entity on which incoming realtime messages from the device will appear to have
  798. originated from.
  799. }
  800. var kMIDIPropertySingleRealtimeEntity: CFStringRef; external name '_kMIDIPropertySingleRealtimeEntity'; (* attribute const *)
  801. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  802. {!
  803. @constant kMIDIPropertyConnectionUniqueID
  804. @discussion
  805. device/entity/endpoint property, integer or CFDataRef
  806. UniqueID of an external device/entity/endpoint attached to this one. As of Mac OS X
  807. 10.3, Audio MIDI Setup maintains endpoint-to-external endpoint connections (in 10.2, it
  808. connected devices to devices).
  809. The property is non-existant or 0 if there is no connection.
  810. Beginning with CoreMIDI 1.3 (Mac OS X 10.2), this property may also be a CFDataRef containing an array of
  811. big-endian SInt32's, to allow specifying that a driver object connects to multiple
  812. external objects (via MIDI thru-ing or splitting).
  813. This property may also exist for external devices/entities/endpoints, in which case it
  814. signifies a MIDI Thru connection to another external device/entity/endpoint (again,
  815. it is strongly recommended that it be an endpoint).
  816. }
  817. var kMIDIPropertyConnectionUniqueID: CFStringRef; external name '_kMIDIPropertyConnectionUniqueID'; (* attribute const *)
  818. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  819. {!
  820. @constant kMIDIPropertyOffline
  821. @discussion
  822. device/entity/endpoint property, integer
  823. 1 = device is offline (is temporarily absent), 0 = present. Set by the owning driver, on
  824. the device; should not be touched by other clients. Property is inherited from the
  825. device by its entities and endpoints.
  826. }
  827. var kMIDIPropertyOffline: CFStringRef; external name '_kMIDIPropertyOffline'; (* attribute const *)
  828. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  829. {!
  830. @constant kMIDIPropertyPrivate
  831. @discussion
  832. device/entity/endpoint property, integer
  833. 1 = endpoint is private, hidden from other clients. May be set on a device or entity,
  834. but they will still appear in the API; only affects whether the owned endpoints are
  835. hidden.
  836. }
  837. var kMIDIPropertyPrivate: CFStringRef; external name '_kMIDIPropertyPrivate'; (* attribute const *)
  838. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  839. {!
  840. @constant kMIDIPropertyDriverOwner
  841. @discussion
  842. device/entity/endpoint property, string
  843. Name of the driver that owns a device. Set by the owning driver, on the device; should
  844. not be touched by other clients. Property is inherited from the device by its entities
  845. and endpoints.
  846. }
  847. var kMIDIPropertyDriverOwner: CFStringRef; external name '_kMIDIPropertyDriverOwner'; (* attribute const *)
  848. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  849. {!
  850. @constant kMIDIPropertyFactoryPatchNameFile
  851. @discussion
  852. device/entity/endpoint property, CFData containing AliasHandle.
  853. An alias to the device's current factory patch name file.
  854. Added in CoreMIDI 1.1 (Mac OS X 10.1). DEPRECATED as of CoreMIDI 1.3. Use
  855. kMIDIPropertyNameConfiguration instead.
  856. }
  857. var kMIDIPropertyFactoryPatchNameFile: CFStringRef; external name '_kMIDIPropertyFactoryPatchNameFile'; (* attribute const *)
  858. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_2, __IPHONE_NA, __IPHONE_NA) *)
  859. {!
  860. @constant kMIDIPropertyUserPatchNameFile
  861. @discussion
  862. device/entity/endpoint property, CFData containing AliasHandle
  863. An alias to the device's current user patch name file.
  864. Added in CoreMIDI 1.1 (Mac OS X 10.1). DEPRECATED as of CoreMIDI 1.3. Use
  865. kMIDIPropertyNameConfiguration instead.
  866. }
  867. var kMIDIPropertyUserPatchNameFile: CFStringRef; external name '_kMIDIPropertyUserPatchNameFile'; (* attribute const *)
  868. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_2, __IPHONE_NA, __IPHONE_NA) *)
  869. {!
  870. @constant kMIDIPropertyNameConfiguration
  871. @discussion
  872. device/entity/endpoint property, CFDictionary
  873. This specifies the device's current patch, note and control name values using the
  874. MIDINameDocument XML format. This specification requires the use of higher-level,
  875. OS-specific constructs outside of the specification, to fully define the current names
  876. for a device.
  877. The MIDINameConfiguration property is implementated as a CFDictionary:
  878. key "master" maps to a CFDataRef containing an AliasHandle referring to the device's
  879. master name document.
  880. key "banks" maps to a CFDictionaryRef. This dictionary's keys are CFStringRef names of
  881. patchBank elements in the master document, and its values are each a CFDictionaryRef:
  882. key "file" maps to a CFDataRef containing an AliasHandle to a document containing
  883. patches that override those in the master document, and key "patchNameList" maps to a
  884. CFStringRef which is the name of the patchNameList element in the overriding document.
  885. key "currentChannelNameSets" maps to a 16-element CFArrayRef, each element of which is a
  886. CFStringRef of the name of the current mode for each of the 16 MIDI channels.
  887. key "currentDeviceMode" maps to a CFStringRef containing the name of the device's mode.
  888. Clients setting this property must take particular care to preserve dictionary values
  889. other than the ones they are interested in changing, and to properly structure the
  890. dictionary.
  891. }
  892. var kMIDIPropertyNameConfiguration: CFStringRef; external name '_kMIDIPropertyNameConfiguration'; (* attribute const *)
  893. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  894. {!
  895. @constant kMIDIPropertyImage
  896. @discussion
  897. device property, CFStringRef which is a full POSIX path to a device or external device's
  898. icon, stored in any standard graphic file format such as JPEG, GIF, PNG and TIFF are all
  899. acceptable. (See CFURL for functions to convert between POSIX paths and other ways of
  900. specifying files.) The image's maximum size should be 128x128.
  901. Drivers should set the icon on the devices they add.
  902. A studio setup editor should allow the user to choose icons for external devices.
  903. }
  904. var kMIDIPropertyImage: CFStringRef; external name '_kMIDIPropertyImage'; (* attribute const *)
  905. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  906. {!
  907. @constant kMIDIPropertyDriverVersion
  908. @discussion
  909. device/entity/endpoint property, integer, returns the driver version API of the owning
  910. driver (only for driver- owned devices). Drivers need not set this property;
  911. applications should not write to it.
  912. }
  913. var kMIDIPropertyDriverVersion: CFStringRef; external name '_kMIDIPropertyDriverVersion'; (* attribute const *)
  914. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  915. {!
  916. @constant kMIDIPropertySupportsGeneralMIDI
  917. @discussion
  918. device/entity property, integer (0/1). Indicates whether the device or entity implements
  919. the General MIDI specification.
  920. }
  921. var kMIDIPropertySupportsGeneralMIDI: CFStringRef; external name '_kMIDIPropertySupportsGeneralMIDI'; (* attribute const *)
  922. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  923. {!
  924. @constant kMIDIPropertySupportsMMC
  925. @discussion
  926. device/entity property, integer (0/1). Indicates whether the device or entity implements
  927. the MIDI Machine Control portion of the MIDI specification.
  928. }
  929. var kMIDIPropertySupportsMMC: CFStringRef; external name '_kMIDIPropertySupportsMMC'; (* attribute const *)
  930. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  931. {!
  932. @constant kMIDIPropertyCanRoute
  933. @discussion
  934. device/entity property, integer (0/1). Indicates whether the device or entity can route
  935. MIDI messages to or from other external MIDI devices (as with MIDI patch bays). This
  936. should NOT be set on devices which are controlled by drivers.
  937. }
  938. var kMIDIPropertyCanRoute: CFStringRef; external name '_kMIDIPropertyCanRoute'; (* attribute const *)
  939. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  940. {!
  941. @constant kMIDIPropertyReceivesClock
  942. @discussion
  943. device/entity property, integer (0/1). Indicates whether the device or entity responds
  944. to MIDI beat clock messages.
  945. }
  946. var kMIDIPropertyReceivesClock: CFStringRef; external name '_kMIDIPropertyReceivesClock'; (* attribute const *)
  947. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  948. {!
  949. @constant kMIDIPropertyReceivesMTC
  950. @discussion
  951. device/entity property, integer (0/1). Indicates whether the device or entity responds
  952. to MIDI Time Code messages.
  953. }
  954. var kMIDIPropertyReceivesMTC: CFStringRef; external name '_kMIDIPropertyReceivesMTC'; (* attribute const *)
  955. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  956. {!
  957. @constant kMIDIPropertyReceivesNotes
  958. @discussion
  959. device/entity property, integer (0/1). Indicates whether the device or entity responds
  960. to MIDI Note On messages.
  961. }
  962. var kMIDIPropertyReceivesNotes: CFStringRef; external name '_kMIDIPropertyReceivesNotes'; (* attribute const *)
  963. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  964. {!
  965. @constant kMIDIPropertyReceivesProgramChanges
  966. @discussion
  967. device/entity property, integer (0/1). Indicates whether the device or entity responds
  968. to MIDI program change messages.
  969. }
  970. var kMIDIPropertyReceivesProgramChanges: CFStringRef; external name '_kMIDIPropertyReceivesProgramChanges'; (* attribute const *)
  971. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  972. {!
  973. @constant kMIDIPropertyReceivesBankSelectMSB
  974. @discussion
  975. device/entity property, integer (0/1). Indicates whether the device or entity responds
  976. to MIDI bank select MSB messages (control 0).
  977. }
  978. var kMIDIPropertyReceivesBankSelectMSB: CFStringRef; external name '_kMIDIPropertyReceivesBankSelectMSB'; (* attribute const *)
  979. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  980. {!
  981. @constant kMIDIPropertyReceivesBankSelectLSB
  982. @discussion
  983. device/entity property, integer (0/1). Indicates whether the device or entity responds
  984. to MIDI bank select LSB messages (control 32).
  985. }
  986. var kMIDIPropertyReceivesBankSelectLSB: CFStringRef; external name '_kMIDIPropertyReceivesBankSelectLSB'; (* attribute const *)
  987. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  988. {!
  989. @constant kMIDIPropertyTransmitsClock
  990. @discussion
  991. device/entity property, integer (0/1). Indicates whether the device or entity transmits
  992. MIDI beat clock messages.
  993. }
  994. var kMIDIPropertyTransmitsClock: CFStringRef; external name '_kMIDIPropertyTransmitsClock'; (* attribute const *)
  995. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  996. {!
  997. @constant kMIDIPropertyTransmitsMTC
  998. @discussion
  999. device/entity property, integer (0/1). Indicates whether the device or entity transmits
  1000. MIDI Time Code messages.
  1001. }
  1002. var kMIDIPropertyTransmitsMTC: CFStringRef; external name '_kMIDIPropertyTransmitsMTC'; (* attribute const *)
  1003. {!
  1004. @constant kMIDIPropertyTransmitsNotes
  1005. @discussion
  1006. device/entity property, integer (0/1). Indicates whether the device or entity transmits
  1007. MIDI note messages.
  1008. }
  1009. var kMIDIPropertyTransmitsNotes: CFStringRef; external name '_kMIDIPropertyTransmitsNotes'; (* attribute const *)
  1010. {!
  1011. @constant kMIDIPropertyTransmitsProgramChanges
  1012. @discussion
  1013. device/entity property, integer (0/1). Indicates whether the device or entity transmits
  1014. MIDI program change messages.
  1015. }
  1016. var kMIDIPropertyTransmitsProgramChanges: CFStringRef; external name '_kMIDIPropertyTransmitsProgramChanges'; (* attribute const *)
  1017. {!
  1018. @constant kMIDIPropertyTransmitsBankSelectMSB
  1019. @discussion
  1020. device/entity property, integer (0/1). Indicates whether the device or entity transmits
  1021. MIDI bank select MSB messages (control 0).
  1022. }
  1023. var kMIDIPropertyTransmitsBankSelectMSB: CFStringRef; external name '_kMIDIPropertyTransmitsBankSelectMSB'; (* attribute const *)
  1024. {!
  1025. @constant kMIDIPropertyTransmitsBankSelectLSB
  1026. @discussion
  1027. device/entity property, integer (0/1). Indicates whether the device or entity transmits
  1028. MIDI bank select LSB messages (control 32).
  1029. }
  1030. var kMIDIPropertyTransmitsBankSelectLSB: CFStringRef; external name '_kMIDIPropertyTransmitsBankSelectLSB'; (* attribute const *)
  1031. {!
  1032. @constant kMIDIPropertyPanDisruptsStereo
  1033. @discussion
  1034. device/entity property, integer (0/1). Indicates whether the MIDI pan messages (control
  1035. 10), when sent to the device or entity, cause undesirable effects when playing stereo
  1036. sounds (e.g. converting the signal to mono).
  1037. }
  1038. var kMIDIPropertyPanDisruptsStereo: CFStringRef; external name '_kMIDIPropertyPanDisruptsStereo'; (* attribute const *)
  1039. {!
  1040. @constant kMIDIPropertyIsSampler
  1041. @discussion
  1042. device/entity property, integer (0/1). Indicates whether the device or entity plays
  1043. audio samples in response to MIDI note messages.
  1044. }
  1045. var kMIDIPropertyIsSampler: CFStringRef; external name '_kMIDIPropertyIsSampler'; (* attribute const *)
  1046. {!
  1047. @constant kMIDIPropertyIsDrumMachine
  1048. @discussion
  1049. device/entity property, integer (0/1). Indicates whether the device or entity's sound
  1050. presets tend to be collections of non-transposable samples (e.g. drum kits).
  1051. }
  1052. var kMIDIPropertyIsDrumMachine: CFStringRef; external name '_kMIDIPropertyIsDrumMachine'; (* attribute const *)
  1053. {!
  1054. @constant kMIDIPropertyIsMixer
  1055. @discussion
  1056. device/entity property, integer (0/1). Indicates whether the device or entity mixes
  1057. external audio signals, controlled by MIDI messages.
  1058. }
  1059. var kMIDIPropertyIsMixer: CFStringRef; external name '_kMIDIPropertyIsMixer'; (* attribute const *)
  1060. {!
  1061. @constant kMIDIPropertyIsEffectUnit
  1062. @discussion
  1063. device/entity property, integer (0/1). Indicates whether the device or entity is
  1064. primarily a MIDI-controlled audio effect unit (i.e. does not generate sound on its own).
  1065. }
  1066. var kMIDIPropertyIsEffectUnit: CFStringRef; external name '_kMIDIPropertyIsEffectUnit'; (* attribute const *)
  1067. {!
  1068. @constant kMIDIPropertyMaxReceiveChannels
  1069. @discussion
  1070. device/entity property, integer (0-16). Indicates the maximum number of MIDI channels on
  1071. which a device may simultaneously receive MIDI Channel Messages. Common values are 0
  1072. (devices which only respond to System Messages), 1 (non-multitimbral devices), and 16
  1073. (fully multitimbral devices). Other values are possible, for example devices which are
  1074. multi-timbral but have fewer than 16 "parts".
  1075. }
  1076. var kMIDIPropertyMaxReceiveChannels: CFStringRef; external name '_kMIDIPropertyMaxReceiveChannels'; (* attribute const *)
  1077. {!
  1078. @constant kMIDIPropertyMaxTransmitChannels
  1079. @discussion
  1080. device/entity property, integer (0/1). Indicates the maximum number of MIDI channels on
  1081. which a device may simultaneously transmit MIDI Channel Messages. Common values are 0, 1
  1082. and 16.
  1083. }
  1084. var kMIDIPropertyMaxTransmitChannels: CFStringRef; external name '_kMIDIPropertyMaxTransmitChannels'; (* attribute const *)
  1085. {!
  1086. @constant kMIDIPropertyDriverDeviceEditorApp
  1087. @discussion
  1088. device property, string, contains the full path to an application which knows how to
  1089. configure this driver-owned devices. Drivers may set this property on their owned
  1090. devices. Applications must not write to it.
  1091. }
  1092. var kMIDIPropertyDriverDeviceEditorApp: CFStringRef; external name '_kMIDIPropertyDriverDeviceEditorApp'; (* attribute const *)
  1093. (* __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
  1094. {!
  1095. @constant kMIDIPropertySupportsShowControl
  1096. @discussion
  1097. device/entity property, integer (0/1). Indicates whether the device implements the MIDI
  1098. Show Control specification.
  1099. }
  1100. var kMIDIPropertySupportsShowControl: CFStringRef; external name '_kMIDIPropertySupportsShowControl'; (* attribute const *)
  1101. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA) *)
  1102. {!
  1103. @constant kMIDIPropertyDisplayName
  1104. @discussion
  1105. device/entity/endpoint property, string.
  1106. Provides the Apple-recommended user-visible name for an endpoint, by combining the
  1107. device and endpoint names.
  1108. For objects other than endpoints, the display name is the same as the name.
  1109. }
  1110. var kMIDIPropertyDisplayName: CFStringRef; external name '_kMIDIPropertyDisplayName'; (* attribute const *)
  1111. (* __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA) *)
  1112. //==================================================================================================
  1113. //#pragma mark Clients
  1114. {!
  1115. @functiongroup Clients
  1116. }
  1117. {!
  1118. @function MIDIClientCreate
  1119. @abstract Creates a MIDIClient object.
  1120. @param name
  1121. The client's name.
  1122. @param notifyProc
  1123. An optional (may be NULL) callback function through which the client
  1124. will receive notifications of changes to the system.
  1125. @param notifyRefCon
  1126. A refCon passed back to notifyRefCon
  1127. @param outClient
  1128. On successful return, points to the newly-created MIDIClientRef.
  1129. @result An OSStatus result code.
  1130. @discussion
  1131. Note that notifyProc will always be called on the run loop which was current when
  1132. MIDIClientCreate was first called.
  1133. }
  1134. function MIDIClientCreate( name: CFStringRef; notifyProc: MIDINotifyProc; notifyRefCon: UnivPtr; var outClient: MIDIClientRef ): OSStatus; external name '_MIDIClientCreate';
  1135. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1136. {!
  1137. @function MIDIClientDispose
  1138. @abstract Disposes a MIDIClient object.
  1139. @param client
  1140. The client to dispose.
  1141. @result An OSStatus result code.
  1142. @discussion
  1143. It is not essential to call this function; the CoreMIDI framework will automatically
  1144. dispose all MIDIClients when an application terminates.
  1145. }
  1146. function MIDIClientDispose( client: MIDIClientRef ): OSStatus; external name '_MIDIClientDispose';
  1147. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1148. //==================================================================================================
  1149. //#pragma mark Ports
  1150. {!
  1151. @functiongroup Ports
  1152. }
  1153. {!
  1154. @function MIDIInputPortCreate
  1155. @abstract Creates an input port through which the client may receive
  1156. incoming MIDI messages from any MIDI source.
  1157. @param client
  1158. The client to own the newly-created port.
  1159. @param portName
  1160. The name of the port.
  1161. @param readProc
  1162. The MIDIReadProc which will be called with incoming MIDI,
  1163. from sources connected to this port.
  1164. @param refCon
  1165. The refCon passed to readHook.
  1166. @param outPort
  1167. On successful return, points to the newly-created
  1168. MIDIPort.
  1169. @result An OSStatus result code.
  1170. @discussion
  1171. After creating a port, use MIDIPortConnectSource to establish an input connection from
  1172. any number of sources to your port.
  1173. readProc will be called on a separate high-priority thread owned by CoreMIDI.
  1174. }
  1175. function MIDIInputPortCreate( client: MIDIClientRef; portName: CFStringRef; readProc: MIDIReadProc; refCon: UnivPtr; var outPort: MIDIPortRef ): OSStatus; external name '_MIDIInputPortCreate';
  1176. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1177. {!
  1178. @function MIDIOutputPortCreate
  1179. @abstract Creates an output port through which the client may send
  1180. outgoing MIDI messages to any MIDI destination.
  1181. @param client
  1182. The client to own the newly-created port
  1183. @param portName
  1184. The name of the port.
  1185. @param outPort
  1186. On successful return, points to the newly-created
  1187. MIDIPort.
  1188. @result An OSStatus result code.
  1189. @discussion
  1190. Output ports provide a mechanism for MIDI merging. CoreMIDI assumes that each output
  1191. port will be responsible for sending only a single MIDI stream to each destination,
  1192. although a single port may address all of the destinations in the system.
  1193. Multiple output ports are only necessary when an application is capable of directing
  1194. multiple simultaneous MIDI streams to the same destination.
  1195. }
  1196. function MIDIOutputPortCreate( client: MIDIClientRef; portName: CFStringRef; var outPort: MIDIPortRef ): OSStatus; external name '_MIDIOutputPortCreate';
  1197. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1198. {!
  1199. @function MIDIPortDispose
  1200. @abstract Disposes a MIDIPort object.
  1201. @param port
  1202. The port to dispose.
  1203. @result An OSStatus result code.
  1204. @discussion
  1205. It is not usually necessary to call this function; when an application's MIDIClient's
  1206. are automatically disposed at termination, or explicitly, via MIDIClientDispose, the
  1207. client's ports are automatically disposed at that time.
  1208. }
  1209. function MIDIPortDispose( port: MIDIPortRef ): OSStatus; external name '_MIDIPortDispose';
  1210. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1211. {!
  1212. @function MIDIPortConnectSource
  1213. @abstract Establishes a connection from a source to a client's input port.
  1214. @param port
  1215. The port to which to create the connection. This port's
  1216. readProc is called with incoming MIDI from the source.
  1217. @param source
  1218. The source from which to create the connection.
  1219. @param connRefCon
  1220. This refCon is passed to the MIDIReadProc, as a way to
  1221. identify the source.
  1222. @result An OSStatus result code.
  1223. @discussion
  1224. }
  1225. function MIDIPortConnectSource( port: MIDIPortRef; source: MIDIEndpointRef; connRefCon: UnivPtr ): OSStatus; external name '_MIDIPortConnectSource';
  1226. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1227. {!
  1228. @function MIDIPortDisconnectSource
  1229. @abstract Closes a previously-established source-to-input port
  1230. connection.
  1231. @param port
  1232. The port whose connection is being closed.
  1233. @param source
  1234. The source from which to close a connection to the
  1235. specified port.
  1236. @result An OSStatus result code.
  1237. @discussion
  1238. }
  1239. function MIDIPortDisconnectSource( port: MIDIPortRef; source: MIDIEndpointRef ): OSStatus; external name '_MIDIPortDisconnectSource';
  1240. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1241. //==================================================================================================
  1242. //#pragma mark Devices
  1243. {!
  1244. @functiongroup Devices
  1245. }
  1246. {!
  1247. @function MIDIGetNumberOfDevices
  1248. @abstract Returns the number of devices in the system.
  1249. @result The number of devices in the system, or 0 if an error
  1250. occurred.
  1251. }
  1252. function MIDIGetNumberOfDevices: ItemCount; external name '_MIDIGetNumberOfDevices';
  1253. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1254. {!
  1255. @function MIDIGetDevice
  1256. @abstract Returns one of the devices in the system.
  1257. @param deviceIndex0
  1258. The index (0...MIDIGetNumberOfDevices()-1) of the device
  1259. to return.
  1260. @result A reference to a device, or NULL if an error occurred.
  1261. @discussion
  1262. Use this to enumerate the devices in the system.
  1263. To enumerate the entities in the system, you can walk through the devices, then walk
  1264. through the devices' entities.
  1265. Note: If a client iterates through the devices and entities in the system, it will not
  1266. ever visit any virtual sources and destinations created by other clients. Also, a
  1267. device iteration will return devices which are "offline" (were present in the past but
  1268. are not currently present), while iterations through the system's sources and
  1269. destinations will not include the endpoints of offline devices.
  1270. Thus clients should usually use MIDIGetNumberOfSources, MIDIGetSource,
  1271. MIDIGetNumberOfDestinations and MIDIGetDestination, rather iterating through devices and
  1272. entities to locate endpoints.
  1273. }
  1274. function MIDIGetDevice( deviceIndex0: ItemCount ): MIDIDeviceRef; external name '_MIDIGetDevice';
  1275. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1276. {!
  1277. @function MIDIDeviceGetNumberOfEntities
  1278. @abstract Returns the number of entities in a given device.
  1279. @param device
  1280. The device being queried.
  1281. @result The number of entities the device contains, or 0 if an
  1282. error occurred.
  1283. }
  1284. function MIDIDeviceGetNumberOfEntities( device: MIDIDeviceRef ): ItemCount; external name '_MIDIDeviceGetNumberOfEntities';
  1285. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1286. {!
  1287. @function MIDIDeviceGetEntity
  1288. @abstract Returns one of a given device's entities.
  1289. @param device
  1290. The device being queried.
  1291. @param entityIndex0
  1292. The index (0...MIDIDeviceGetNumberOfEntities(device)-1)
  1293. of the entity to return
  1294. @result A reference to an entity, or NULL if an error occurred.
  1295. }
  1296. function MIDIDeviceGetEntity( device: MIDIDeviceRef; entityIndex0: ItemCount ): MIDIEntityRef; external name '_MIDIDeviceGetEntity';
  1297. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1298. //==================================================================================================
  1299. //#pragma mark Entities
  1300. {!
  1301. @functiongroup Entities
  1302. }
  1303. {!
  1304. @function MIDIEntityGetNumberOfSources
  1305. @abstract Returns the number of sources in a given entity.
  1306. @param entity
  1307. The entity being queried
  1308. @result The number of sources the entity contains, or 0 if an
  1309. error occurred.
  1310. }
  1311. function MIDIEntityGetNumberOfSources( entity: MIDIEntityRef ): ItemCount; external name '_MIDIEntityGetNumberOfSources';
  1312. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1313. {!
  1314. @function MIDIEntityGetSource
  1315. @abstract Returns one of a given entity's sources.
  1316. @param entity
  1317. The entity being queried.
  1318. @param sourceIndex0
  1319. The index (0...MIDIEntityGetNumberOfSources(entity)-1) of
  1320. the source to return
  1321. @result A reference to a source, or NULL if an error occurred.
  1322. }
  1323. function MIDIEntityGetSource( entity: MIDIEntityRef; sourceIndex0: ItemCount ): MIDIEndpointRef; external name '_MIDIEntityGetSource';
  1324. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1325. {!
  1326. @function MIDIEntityGetNumberOfDestinations
  1327. @abstract Returns the number of destinations in a given entity.
  1328. @param entity
  1329. The entity being queried
  1330. @result The number of destinations the entity contains, or 0
  1331. if an error occurred.
  1332. }
  1333. function MIDIEntityGetNumberOfDestinations( entity: MIDIEntityRef ): ItemCount; external name '_MIDIEntityGetNumberOfDestinations';
  1334. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1335. {!
  1336. @function MIDIEntityGetDestination
  1337. @abstract Returns one of a given entity's destinations.
  1338. @param entity
  1339. The entity being queried.
  1340. @param destIndex0
  1341. The index (0...MIDIEntityGetNumberOfDestinations(entity)
  1342. - 1) of the destination to return
  1343. @result A reference to a destination, or NULL if an error occurred.
  1344. }
  1345. function MIDIEntityGetDestination( entity: MIDIEntityRef; destIndex0: ItemCount ): MIDIEndpointRef; external name '_MIDIEntityGetDestination';
  1346. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1347. {!
  1348. @function MIDIEntityGetDevice
  1349. @abstract Returns an entity's device.
  1350. @param inEntity
  1351. The entity being queried.
  1352. @param outDevice
  1353. On successful return, the entity's owning device.
  1354. }
  1355. function MIDIEntityGetDevice( inEntity: MIDIEntityRef; var outDevice: MIDIDeviceRef ): OSStatus; external name '_MIDIEntityGetDevice';
  1356. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  1357. //==================================================================================================
  1358. //#pragma mark Endpoints
  1359. {!
  1360. @functiongroup Endpoints
  1361. }
  1362. {!
  1363. @function MIDIGetNumberOfSources
  1364. @abstract Returns the number of sources in the system.
  1365. @result The number of sources in the system, or 0 if an error
  1366. occurred.
  1367. }
  1368. function MIDIGetNumberOfSources: ItemCount; external name '_MIDIGetNumberOfSources';
  1369. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1370. {!
  1371. @function MIDIGetSource
  1372. @abstract Returns one of the sources in the system.
  1373. @param sourceIndex0
  1374. The index (0...MIDIGetNumberOfSources()-1) of the source
  1375. to return
  1376. @result A reference to a source, or NULL if an error occurred.
  1377. }
  1378. function MIDIGetSource( sourceIndex0: ItemCount ): MIDIEndpointRef; external name '_MIDIGetSource';
  1379. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1380. {!
  1381. @function MIDIGetNumberOfDestinations
  1382. @abstract Returns the number of destinations in the system.
  1383. @result The number of destinations in the system, or 0 if an error
  1384. occurred.
  1385. }
  1386. function MIDIGetNumberOfDestinations: ItemCount; external name '_MIDIGetNumberOfDestinations';
  1387. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1388. {!
  1389. @function MIDIGetDestination
  1390. @abstract Returns one of the destinations in the system.
  1391. @param destIndex0
  1392. The index (0...MIDIGetNumberOfDestinations()-1) of the
  1393. destination to return
  1394. @result A reference to a destination, or NULL if an error occurred.
  1395. }
  1396. function MIDIGetDestination( destIndex0: ItemCount ): MIDIEndpointRef; external name '_MIDIGetDestination';
  1397. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1398. {!
  1399. @function MIDIEndpointGetEntity
  1400. @abstract Returns an endpoint's entity.
  1401. @param inEndpoint
  1402. The endpoint being queried.
  1403. @param outEntity
  1404. On exit, the endpoint's owning entity, or NULL if none.
  1405. @discussion
  1406. Virtual sources and destinations don't have entities.
  1407. }
  1408. function MIDIEndpointGetEntity( inEndpoint: MIDIEndpointRef; var outEntity: MIDIEntityRef ): OSStatus; external name '_MIDIEndpointGetEntity';
  1409. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  1410. {!
  1411. @function MIDIDestinationCreate
  1412. @abstract Creates a virtual destination in a client.
  1413. @param client
  1414. The client owning the virtual destination.
  1415. @param name
  1416. The name of the virtual destination.
  1417. @param readProc
  1418. The MIDIReadProc to be called when a client sends MIDI to
  1419. the virtual destination.
  1420. @param refCon
  1421. The refCon to be passed to the readProc.
  1422. @param outDest
  1423. On successful return, a pointer to the newly-created
  1424. destination.
  1425. @result An OSStatus result code.
  1426. @discussion
  1427. The specified readProc gets called when clients send MIDI to your virtual destination.
  1428. Drivers need not call this; when they create devices and entities, sources and
  1429. destinations are created at that time.
  1430. After creating a virtual destination, it's a good idea to assign it the same unique ID
  1431. it had the last time your application created it. (Although you should be prepared for
  1432. this to fail in the unlikely event of a collision.) This will permit other clients
  1433. to retain persistent references to your virtual destination more easily.
  1434. See the discussion of kMIDIPropertyAdvanceScheduleTimeMuSec for notes about the
  1435. relationship between when a sender sends MIDI to the destination and when it is
  1436. received.
  1437. }
  1438. function MIDIDestinationCreate( client: MIDIClientRef; name: CFStringRef; readProc: MIDIReadProc; refCon: UnivPtr; var outDest: MIDIEndpointRef ): OSStatus; external name '_MIDIDestinationCreate';
  1439. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1440. {!
  1441. @function MIDISourceCreate
  1442. @abstract Creates a virtual source in a client.
  1443. @param client
  1444. The client owning the virtual source.
  1445. @param name
  1446. The name of the virtual source.
  1447. @param outSrc
  1448. On successful return, a pointer to the newly-created
  1449. source.
  1450. @result An OSStatus result code.
  1451. @discussion
  1452. Drivers need not call this; when they create devices and entities, sources and
  1453. destinations are created at that time.
  1454. After creating a virtual source, use MIDIReceived to transmit MIDI messages from your
  1455. virtual source to any clients connected to the virtual source.
  1456. After creating a virtual source, it's a good idea to assign it the same unique ID it had
  1457. the last time your application created it. (Although you should be prepared for this to
  1458. fail in the unlikely event of a collision.) This will permit other clients to retain
  1459. persistent references to your virtual source more easily.
  1460. }
  1461. function MIDISourceCreate( client: MIDIClientRef; name: CFStringRef; var outSrc: MIDIEndpointRef ): OSStatus; external name '_MIDISourceCreate';
  1462. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1463. {!
  1464. @function MIDIEndpointDispose
  1465. @abstract Disposes a virtual source or destination your client created.
  1466. @param endpt
  1467. The endpoint to be disposed.
  1468. @result An OSStatus result code.
  1469. }
  1470. function MIDIEndpointDispose( endpt: MIDIEndpointRef ): OSStatus; external name '_MIDIEndpointDispose';
  1471. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1472. //==================================================================================================
  1473. //#pragma mark External Devices
  1474. {!
  1475. @functiongroup External Devices
  1476. }
  1477. {!
  1478. @function MIDIGetNumberOfExternalDevices
  1479. @abstract Returns the number of external MIDI devices in the system.
  1480. @result The number of external devices in the system, or 0 if an error
  1481. occurred.
  1482. @discussion
  1483. External MIDI devices are MIDI devices connected to driver endpoints via a standard MIDI
  1484. cable. Their presence is completely optional, only when a UI (such as Audio MIDI Setup)
  1485. adds them.
  1486. }
  1487. function MIDIGetNumberOfExternalDevices: ItemCount; external name '_MIDIGetNumberOfExternalDevices';
  1488. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  1489. {!
  1490. @function MIDIGetExternalDevice
  1491. @abstract Returns one of the external devices in the system.
  1492. @param deviceIndex0
  1493. The index (0...MIDIGetNumberOfDevices()-1) of the device
  1494. to return.
  1495. @result A reference to a device, or NULL if an error occurred.
  1496. @discussion
  1497. Use this to enumerate the external devices in the system.
  1498. }
  1499. function MIDIGetExternalDevice( deviceIndex0: ItemCount ): MIDIDeviceRef; external name '_MIDIGetExternalDevice';
  1500. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  1501. //==================================================================================================
  1502. //#pragma mark Objects and Properties
  1503. {!
  1504. @functiongroup Objects and Properties
  1505. }
  1506. {!
  1507. @function MIDIObjectGetIntegerProperty
  1508. @abstract Gets an object's integer-type property.
  1509. @param obj
  1510. The object whose property is to be returned.
  1511. @param propertyID
  1512. Name of the property to return.
  1513. @param outValue
  1514. On successful return, the value of the property.
  1515. @result An OSStatus result code.
  1516. @discussion
  1517. (See the MIDIObjectRef documentation for information about properties.)
  1518. }
  1519. function MIDIObjectGetIntegerProperty( obj: MIDIObjectRef; propertyID: CFStringRef; var outValue: SInt32 ): OSStatus; external name '_MIDIObjectGetIntegerProperty';
  1520. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1521. {!
  1522. @function MIDIObjectSetIntegerProperty
  1523. @abstract Sets an object's integer-type property.
  1524. @param obj
  1525. The object whose property is to be altered.
  1526. @param propertyID
  1527. Name of the property to set.
  1528. @param value
  1529. New value of the property.
  1530. @result An OSStatus result code.
  1531. @discussion
  1532. (See the MIDIObjectRef documentation for information about properties.)
  1533. }
  1534. function MIDIObjectSetIntegerProperty( obj: MIDIObjectRef; propertyID: CFStringRef; value: SInt32 ): OSStatus; external name '_MIDIObjectSetIntegerProperty';
  1535. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1536. {!
  1537. @function MIDIObjectGetStringProperty
  1538. @abstract Gets an object's string-type property.
  1539. @param obj
  1540. The object whose property is to be returned.
  1541. @param propertyID
  1542. Name of the property to return.
  1543. @param str
  1544. On successful return, the value of the property.
  1545. @result An OSStatus result code.
  1546. @discussion
  1547. (See the MIDIObjectRef documentation for information about properties.)
  1548. }
  1549. function MIDIObjectGetStringProperty( obj: MIDIObjectRef; propertyID: CFStringRef; var str: CFStringRef ): OSStatus; external name '_MIDIObjectGetStringProperty';
  1550. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1551. {!
  1552. @function MIDIObjectSetStringProperty
  1553. @abstract Sets an object's string-type property.
  1554. @param obj
  1555. The object whose property is to be altered.
  1556. @param propertyID
  1557. Name of the property to set.
  1558. @param str
  1559. New value of the property.
  1560. @result An OSStatus result code.
  1561. @discussion
  1562. (See the MIDIObjectRef documentation for information about properties.)
  1563. }
  1564. function MIDIObjectSetStringProperty( obj: MIDIObjectRef; propertyID: CFStringRef; str: CFStringRef ): OSStatus; external name '_MIDIObjectSetStringProperty';
  1565. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1566. {!
  1567. @function MIDIObjectGetDataProperty
  1568. @abstract Gets an object's data-type property.
  1569. @discussion
  1570. (See the MIDIObjectRef documentation for information
  1571. about properties.)
  1572. @param obj
  1573. The object whose property is to be returned.
  1574. @param propertyID
  1575. Name of the property to return.
  1576. @param outData
  1577. On successful return, the value of the property.
  1578. @result An OSStatus result code.
  1579. }
  1580. function MIDIObjectGetDataProperty( obj: MIDIObjectRef; propertyID: CFStringRef; var outData: CFDataRef ): OSStatus; external name '_MIDIObjectGetDataProperty';
  1581. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1582. {!
  1583. @function MIDIObjectSetDataProperty
  1584. @abstract Sets an object's data-type property.
  1585. @param obj
  1586. The object whose property is to be altered.
  1587. @param propertyID
  1588. Name of the property to set.
  1589. @param data
  1590. New value of the property.
  1591. @result An OSStatus result code.
  1592. @discussion
  1593. (See the MIDIObjectRef documentation for information about properties.)
  1594. }
  1595. function MIDIObjectSetDataProperty( obj: MIDIObjectRef; propertyID: CFStringRef; data: CFDataRef ): OSStatus; external name '_MIDIObjectSetDataProperty';
  1596. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1597. {!
  1598. @function MIDIObjectGetDictionaryProperty
  1599. @abstract Gets an object's dictionary-type property.
  1600. @param obj
  1601. The object whose property is to be returned.
  1602. @param propertyID
  1603. Name of the property to return.
  1604. @param outDict
  1605. On successful return, the value of the property.
  1606. @result An OSStatus result code.
  1607. @discussion
  1608. (See the MIDIObjectRef documentation for information about properties.)
  1609. }
  1610. function MIDIObjectGetDictionaryProperty( obj: MIDIObjectRef; propertyID: CFStringRef; var outDict: CFDictionaryRef ): OSStatus; external name '_MIDIObjectGetDictionaryProperty';
  1611. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  1612. {!
  1613. @function MIDIObjectSetDictionaryProperty
  1614. @abstract Sets an object's dictionary-type property.
  1615. @param obj
  1616. The object whose property is to be altered.
  1617. @param propertyID
  1618. Name of the property to set.
  1619. @param dict
  1620. New value of the property.
  1621. @result An OSStatus result code.
  1622. @discussion
  1623. (See the MIDIObjectRef documentation for information about properties.)
  1624. }
  1625. function MIDIObjectSetDictionaryProperty( obj: MIDIObjectRef; propertyID: CFStringRef; data: CFDictionaryRef ): OSStatus; external name '_MIDIObjectSetDictionaryProperty';
  1626. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  1627. {!
  1628. @function MIDIObjectGetProperties
  1629. @abstract Gets all of an object's properties.
  1630. @param obj
  1631. The object whose properties are to be returned.
  1632. @param outProperties
  1633. On successful return, the object's properties.
  1634. @param deep
  1635. true if the object's child objects are to be included
  1636. (e.g. a device's entities, or an entity's endpoints).
  1637. @result An OSStatus result code.
  1638. @discussion
  1639. Returns a CFPropertyList of all of an object's properties. The property list may be a
  1640. dictionary or an array. Dictionaries map property names (CFString) to values, which may
  1641. be CFNumber, CFString, or CFData. Arrays are arrays of such values.
  1642. Properties which an object inherits from its owning object (if any) are not included.
  1643. }
  1644. function MIDIObjectGetProperties( obj: MIDIObjectRef; var outProperties: CFPropertyListRef; deep: Boolean ): OSStatus; external name '_MIDIObjectGetProperties';
  1645. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  1646. {!
  1647. @function MIDIObjectRemoveProperty
  1648. @abstract Removes an object's property.
  1649. @param obj
  1650. The object whose property is to be removed.
  1651. @param propertyID
  1652. The property to be removed.
  1653. @result An OSStatus result code.
  1654. @discussion
  1655. }
  1656. function MIDIObjectRemoveProperty( obj: MIDIObjectRef; propertyID: CFStringRef ): OSStatus; external name '_MIDIObjectRemoveProperty';
  1657. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  1658. {!
  1659. @function MIDIObjectFindByUniqueID
  1660. @abstract Locates a device, external device, entity, or endpoint
  1661. by its uniqueID.
  1662. @param inUniqueID
  1663. The uniqueID of the object to search for. (This should
  1664. be the result of an earlier call to MIDIObjectGetIntegerProperty
  1665. for the property kMIDIPropertyUniqueID).
  1666. @param outObject
  1667. The returned object, or NULL if the object was not found or
  1668. an error occurred. This should be cast to the appropriate
  1669. type (MIDIDeviceRef, MIDIEntityRef, MIDIEndpointRef),
  1670. according to *outObjectType.
  1671. @param outObjectType
  1672. On exit, the type of object which was found; undefined
  1673. if none found.
  1674. @result An OSStatus error code, including kMIDIObjectNotFound if there
  1675. is no object with the specified uniqueID.
  1676. @discussion
  1677. }
  1678. function MIDIObjectFindByUniqueID( inUniqueID: MIDIUniqueID; var outObject: MIDIObjectRef; var outObjectType: MIDIObjectType ): OSStatus; external name '_MIDIObjectFindByUniqueID';
  1679. (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
  1680. //==================================================================================================
  1681. //#pragma mark MIDI I/O
  1682. {!
  1683. @functiongroup I/O
  1684. }
  1685. {!
  1686. @function MIDISend
  1687. @abstract Sends MIDI to a destination.
  1688. @param port
  1689. The output port through which the MIDI is to be sent.
  1690. @param dest
  1691. The destination to receive the events.
  1692. @param pktlist
  1693. The MIDI events to be sent.
  1694. @result An OSStatus result code.
  1695. @discussion
  1696. Events with future timestamps are scheduled for future delivery. CoreMIDI performs
  1697. any needed MIDI merging.
  1698. }
  1699. function MIDISend( port: MIDIPortRef; dest: MIDIEndpointRef; const (*var*) pktlist: MIDIPacketList ): OSStatus; external name '_MIDISend';
  1700. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1701. {!
  1702. @function MIDISendSysex
  1703. @abstract Sends a single system-exclusive event, asynchronously.
  1704. @param request
  1705. Contains the destination, and a pointer to the MIDI data to be sent.
  1706. @result An OSStatus result code.
  1707. @discussion
  1708. request->data must point to a single MIDI system-exclusive message, or portion thereof.
  1709. }
  1710. function MIDISendSysex( var request: MIDISysexSendRequest ): OSStatus; external name '_MIDISendSysex';
  1711. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1712. {!
  1713. @function MIDIReceived
  1714. @abstract Distributes incoming MIDI from a source to the client input ports
  1715. which are connected to that source.
  1716. @param src
  1717. The source which is transmitting MIDI.
  1718. @param pktlist
  1719. The MIDI events to be transmitted.
  1720. @result An OSStatus result code.
  1721. @discussion
  1722. Drivers should call this function when receiving MIDI from a source.
  1723. Clients which have created virtual sources, using MIDISourceCreate, should call this
  1724. function when the source is generating MIDI.
  1725. Unlike MIDISend(), a timestamp of 0 is not equivalent to "now"; the driver or virtual
  1726. source is responsible for putting proper timestamps in the packets.
  1727. }
  1728. function MIDIReceived( src: MIDIEndpointRef; const (*var*) pktlist: MIDIPacketList ): OSStatus; external name '_MIDIReceived';
  1729. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1730. {!
  1731. @function MIDIFlushOutput
  1732. @abstract Unschedules previously-sent packets.
  1733. @param dest
  1734. All pending events scheduled to be sent to this destination
  1735. are unscheduled. If NULL, the operation applies to
  1736. all destinations.
  1737. @discussion
  1738. Clients may use MIDIFlushOutput to cancel the sending of packets that were previously
  1739. scheduled for future delivery.
  1740. }
  1741. function MIDIFlushOutput( dest: MIDIEndpointRef ): OSStatus; external name '_MIDIFlushOutput';
  1742. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  1743. {!
  1744. @function MIDIRestart
  1745. @abstract Stops and restarts MIDI I/O.
  1746. @discussion
  1747. This is useful for forcing CoreMIDI to ask its drivers to rescan for hardware.
  1748. @result An OSStatus result code.
  1749. }
  1750. function MIDIRestart: OSStatus; external name '_MIDIRestart';
  1751. (* __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_NA) *)
  1752. //==================================================================================================
  1753. //#pragma mark Packet Lists
  1754. {!
  1755. @functiongroup Packet Lists
  1756. }
  1757. {*!
  1758. @function MIDIPacketNext
  1759. @abstract Advances a MIDIPacket pointer to the MIDIPacket which immediately follows it
  1760. in memory if it is part of a MIDIPacketList.
  1761. @param pkt
  1762. A pointer to a MIDIPacket in a MIDIPacketList.
  1763. @result The subsequent packet in the MIDIPacketList.
  1764. @discussion
  1765. This is implemented as a macro for efficiency and to avoid const problems.
  1766. *}
  1767. //#define MIDIPacketNext(pkt) ((MIDIPacket *)&(pkt)->data[(pkt)->length])
  1768. function MIDIPacketNext(pkt : MIDIPacketPtr) : MIDIPacketPtr; inline;
  1769. {!
  1770. @function MIDIPacketListInit
  1771. @abstract Prepares a MIDIPacketList to be built up dynamically.
  1772. @param pktlist
  1773. The packet list to be initialized.
  1774. @result A pointer to the first MIDIPacket in the packet list.
  1775. }
  1776. function MIDIPacketListInit( var pktlist: MIDIPacketList ): MIDIPacketPtr; external name '_MIDIPacketListInit';
  1777. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1778. {!
  1779. @function MIDIPacketListAdd
  1780. @abstract Adds a MIDI event to a MIDIPacketList.
  1781. @param pktlist
  1782. The packet list to which the event is to be added.
  1783. @param listSize
  1784. The size, in bytes, of the packet list.
  1785. @param curPacket
  1786. A packet pointer returned by a previous call to
  1787. MIDIPacketListInit or MIDIPacketListAdd for this packet
  1788. list.
  1789. @param time
  1790. The new event's time.
  1791. @param nData
  1792. The length of the new event, in bytes.
  1793. @param data
  1794. The new event. May be a single MIDI event, or a partial
  1795. sys-ex event. Running status is <b>not</b> permitted.
  1796. @result Returns null if there was not room in the packet for the
  1797. event; otherwise returns a packet pointer which should be
  1798. passed as curPacket in a subsequent call to this function.
  1799. @discussion
  1800. The maximum size of a packet list is 65536 bytes. Large sysex messages must be sent in
  1801. smaller packet lists.
  1802. }
  1803. function MIDIPacketListAdd( var pktlist: MIDIPacketList; listSize: ByteCount; var curPacket: MIDIPacket; time: MIDITimeStamp; nData: ByteCount; const (*var*) data: Byte ): MIDIPacketPtr; external name '_MIDIPacketListAdd';
  1804. (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  1805. {$endc} { TARGET_OS_MAC }
  1806. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  1807. implementation
  1808. {$ifc TARGET_OS_MAC}
  1809. {$R-}
  1810. function MIDIPacketNext(pkt : MIDIPacketPtr) : MIDIPacketPtr; inline;
  1811. begin
  1812. MIDIPacketNext := MIDIPacketPtr(@pkt^.data[pkt^.length])
  1813. end;
  1814. {$endc} { TARGET_OS_MAC }
  1815. end.
  1816. {$endc} {not MACOSALLINCLUDE}