SpeechRecognition.pas 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. {
  2. File: SpeechRecognition.p
  3. Contains: Apple Speech Recognition Toolbox Interfaces.
  4. Version: Technology: PlainTalk 1.5
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1992-2002 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit SpeechRecognition;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,Files,AEDataModel,MixedMode;
  92. {$ALIGN MAC68K}
  93. { Error Codes [Speech recognition gets -5100 through -5199] }
  94. const
  95. kSRNotAvailable = -5100; { the service requested is not avail or applicable }
  96. kSRInternalError = -5101; { a system internal or hardware error condition }
  97. kSRComponentNotFound = -5102; { a needed system resource was not located }
  98. kSROutOfMemory = -5103; { an out of memory error occurred in the toolbox memory space }
  99. kSRNotASpeechObject = -5104; { the object specified is no longer or never was valid }
  100. kSRBadParameter = -5105; { an invalid parameter was specified }
  101. kSRParamOutOfRange = -5106; { when we say 0-100, don't pass in 101. }
  102. kSRBadSelector = -5107; { an unrecognized selector was specified }
  103. kSRBufferTooSmall = -5108; { returned from attribute access functions }
  104. kSRNotARecSystem = -5109; { the object used was not a SRRecognitionSystem }
  105. kSRFeedbackNotAvail = -5110; { there is no feedback window associated with SRRecognizer }
  106. kSRCantSetProperty = -5111; { a non-settable property was specified }
  107. kSRCantGetProperty = -5112; { a non-gettable property was specified }
  108. kSRCantSetDuringRecognition = -5113; { the property can't be set while recognition is in progress -- do before or between utterances. }
  109. kSRAlreadyListening = -5114; { in response to SRStartListening }
  110. kSRNotListeningState = -5115; { in response to SRStopListening }
  111. kSRModelMismatch = -5116; { no acoustical models are avail to match request }
  112. kSRNoClientLanguageModel = -5117; { trying to access a non-specified SRLanguageModel }
  113. kSRNoPendingUtterances = -5118; { nothing to continue search on }
  114. kSRRecognitionCanceled = -5119; { an abort error occurred during search }
  115. kSRRecognitionDone = -5120; { search has finished, but nothing was recognized }
  116. kSROtherRecAlreadyModal = -5121; { another recognizer is modal at the moment, so can't set this recognizer's kSRBlockModally property right now }
  117. kSRHasNoSubItems = -5122; { SRCountItems or related routine was called on an object without subelements -- e.g. a word -- rather than phrase, path, or LM. }
  118. kSRSubItemNotFound = -5123; { returned when accessing a non-existent sub item of a container }
  119. kSRLanguageModelTooBig = -5124; { Cant build language models so big }
  120. kSRAlreadyReleased = -5125; { this object has already been released before }
  121. kSRAlreadyFinished = -5126; { the language model can't be finished twice }
  122. kSRWordNotFound = -5127; { the spelling couldn't be found in lookup(s) }
  123. kSRNotFinishedWithRejection = -5128; { property not found because the LMObj is not finished with rejection }
  124. kSRExpansionTooDeep = -5129; { Language model is left recursive or is embedded too many levels }
  125. kSRTooManyElements = -5130; { Too many elements added to phrase or path or other langauge model object }
  126. kSRCantAdd = -5131; { Can't add given type of object to the base SRLanguageObject (e.g.in SRAddLanguageObject) }
  127. kSRSndInSourceDisconnected = -5132; { Sound input source is disconnected }
  128. kSRCantReadLanguageObject = -5133; { An error while trying to create new Language object from file or pointer -- possibly bad format }
  129. { non-release debugging error codes are included here }
  130. kSRNotImplementedYet = -5199; { you'd better wait for this feature in a future release }
  131. { Type Definitions }
  132. type
  133. SRSpeechObject = ^SInt32; { an opaque 32-bit type }
  134. SRSpeechObjectPtr = ^SRSpeechObject; { when a var xx:SRSpeechObject parameter can be nil, it is changed to xx: SRSpeechObjectPtr }
  135. SRRecognitionSystem = SRSpeechObject;
  136. SRRecognizer = SRSpeechObject;
  137. SRSpeechSource = SRSpeechObject;
  138. SRRecognitionResult = SRSpeechSource;
  139. SRLanguageObject = SRSpeechObject;
  140. SRLanguageModel = SRLanguageObject;
  141. SRPath = SRLanguageObject;
  142. SRPhrase = SRLanguageObject;
  143. SRWord = SRLanguageObject;
  144. { between 0 and 100 }
  145. SRSpeedSetting = UInt16;
  146. { between 0 and 100 }
  147. SRRejectionLevel = UInt16;
  148. { When an event occurs, the user supplied proc will be called with a pointer }
  149. { to the param passed in and a flag to indicate conditions such }
  150. { as interrupt time or system background time. }
  151. SRCallBackStructPtr = ^SRCallBackStruct;
  152. SRCallBackStruct = record
  153. what: SInt32; { one of notification flags }
  154. message: SInt32; { contains SRRecognitionResult id }
  155. instance: SRRecognizer; { ID of recognizer being notified }
  156. status: OSErr; { result status of last search }
  157. flags: SInt16; { non-zero if occurs during interrupt }
  158. refCon: SInt32; { user defined - set from SRCallBackParam }
  159. end;
  160. { Call back procedure definition }
  161. {$ifc TYPED_FUNCTION_POINTERS}
  162. SRCallBackProcPtr = procedure(var param: SRCallBackStruct);
  163. {$elsec}
  164. SRCallBackProcPtr = ProcPtr;
  165. {$endc}
  166. {$ifc OPAQUE_UPP_TYPES}
  167. SRCallBackUPP = ^SInt32; { an opaque UPP }
  168. {$elsec}
  169. SRCallBackUPP = UniversalProcPtr;
  170. {$endc}
  171. const
  172. uppSRCallBackProcInfo = $000000C0;
  173. {
  174. * NewSRCallBackUPP()
  175. *
  176. * Availability:
  177. * Non-Carbon CFM: available as macro/inline
  178. * CarbonLib: in CarbonLib 1.0.2 and later
  179. * Mac OS X: in version 10.0 and later
  180. }
  181. function NewSRCallBackUPP(userRoutine: SRCallBackProcPtr): SRCallBackUPP; external name '_NewSRCallBackUPP'; { old name was NewSRCallBackProc }
  182. {
  183. * DisposeSRCallBackUPP()
  184. *
  185. * Availability:
  186. * Non-Carbon CFM: available as macro/inline
  187. * CarbonLib: in CarbonLib 1.0.2 and later
  188. * Mac OS X: in version 10.0 and later
  189. }
  190. procedure DisposeSRCallBackUPP(userUPP: SRCallBackUPP); external name '_DisposeSRCallBackUPP';
  191. {
  192. * InvokeSRCallBackUPP()
  193. *
  194. * Availability:
  195. * Non-Carbon CFM: available as macro/inline
  196. * CarbonLib: in CarbonLib 1.0.2 and later
  197. * Mac OS X: in version 10.0 and later
  198. }
  199. procedure InvokeSRCallBackUPP(var param: SRCallBackStruct; userRoutine: SRCallBackUPP); external name '_InvokeSRCallBackUPP'; { old name was CallSRCallBackProc }
  200. type
  201. SRCallBackParamPtr = ^SRCallBackParam;
  202. SRCallBackParam = record
  203. callBack: SRCallBackUPP;
  204. refCon: SInt32;
  205. end;
  206. { Recognition System Types }
  207. const
  208. kSRDefaultRecognitionSystemID = 0;
  209. { Recognition System Properties }
  210. kSRFeedbackAndListeningModes = $6662776E (* 'fbwn' *); { short: one of kSRNoFeedbackHasListenModes, kSRHasFeedbackHasListenModes, kSRNoFeedbackNoListenModes }
  211. kSRRejectedWord = $72656A71 (* 'rejq' *); { the SRWord used to represent a rejection }
  212. kSRCleanupOnClientExit = $636C7570 (* 'clup' *); { Boolean: Default is true. The rec system and everything it owns is disposed when the client application quits }
  213. kSRNoFeedbackNoListenModes = 0; { next allocated recognizer has no feedback window and doesn't use listening modes }
  214. kSRHasFeedbackHasListenModes = 1; { next allocated recognizer has feedback window and uses listening modes }
  215. kSRNoFeedbackHasListenModes = 2; { next allocated recognizer has no feedback window but does use listening modes }
  216. { Speech Source Types }
  217. kSRDefaultSpeechSource = 0;
  218. kSRLiveDesktopSpeechSource = $646B6C76 (* 'dklv' *); { live desktop sound input }
  219. kSRCanned22kHzSpeechSource = $63613232 (* 'ca22' *); { AIFF file based 16 bit, 22.050 KHz sound input }
  220. { Notification via Apple Event or Callback }
  221. { Notification Flags }
  222. kSRNotifyRecognitionBeginning = $00000001; { recognition can begin. client must now call SRContinueRecognition or SRCancelRecognition }
  223. kSRNotifyRecognitionDone = $00000002; { recognition has terminated. result (if any) is available. }
  224. { Apple Event selectors }
  225. { AppleEvent message class }
  226. kAESpeechSuite = $73707263 (* 'sprc' *);
  227. { AppleEvent message event ids }
  228. kAESpeechDone = $73727364 (* 'srsd' *);
  229. kAESpeechDetected = $73726264 (* 'srbd' *);
  230. { AppleEvent Parameter ids }
  231. keySRRecognizer = $6B726563 (* 'krec' *);
  232. keySRSpeechResult = $6B737072 (* 'kspr' *);
  233. keySRSpeechStatus = $6B737374 (* 'ksst' *);
  234. { AppleEvent Parameter types }
  235. typeSRRecognizer = $74726563 (* 'trec' *);
  236. typeSRSpeechResult = $74737072 (* 'tspr' *);
  237. { SRRecognizer Properties }
  238. kSRNotificationParam = $6E6F7469 (* 'noti' *); { see notification flags below }
  239. kSRCallBackParam = $63616C6C (* 'call' *); { type SRCallBackParam }
  240. kSRSearchStatusParam = $73746174 (* 'stat' *); { see status flags below }
  241. kSRAutoFinishingParam = $6166696E (* 'afin' *); { automatic finishing applied on LM for search }
  242. kSRForegroundOnly = $66676F6E (* 'fgon' *); { Boolean. Default is true. If true, client recognizer only active when in foreground. }
  243. kSRBlockBackground = $626C6267 (* 'blbg' *); { Boolean. Default is false. If true, when client recognizer in foreground, rest of LMs are inactive. }
  244. kSRBlockModally = $626C6D64 (* 'blmd' *); { Boolean. Default is false. When true, this client's LM is only active LM; all other LMs are inactive. Be nice, don't be modal for long periods! }
  245. kSRWantsResultTextDrawn = $74786662 (* 'txfb' *); { Boolean. Default is true. If true, search results are posted to Feedback window }
  246. kSRWantsAutoFBGestures = $64666272 (* 'dfbr' *); { Boolean. Default is true. If true, client needn't call SRProcessBegin/End to get default feedback behavior }
  247. kSRSoundInVolume = $766F6C75 (* 'volu' *); { short in [0..100] log scaled sound input power. Can't set this property }
  248. kSRReadAudioFSSpec = $61757264 (* 'aurd' *); { *FSSpec. Specify FSSpec where raw audio is to be read (AIFF format) using kSRCanned22kHzSpeechSource. Reads until EOF }
  249. kSRCancelOnSoundOut = $6361736F (* 'caso' *); { Boolean: Default is true. If any sound is played out during utterance, recognition is aborted. }
  250. kSRSpeedVsAccuracyParam = $73706564 (* 'sped' *); { SRSpeedSetting between 0 and 100 }
  251. { 0 means more accurate but slower. }
  252. { 100 means (much) less accurate but faster. }
  253. kSRUseToggleListen = 0; { listen key modes }
  254. kSRUsePushToTalk = 1;
  255. kSRListenKeyMode = $6C6B6D64 (* 'lkmd' *); { short: either kSRUseToggleListen or kSRUsePushToTalk }
  256. kSRListenKeyCombo = $6C6B6579 (* 'lkey' *); { short: Push-To-Talk key combination; high byte is high byte of event->modifiers, the low byte is the keycode from event->message }
  257. kSRListenKeyName = $6C6E616D (* 'lnam' *); { Str63: string representing ListenKeyCombo }
  258. kSRKeyWord = $6B777264 (* 'kwrd' *); { Str255: keyword preceding spoken commands in kSRUseToggleListen mode }
  259. kSRKeyExpected = $6B657870 (* 'kexp' *); { Boolean: Must the PTT key be depressed or the key word spoken before recognition can occur? }
  260. { Operational Status Flags }
  261. kSRIdleRecognizer = $00000001; { engine is not active }
  262. kSRSearchInProgress = $00000002; { search is in progress }
  263. kSRSearchWaitForAllClients = $00000004; { search is suspended waiting on all clients' input }
  264. kSRMustCancelSearch = $00000008; { something has occurred (sound played, non-speech detected) requiring the search to abort }
  265. kSRPendingSearch = $00000010; { we're about to start searching }
  266. { Recognition Result Properties }
  267. kSRTEXTFormat = $54455854 (* 'TEXT' *); { raw text in user supplied memory }
  268. kSRPhraseFormat = $6C6D7068 (* 'lmph' *); { SRPhrase containing result words }
  269. kSRPathFormat = $6C6D7074 (* 'lmpt' *); { SRPath containing result phrases or words }
  270. kSRLanguageModelFormat = $6C6D666D (* 'lmfm' *); { top level SRLanguageModel for post parse }
  271. { SRLanguageObject Family Properties }
  272. kSRSpelling = $7370656C (* 'spel' *); { spelling of a SRWord or SRPhrase or SRPath, or name of a SRLanguageModel }
  273. kSRLMObjType = $6C6D7470 (* 'lmtp' *); { Returns one of SRLanguageObject Types listed below }
  274. kSRRefCon = $72656663 (* 'refc' *); { 4 bytes of user storage }
  275. kSROptional = $6F70746C (* 'optl' *); { Boolean -- true if SRLanguageObject is optional }
  276. kSREnabled = $656E626C (* 'enbl' *); { Boolean -- true if SRLanguageObject enabled }
  277. kSRRepeatable = $72707462 (* 'rptb' *); { Boolean -- true if SRLanguageObject is repeatable }
  278. kSRRejectable = $726A626C (* 'rjbl' *); { Boolean -- true if SRLanguageObject is rejectable (Recognition System's kSRRejectedWord }
  279. { object can be returned in place of SRLanguageObject with this property) }
  280. kSRRejectionLevel = $726A6374 (* 'rjct' *); { SRRejectionLevel between 0 and 100 }
  281. { LM Object Types -- returned as kSRLMObjType property of language model objects }
  282. kSRLanguageModelType = $6C6D6F62 (* 'lmob' *); { SRLanguageModel }
  283. kSRPathType = $70617468 (* 'path' *); { SRPath }
  284. kSRPhraseType = $70687261 (* 'phra' *); { SRPhrase }
  285. kSRWordType = $776F7264 (* 'word' *); { SRWord }
  286. { a normal and reasonable rejection level }
  287. kSRDefaultRejectionLevel = 50;
  288. { ****************************************************************************** }
  289. { NOTES ON USING THE API }
  290. { }
  291. { All operations (with the exception of SRGetRecognitionSystem) are }
  292. { directed toward an object allocated or begot from New, Get and Read }
  293. { type calls. }
  294. { }
  295. { There is a simple rule in dealing with allocation and disposal: }
  296. { }
  297. { * all toolbox allocations are obtained from a SRRecognitionSystem }
  298. { }
  299. { * if you obtain an object via New or Get, then you own a reference }
  300. { to that object and it must be released via SRReleaseObject when }
  301. { you no longer need it }
  302. { }
  303. { * when you receive a SRRecognitionResult object via AppleEvent or }
  304. { callback, it has essentially been created on your behalf and so }
  305. { you are responsible for releasing it as above }
  306. { }
  307. { * when you close a SRRecognitionSystem, all remaining objects which }
  308. { were allocated with it will be forcefully released and any }
  309. { remaining references to those objects will be invalid. }
  310. { }
  311. { This translates into a very simple guideline: }
  312. { If you allocate it or have it allocated for you, you must release }
  313. { it. If you are only peeking at it, then don't release it. }
  314. { }
  315. { ****************************************************************************** }
  316. { Opening and Closing of the SRRecognitionSystem }
  317. {
  318. * SROpenRecognitionSystem()
  319. *
  320. * Availability:
  321. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  322. * CarbonLib: in CarbonLib 1.0 and later
  323. * Mac OS X: in version 10.0 and later
  324. }
  325. function SROpenRecognitionSystem(var system: SRRecognitionSystem; systemID: OSType): OSErr; external name '_SROpenRecognitionSystem';
  326. {
  327. * SRCloseRecognitionSystem()
  328. *
  329. * Availability:
  330. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  331. * CarbonLib: in CarbonLib 1.0 and later
  332. * Mac OS X: in version 10.0 and later
  333. }
  334. function SRCloseRecognitionSystem(system: SRRecognitionSystem): OSErr; external name '_SRCloseRecognitionSystem';
  335. { Accessing Properties of any Speech Object }
  336. {
  337. * SRSetProperty()
  338. *
  339. * Availability:
  340. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  341. * CarbonLib: in CarbonLib 1.0 and later
  342. * Mac OS X: in version 10.0 and later
  343. }
  344. function SRSetProperty(srObject: SRSpeechObject; selector: OSType; proprty: UnivPtr; propertyLen: Size): OSErr; external name '_SRSetProperty';
  345. {
  346. * SRGetProperty()
  347. *
  348. * Availability:
  349. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  350. * CarbonLib: in CarbonLib 1.0 and later
  351. * Mac OS X: in version 10.0 and later
  352. }
  353. function SRGetProperty(srObject: SRSpeechObject; selector: OSType; proprty: UnivPtr; var propertyLen: Size): OSErr; external name '_SRGetProperty';
  354. { Any object obtained via New or Get type calls must be released }
  355. {
  356. * SRReleaseObject()
  357. *
  358. * Availability:
  359. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  360. * CarbonLib: in CarbonLib 1.0 and later
  361. * Mac OS X: in version 10.0 and later
  362. }
  363. function SRReleaseObject(srObject: SRSpeechObject): OSErr; external name '_SRReleaseObject';
  364. {
  365. * SRGetReference()
  366. *
  367. * Availability:
  368. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  369. * CarbonLib: in CarbonLib 1.0 and later
  370. * Mac OS X: in version 10.0 and later
  371. }
  372. function SRGetReference(srObject: SRSpeechObject; var newObjectRef: SRSpeechObject): OSErr; external name '_SRGetReference';
  373. { SRRecognizer Instance Functions }
  374. {
  375. * SRNewRecognizer()
  376. *
  377. * Availability:
  378. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  379. * CarbonLib: in CarbonLib 1.0 and later
  380. * Mac OS X: in version 10.0 and later
  381. }
  382. function SRNewRecognizer(system: SRRecognitionSystem; var recognizer: SRRecognizer; sourceID: OSType): OSErr; external name '_SRNewRecognizer';
  383. {
  384. * SRStartListening()
  385. *
  386. * Availability:
  387. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  388. * CarbonLib: in CarbonLib 1.0 and later
  389. * Mac OS X: in version 10.0 and later
  390. }
  391. function SRStartListening(recognizer: SRRecognizer): OSErr; external name '_SRStartListening';
  392. {
  393. * SRStopListening()
  394. *
  395. * Availability:
  396. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  397. * CarbonLib: in CarbonLib 1.0 and later
  398. * Mac OS X: in version 10.0 and later
  399. }
  400. function SRStopListening(recognizer: SRRecognizer): OSErr; external name '_SRStopListening';
  401. {
  402. * SRSetLanguageModel()
  403. *
  404. * Availability:
  405. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  406. * CarbonLib: in CarbonLib 1.0 and later
  407. * Mac OS X: in version 10.0 and later
  408. }
  409. function SRSetLanguageModel(recognizer: SRRecognizer; languageModel: SRLanguageModel): OSErr; external name '_SRSetLanguageModel';
  410. {
  411. * SRGetLanguageModel()
  412. *
  413. * Availability:
  414. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  415. * CarbonLib: in CarbonLib 1.0 and later
  416. * Mac OS X: in version 10.0 and later
  417. }
  418. function SRGetLanguageModel(recognizer: SRRecognizer; var languageModel: SRLanguageModel): OSErr; external name '_SRGetLanguageModel';
  419. {
  420. * SRContinueRecognition()
  421. *
  422. * Availability:
  423. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  424. * CarbonLib: in CarbonLib 1.0 and later
  425. * Mac OS X: in version 10.0 and later
  426. }
  427. function SRContinueRecognition(recognizer: SRRecognizer): OSErr; external name '_SRContinueRecognition';
  428. {
  429. * SRCancelRecognition()
  430. *
  431. * Availability:
  432. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  433. * CarbonLib: in CarbonLib 1.0 and later
  434. * Mac OS X: in version 10.0 and later
  435. }
  436. function SRCancelRecognition(recognizer: SRRecognizer): OSErr; external name '_SRCancelRecognition';
  437. {
  438. * SRIdle()
  439. *
  440. * Availability:
  441. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  442. * CarbonLib: in CarbonLib 1.0 and later
  443. * Mac OS X: in version 10.0 and later
  444. }
  445. function SRIdle: OSErr; external name '_SRIdle';
  446. { Language Model Building and Manipulation Functions }
  447. {
  448. * SRNewLanguageModel()
  449. *
  450. * Availability:
  451. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  452. * CarbonLib: in CarbonLib 1.0 and later
  453. * Mac OS X: in version 10.0 and later
  454. }
  455. function SRNewLanguageModel(system: SRRecognitionSystem; var model: SRLanguageModel; name: UnivPtr; nameLength: Size): OSErr; external name '_SRNewLanguageModel';
  456. {
  457. * SRNewPath()
  458. *
  459. * Availability:
  460. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  461. * CarbonLib: in CarbonLib 1.0 and later
  462. * Mac OS X: in version 10.0 and later
  463. }
  464. function SRNewPath(system: SRRecognitionSystem; var path: SRPath): OSErr; external name '_SRNewPath';
  465. {
  466. * SRNewPhrase()
  467. *
  468. * Availability:
  469. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  470. * CarbonLib: in CarbonLib 1.0 and later
  471. * Mac OS X: in version 10.0 and later
  472. }
  473. function SRNewPhrase(system: SRRecognitionSystem; var phrase: SRPhrase; text: UnivPtr; textLength: Size): OSErr; external name '_SRNewPhrase';
  474. {
  475. * SRNewWord()
  476. *
  477. * Availability:
  478. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  479. * CarbonLib: in CarbonLib 1.0 and later
  480. * Mac OS X: in version 10.0 and later
  481. }
  482. function SRNewWord(system: SRRecognitionSystem; var word: SRWord; text: UnivPtr; textLength: Size): OSErr; external name '_SRNewWord';
  483. { Operations on any object of the SRLanguageObject family }
  484. {
  485. * SRPutLanguageObjectIntoHandle()
  486. *
  487. * Availability:
  488. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  489. * CarbonLib: in CarbonLib 1.0 and later
  490. * Mac OS X: in version 10.0 and later
  491. }
  492. function SRPutLanguageObjectIntoHandle(languageObject: SRLanguageObject; lobjHandle: Handle): OSErr; external name '_SRPutLanguageObjectIntoHandle';
  493. {
  494. * SRPutLanguageObjectIntoDataFile()
  495. *
  496. * Availability:
  497. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  498. * CarbonLib: in CarbonLib 1.0 and later
  499. * Mac OS X: in version 10.0 and later
  500. }
  501. function SRPutLanguageObjectIntoDataFile(languageObject: SRLanguageObject; fRefNum: SInt16): OSErr; external name '_SRPutLanguageObjectIntoDataFile';
  502. {
  503. * SRNewLanguageObjectFromHandle()
  504. *
  505. * Availability:
  506. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  507. * CarbonLib: in CarbonLib 1.0 and later
  508. * Mac OS X: in version 10.0 and later
  509. }
  510. function SRNewLanguageObjectFromHandle(system: SRRecognitionSystem; var languageObject: SRLanguageObject; lObjHandle: Handle): OSErr; external name '_SRNewLanguageObjectFromHandle';
  511. {
  512. * SRNewLanguageObjectFromDataFile()
  513. *
  514. * Availability:
  515. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  516. * CarbonLib: in CarbonLib 1.0 and later
  517. * Mac OS X: in version 10.0 and later
  518. }
  519. function SRNewLanguageObjectFromDataFile(system: SRRecognitionSystem; var languageObject: SRLanguageObject; fRefNum: SInt16): OSErr; external name '_SRNewLanguageObjectFromDataFile';
  520. {
  521. * SREmptyLanguageObject()
  522. *
  523. * Availability:
  524. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  525. * CarbonLib: in CarbonLib 1.0 and later
  526. * Mac OS X: in version 10.0 and later
  527. }
  528. function SREmptyLanguageObject(languageObject: SRLanguageObject): OSErr; external name '_SREmptyLanguageObject';
  529. {
  530. * SRChangeLanguageObject()
  531. *
  532. * Availability:
  533. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  534. * CarbonLib: in CarbonLib 1.0 and later
  535. * Mac OS X: in version 10.0 and later
  536. }
  537. function SRChangeLanguageObject(languageObject: SRLanguageObject; text: UnivPtr; textLength: Size): OSErr; external name '_SRChangeLanguageObject';
  538. {
  539. * SRAddLanguageObject()
  540. *
  541. * Availability:
  542. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  543. * CarbonLib: in CarbonLib 1.0 and later
  544. * Mac OS X: in version 10.0 and later
  545. }
  546. function SRAddLanguageObject(base: SRLanguageObject; addon: SRLanguageObject): OSErr; external name '_SRAddLanguageObject';
  547. {
  548. * SRAddText()
  549. *
  550. * Availability:
  551. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  552. * CarbonLib: in CarbonLib 1.0 and later
  553. * Mac OS X: in version 10.0 and later
  554. }
  555. function SRAddText(base: SRLanguageObject; text: UnivPtr; textLength: Size; refCon: SInt32): OSErr; external name '_SRAddText';
  556. {
  557. * SRRemoveLanguageObject()
  558. *
  559. * Availability:
  560. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  561. * CarbonLib: in CarbonLib 1.0 and later
  562. * Mac OS X: in version 10.0 and later
  563. }
  564. function SRRemoveLanguageObject(base: SRLanguageObject; toRemove: SRLanguageObject): OSErr; external name '_SRRemoveLanguageObject';
  565. { Traversing SRRecognitionResults or SRLanguageObjects }
  566. {
  567. * SRCountItems()
  568. *
  569. * Availability:
  570. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  571. * CarbonLib: in CarbonLib 1.0 and later
  572. * Mac OS X: in version 10.0 and later
  573. }
  574. function SRCountItems(container: SRSpeechObject; var count: SInt32): OSErr; external name '_SRCountItems';
  575. {
  576. * SRGetIndexedItem()
  577. *
  578. * Availability:
  579. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  580. * CarbonLib: in CarbonLib 1.0 and later
  581. * Mac OS X: in version 10.0 and later
  582. }
  583. function SRGetIndexedItem(container: SRSpeechObject; var item: SRSpeechObject; index: SInt32): OSErr; external name '_SRGetIndexedItem';
  584. {
  585. * SRSetIndexedItem()
  586. *
  587. * Availability:
  588. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  589. * CarbonLib: in CarbonLib 1.0 and later
  590. * Mac OS X: in version 10.0 and later
  591. }
  592. function SRSetIndexedItem(container: SRSpeechObject; item: SRSpeechObject; index: SInt32): OSErr; external name '_SRSetIndexedItem';
  593. {
  594. * SRRemoveIndexedItem()
  595. *
  596. * Availability:
  597. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  598. * CarbonLib: in CarbonLib 1.0 and later
  599. * Mac OS X: in version 10.0 and later
  600. }
  601. function SRRemoveIndexedItem(container: SRSpeechObject; index: SInt32): OSErr; external name '_SRRemoveIndexedItem';
  602. { Utilizing the System Feedback Window }
  603. {
  604. * SRDrawText()
  605. *
  606. * Availability:
  607. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  608. * CarbonLib: in CarbonLib 1.0 and later
  609. * Mac OS X: in version 10.0 and later
  610. }
  611. function SRDrawText(recognizer: SRRecognizer; dispText: UnivPtr; dispLength: Size): OSErr; external name '_SRDrawText';
  612. {
  613. * SRDrawRecognizedText()
  614. *
  615. * Availability:
  616. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  617. * CarbonLib: in CarbonLib 1.0 and later
  618. * Mac OS X: in version 10.0 and later
  619. }
  620. function SRDrawRecognizedText(recognizer: SRRecognizer; dispText: UnivPtr; dispLength: Size): OSErr; external name '_SRDrawRecognizedText';
  621. {
  622. * SRSpeakText()
  623. *
  624. * Availability:
  625. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  626. * CarbonLib: in CarbonLib 1.0 and later
  627. * Mac OS X: in version 10.0 and later
  628. }
  629. function SRSpeakText(recognizer: SRRecognizer; speakText: UnivPtr; speakLength: Size): OSErr; external name '_SRSpeakText';
  630. {
  631. * SRSpeakAndDrawText()
  632. *
  633. * Availability:
  634. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  635. * CarbonLib: in CarbonLib 1.0 and later
  636. * Mac OS X: in version 10.0 and later
  637. }
  638. function SRSpeakAndDrawText(recognizer: SRRecognizer; text: UnivPtr; textLength: Size): OSErr; external name '_SRSpeakAndDrawText';
  639. {
  640. * SRStopSpeech()
  641. *
  642. * Availability:
  643. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  644. * CarbonLib: in CarbonLib 1.0 and later
  645. * Mac OS X: in version 10.0 and later
  646. }
  647. function SRStopSpeech(recognizer: SRRecognizer): OSErr; external name '_SRStopSpeech';
  648. {
  649. * SRSpeechBusy()
  650. *
  651. * Availability:
  652. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  653. * CarbonLib: in CarbonLib 1.0 and later
  654. * Mac OS X: in version 10.0 and later
  655. }
  656. function SRSpeechBusy(recognizer: SRRecognizer): boolean; external name '_SRSpeechBusy';
  657. {
  658. * SRProcessBegin()
  659. *
  660. * Availability:
  661. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  662. * CarbonLib: in CarbonLib 1.0 and later
  663. * Mac OS X: in version 10.0 and later
  664. }
  665. function SRProcessBegin(recognizer: SRRecognizer; failed: boolean): OSErr; external name '_SRProcessBegin';
  666. {
  667. * SRProcessEnd()
  668. *
  669. * Availability:
  670. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  671. * CarbonLib: in CarbonLib 1.0 and later
  672. * Mac OS X: in version 10.0 and later
  673. }
  674. function SRProcessEnd(recognizer: SRRecognizer; failed: boolean): OSErr; external name '_SRProcessEnd';
  675. {$ALIGN MAC68K}
  676. end.