Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

927 lines
34 KiB

  1. /*
  2. File: SpeechRecognition.h
  3. Contains: Apple Speech Recognition Toolbox Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1992-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __SPEECHRECOGNITION__
  11. #define __SPEECHRECOGNITION__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __MIXEDMODE__
  16. #include <MixedMode.h>
  17. #endif
  18. #if PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if PRAGMA_IMPORT
  25. #pragma import on
  26. #endif
  27. #if PRAGMA_STRUCT_ALIGN
  28. #pragma options align=mac68k
  29. #elif PRAGMA_STRUCT_PACKPUSH
  30. #pragma pack(push, 2)
  31. #elif PRAGMA_STRUCT_PACK
  32. #pragma pack(2)
  33. #endif
  34. /* Error Codes [Speech recognition gets -5100 through -5199] */
  35. enum {
  36. kSRNotAvailable = -5100, /* the service requested is not avail or applicable */
  37. kSRInternalError = -5101, /* a system internal or hardware error condition */
  38. kSRComponentNotFound = -5102, /* a needed system resource was not located */
  39. kSROutOfMemory = -5103, /* an out of memory error occurred in the toolbox memory space */
  40. kSRNotASpeechObject = -5104, /* the object specified is no longer or never was valid */
  41. kSRBadParameter = -5105, /* an invalid parameter was specified */
  42. kSRParamOutOfRange = -5106, /* when we say 0-100, don't pass in 101. */
  43. kSRBadSelector = -5107, /* an unrecognized selector was specified */
  44. kSRBufferTooSmall = -5108, /* returned from attribute access functions */
  45. kSRNotARecSystem = -5109, /* the object used was not a SRRecognitionSystem */
  46. kSRFeedbackNotAvail = -5110, /* there is no feedback window associated with SRRecognizer */
  47. kSRCantSetProperty = -5111, /* a non-settable property was specified */
  48. kSRCantGetProperty = -5112, /* a non-gettable property was specified */
  49. kSRCantSetDuringRecognition = -5113, /* the property can't be set while recognition is in progress -- do before or between utterances. */
  50. kSRAlreadyListening = -5114, /* in response to SRStartListening */
  51. kSRNotListeningState = -5115, /* in response to SRStopListening */
  52. kSRModelMismatch = -5116, /* no acoustical models are avail to match request */
  53. kSRNoClientLanguageModel = -5117, /* trying to access a non-specified SRLanguageModel */
  54. kSRNoPendingUtterances = -5118, /* nothing to continue search on */
  55. kSRRecognitionCanceled = -5119, /* an abort error occurred during search */
  56. kSRRecognitionDone = -5120, /* search has finished, but nothing was recognized */
  57. kSROtherRecAlreadyModal = -5121, /* another recognizer is modal at the moment, so can't set this recognizer's kSRBlockModally property right now */
  58. kSRHasNoSubItems = -5122, /* SRCountItems or related routine was called on an object without subelements -- e.g. a word -- rather than phrase, path, or LM. */
  59. kSRSubItemNotFound = -5123, /* returned when accessing a non-existent sub item of a container */
  60. kSRLanguageModelTooBig = -5124, /* Cant build language models so big */
  61. kSRAlreadyReleased = -5125, /* this object has already been released before */
  62. kSRAlreadyFinished = -5126, /* the language model can't be finished twice */
  63. kSRWordNotFound = -5127, /* the spelling couldn't be found in lookup(s) */
  64. kSRNotFinishedWithRejection = -5128, /* property not found because the LMObj is not finished with rejection */
  65. kSRExpansionTooDeep = -5129, /* Language model is left recursive or is embedded too many levels */
  66. kSRTooManyElements = -5130, /* Too many elements added to phrase or path or other langauge model object */
  67. kSRCantAdd = -5131, /* Can't add given type of object to the base SRLanguageObject (e.g.in SRAddLanguageObject) */
  68. kSRSndInSourceDisconnected = -5132, /* Sound input source is disconnected */
  69. kSRCantReadLanguageObject = -5133, /* An error while trying to create new Language object from file or pointer -- possibly bad format */
  70. /* non-release debugging error codes are included here */
  71. kSRNotImplementedYet = -5199 /* you'd better wait for this feature in a future release */
  72. };
  73. /* Type Definitions */
  74. typedef struct OpaqueSRSpeechObject* SRSpeechObject;
  75. typedef SRSpeechObject SRRecognitionSystem;
  76. typedef SRSpeechObject SRRecognizer;
  77. typedef SRSpeechObject SRSpeechSource;
  78. typedef SRSpeechSource SRRecognitionResult;
  79. typedef SRSpeechObject SRLanguageObject;
  80. typedef SRLanguageObject SRLanguageModel;
  81. typedef SRLanguageObject SRPath;
  82. typedef SRLanguageObject SRPhrase;
  83. typedef SRLanguageObject SRWord;
  84. /* between 0 and 100 */
  85. typedef unsigned short SRSpeedSetting;
  86. /* between 0 and 100 */
  87. typedef unsigned short SRRejectionLevel;
  88. /* When an event occurs, the user supplied proc will be called with a pointer */
  89. /* to the param passed in and a flag to indicate conditions such */
  90. /* as interrupt time or system background time. */
  91. struct SRCallBackStruct {
  92. long what; /* one of notification flags */
  93. long message; /* contains SRRecognitionResult id */
  94. SRRecognizer instance; /* ID of recognizer being notified */
  95. OSErr status; /* result status of last search */
  96. short flags; /* non-zero if occurs during interrupt */
  97. long refCon; /* user defined - set from SRCallBackParam */
  98. };
  99. typedef struct SRCallBackStruct SRCallBackStruct;
  100. /* Call back procedure definition */
  101. typedef CALLBACK_API( void , SRCallBackProcPtr )(SRCallBackStruct * param);
  102. typedef STACK_UPP_TYPE(SRCallBackProcPtr) SRCallBackUPP;
  103. /*
  104. * NewSRCallBackUPP()
  105. *
  106. * Availability:
  107. * Non-Carbon CFM: available as macro/inline
  108. * CarbonLib: in CarbonLib 1.0.2 and later
  109. * Mac OS X: in version 10.0 and later
  110. */
  111. EXTERN_API_C( SRCallBackUPP )
  112. NewSRCallBackUPP(SRCallBackProcPtr userRoutine);
  113. #if !OPAQUE_UPP_TYPES
  114. enum { uppSRCallBackProcInfo = 0x000000C0 }; /* pascal no_return_value Func(4_bytes) */
  115. #ifdef __cplusplus
  116. inline DEFINE_API_C(SRCallBackUPP) NewSRCallBackUPP(SRCallBackProcPtr userRoutine) { return (SRCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSRCallBackProcInfo, GetCurrentArchitecture()); }
  117. #else
  118. #define NewSRCallBackUPP(userRoutine) (SRCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSRCallBackProcInfo, GetCurrentArchitecture())
  119. #endif
  120. #endif
  121. /*
  122. * DisposeSRCallBackUPP()
  123. *
  124. * Availability:
  125. * Non-Carbon CFM: available as macro/inline
  126. * CarbonLib: in CarbonLib 1.0.2 and later
  127. * Mac OS X: in version 10.0 and later
  128. */
  129. EXTERN_API_C( void )
  130. DisposeSRCallBackUPP(SRCallBackUPP userUPP);
  131. #if !OPAQUE_UPP_TYPES
  132. #ifdef __cplusplus
  133. inline DEFINE_API_C(void) DisposeSRCallBackUPP(SRCallBackUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  134. #else
  135. #define DisposeSRCallBackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  136. #endif
  137. #endif
  138. /*
  139. * InvokeSRCallBackUPP()
  140. *
  141. * Availability:
  142. * Non-Carbon CFM: available as macro/inline
  143. * CarbonLib: in CarbonLib 1.0.2 and later
  144. * Mac OS X: in version 10.0 and later
  145. */
  146. EXTERN_API_C( void )
  147. InvokeSRCallBackUPP(
  148. SRCallBackStruct * param,
  149. SRCallBackUPP userUPP);
  150. #if !OPAQUE_UPP_TYPES
  151. #ifdef __cplusplus
  152. inline DEFINE_API_C(void) InvokeSRCallBackUPP(SRCallBackStruct * param, SRCallBackUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppSRCallBackProcInfo, param); }
  153. #else
  154. #define InvokeSRCallBackUPP(param, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppSRCallBackProcInfo, (param))
  155. #endif
  156. #endif
  157. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  158. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  159. #define NewSRCallBackProc(userRoutine) NewSRCallBackUPP(userRoutine)
  160. #define CallSRCallBackProc(userRoutine, param) InvokeSRCallBackUPP(param, userRoutine)
  161. #endif /* CALL_NOT_IN_CARBON */
  162. struct SRCallBackParam {
  163. SRCallBackUPP callBack;
  164. long refCon;
  165. };
  166. typedef struct SRCallBackParam SRCallBackParam;
  167. /* Recognition System Types */
  168. enum {
  169. kSRDefaultRecognitionSystemID = 0
  170. };
  171. /* Recognition System Properties */
  172. enum {
  173. kSRFeedbackAndListeningModes = FOUR_CHAR_CODE('fbwn'), /* short: one of kSRNoFeedbackHasListenModes, kSRHasFeedbackHasListenModes, kSRNoFeedbackNoListenModes */
  174. kSRRejectedWord = FOUR_CHAR_CODE('rejq'), /* the SRWord used to represent a rejection */
  175. kSRCleanupOnClientExit = FOUR_CHAR_CODE('clup') /* Boolean: Default is true. The rec system and everything it owns is disposed when the client application quits */
  176. };
  177. enum {
  178. kSRNoFeedbackNoListenModes = 0, /* next allocated recognizer has no feedback window and doesn't use listening modes */
  179. kSRHasFeedbackHasListenModes = 1, /* next allocated recognizer has feedback window and uses listening modes */
  180. kSRNoFeedbackHasListenModes = 2 /* next allocated recognizer has no feedback window but does use listening modes */
  181. };
  182. /* Speech Source Types */
  183. enum {
  184. kSRDefaultSpeechSource = 0,
  185. kSRLiveDesktopSpeechSource = FOUR_CHAR_CODE('dklv'), /* live desktop sound input */
  186. kSRCanned22kHzSpeechSource = FOUR_CHAR_CODE('ca22') /* AIFF file based 16 bit, 22.050 KHz sound input */
  187. };
  188. /* Notification via Apple Event or Callback */
  189. /* Notification Flags */
  190. enum {
  191. kSRNotifyRecognitionBeginning = 1L << 0, /* recognition can begin. client must now call SRContinueRecognition or SRCancelRecognition */
  192. kSRNotifyRecognitionDone = 1L << 1 /* recognition has terminated. result (if any) is available. */
  193. };
  194. /* Apple Event selectors */
  195. /* AppleEvent message class */
  196. enum {
  197. kAESpeechSuite = FOUR_CHAR_CODE('sprc')
  198. };
  199. /* AppleEvent message event ids */
  200. enum {
  201. kAESpeechDone = FOUR_CHAR_CODE('srsd'),
  202. kAESpeechDetected = FOUR_CHAR_CODE('srbd')
  203. };
  204. /* AppleEvent Parameter ids */
  205. enum {
  206. keySRRecognizer = FOUR_CHAR_CODE('krec'),
  207. keySRSpeechResult = FOUR_CHAR_CODE('kspr'),
  208. keySRSpeechStatus = FOUR_CHAR_CODE('ksst')
  209. };
  210. /* AppleEvent Parameter types */
  211. enum {
  212. typeSRRecognizer = FOUR_CHAR_CODE('trec'),
  213. typeSRSpeechResult = FOUR_CHAR_CODE('tspr')
  214. };
  215. /* SRRecognizer Properties */
  216. enum {
  217. kSRNotificationParam = FOUR_CHAR_CODE('noti'), /* see notification flags below */
  218. kSRCallBackParam = FOUR_CHAR_CODE('call'), /* type SRCallBackParam */
  219. kSRSearchStatusParam = FOUR_CHAR_CODE('stat'), /* see status flags below */
  220. kSRAutoFinishingParam = FOUR_CHAR_CODE('afin'), /* automatic finishing applied on LM for search */
  221. kSRForegroundOnly = FOUR_CHAR_CODE('fgon'), /* Boolean. Default is true. If true, client recognizer only active when in foreground. */
  222. kSRBlockBackground = FOUR_CHAR_CODE('blbg'), /* Boolean. Default is false. If true, when client recognizer in foreground, rest of LMs are inactive. */
  223. kSRBlockModally = FOUR_CHAR_CODE('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! */
  224. kSRWantsResultTextDrawn = FOUR_CHAR_CODE('txfb'), /* Boolean. Default is true. If true, search results are posted to Feedback window */
  225. kSRWantsAutoFBGestures = FOUR_CHAR_CODE('dfbr'), /* Boolean. Default is true. If true, client needn't call SRProcessBegin/End to get default feedback behavior */
  226. kSRSoundInVolume = FOUR_CHAR_CODE('volu'), /* short in [0..100] log scaled sound input power. Can't set this property */
  227. kSRReadAudioFSSpec = FOUR_CHAR_CODE('aurd'), /* *FSSpec. Specify FSSpec where raw audio is to be read (AIFF format) using kSRCanned22kHzSpeechSource. Reads until EOF */
  228. kSRCancelOnSoundOut = FOUR_CHAR_CODE('caso'), /* Boolean: Default is true. If any sound is played out during utterance, recognition is aborted. */
  229. kSRSpeedVsAccuracyParam = FOUR_CHAR_CODE('sped') /* SRSpeedSetting between 0 and 100 */
  230. };
  231. /* 0 means more accurate but slower. */
  232. /* 100 means (much) less accurate but faster. */
  233. enum {
  234. kSRUseToggleListen = 0, /* listen key modes */
  235. kSRUsePushToTalk = 1
  236. };
  237. enum {
  238. kSRListenKeyMode = FOUR_CHAR_CODE('lkmd'), /* short: either kSRUseToggleListen or kSRUsePushToTalk */
  239. kSRListenKeyCombo = FOUR_CHAR_CODE('lkey'), /* short: Push-To-Talk key combination; high byte is high byte of event->modifiers, the low byte is the keycode from event->message */
  240. kSRListenKeyName = FOUR_CHAR_CODE('lnam'), /* Str63: string representing ListenKeyCombo */
  241. kSRKeyWord = FOUR_CHAR_CODE('kwrd'), /* Str255: keyword preceding spoken commands in kSRUseToggleListen mode */
  242. kSRKeyExpected = FOUR_CHAR_CODE('kexp') /* Boolean: Must the PTT key be depressed or the key word spoken before recognition can occur? */
  243. };
  244. /* Operational Status Flags */
  245. enum {
  246. kSRIdleRecognizer = 1L << 0, /* engine is not active */
  247. kSRSearchInProgress = 1L << 1, /* search is in progress */
  248. kSRSearchWaitForAllClients = 1L << 2, /* search is suspended waiting on all clients' input */
  249. kSRMustCancelSearch = 1L << 3, /* something has occurred (sound played, non-speech detected) requiring the search to abort */
  250. kSRPendingSearch = 1L << 4 /* we're about to start searching */
  251. };
  252. /* Recognition Result Properties */
  253. enum {
  254. kSRTEXTFormat = FOUR_CHAR_CODE('TEXT'), /* raw text in user supplied memory */
  255. kSRPhraseFormat = FOUR_CHAR_CODE('lmph'), /* SRPhrase containing result words */
  256. kSRPathFormat = FOUR_CHAR_CODE('lmpt'), /* SRPath containing result phrases or words */
  257. kSRLanguageModelFormat = FOUR_CHAR_CODE('lmfm') /* top level SRLanguageModel for post parse */
  258. };
  259. /* SRLanguageObject Family Properties */
  260. enum {
  261. kSRSpelling = FOUR_CHAR_CODE('spel'), /* spelling of a SRWord or SRPhrase or SRPath, or name of a SRLanguageModel */
  262. kSRLMObjType = FOUR_CHAR_CODE('lmtp'), /* Returns one of SRLanguageObject Types listed below */
  263. kSRRefCon = FOUR_CHAR_CODE('refc'), /* 4 bytes of user storage */
  264. kSROptional = FOUR_CHAR_CODE('optl'), /* Boolean -- true if SRLanguageObject is optional */
  265. kSREnabled = FOUR_CHAR_CODE('enbl'), /* Boolean -- true if SRLanguageObject enabled */
  266. kSRRepeatable = FOUR_CHAR_CODE('rptb'), /* Boolean -- true if SRLanguageObject is repeatable */
  267. kSRRejectable = FOUR_CHAR_CODE('rjbl'), /* Boolean -- true if SRLanguageObject is rejectable (Recognition System's kSRRejectedWord */
  268. /* object can be returned in place of SRLanguageObject with this property) */
  269. kSRRejectionLevel = FOUR_CHAR_CODE('rjct') /* SRRejectionLevel between 0 and 100 */
  270. };
  271. /* LM Object Types -- returned as kSRLMObjType property of language model objects */
  272. enum {
  273. kSRLanguageModelType = FOUR_CHAR_CODE('lmob'), /* SRLanguageModel */
  274. kSRPathType = FOUR_CHAR_CODE('path'), /* SRPath */
  275. kSRPhraseType = FOUR_CHAR_CODE('phra'), /* SRPhrase */
  276. kSRWordType = FOUR_CHAR_CODE('word') /* SRWord */
  277. };
  278. /* a normal and reasonable rejection level */
  279. enum {
  280. kSRDefaultRejectionLevel = 50
  281. };
  282. /********************************************************************************/
  283. /* NOTES ON USING THE API */
  284. /* */
  285. /* All operations (with the exception of SRGetRecognitionSystem) are */
  286. /* directed toward an object allocated or begot from New, Get and Read */
  287. /* type calls. */
  288. /* */
  289. /* There is a simple rule in dealing with allocation and disposal: */
  290. /* */
  291. /* * all toolbox allocations are obtained from a SRRecognitionSystem */
  292. /* */
  293. /* * if you obtain an object via New or Get, then you own a reference */
  294. /* to that object and it must be released via SRReleaseObject when */
  295. /* you no longer need it */
  296. /* */
  297. /* * when you receive a SRRecognitionResult object via AppleEvent or */
  298. /* callback, it has essentially been created on your behalf and so */
  299. /* you are responsible for releasing it as above */
  300. /* */
  301. /* * when you close a SRRecognitionSystem, all remaining objects which */
  302. /* were allocated with it will be forcefully released and any */
  303. /* remaining references to those objects will be invalid. */
  304. /* */
  305. /* This translates into a very simple guideline: */
  306. /* If you allocate it or have it allocated for you, you must release */
  307. /* it. If you are only peeking at it, then don't release it. */
  308. /* */
  309. /********************************************************************************/
  310. /* Opening and Closing of the SRRecognitionSystem */
  311. /*
  312. * SROpenRecognitionSystem()
  313. *
  314. * Availability:
  315. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  316. * CarbonLib: in CarbonLib 1.0 and later
  317. * Mac OS X: in version 10.0 and later
  318. */
  319. EXTERN_API( OSErr )
  320. SROpenRecognitionSystem(
  321. SRRecognitionSystem * system,
  322. OSType systemID) THREEWORDINLINE(0x303C, 0x0400, 0xAA56);
  323. /*
  324. * SRCloseRecognitionSystem()
  325. *
  326. * Availability:
  327. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  328. * CarbonLib: in CarbonLib 1.0 and later
  329. * Mac OS X: in version 10.0 and later
  330. */
  331. EXTERN_API( OSErr )
  332. SRCloseRecognitionSystem(SRRecognitionSystem system) THREEWORDINLINE(0x303C, 0x0201, 0xAA56);
  333. /* Accessing Properties of any Speech Object */
  334. /*
  335. * SRSetProperty()
  336. *
  337. * Availability:
  338. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  339. * CarbonLib: in CarbonLib 1.0 and later
  340. * Mac OS X: in version 10.0 and later
  341. */
  342. EXTERN_API( OSErr )
  343. SRSetProperty(
  344. SRSpeechObject srObject,
  345. OSType selector,
  346. const void * property,
  347. Size propertyLen) THREEWORDINLINE(0x303C, 0x0802, 0xAA56);
  348. /*
  349. * SRGetProperty()
  350. *
  351. * Availability:
  352. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  353. * CarbonLib: in CarbonLib 1.0 and later
  354. * Mac OS X: in version 10.0 and later
  355. */
  356. EXTERN_API( OSErr )
  357. SRGetProperty(
  358. SRSpeechObject srObject,
  359. OSType selector,
  360. void * property,
  361. Size * propertyLen) THREEWORDINLINE(0x303C, 0x0803, 0xAA56);
  362. /* Any object obtained via New or Get type calls must be released */
  363. /*
  364. * SRReleaseObject()
  365. *
  366. * Availability:
  367. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  368. * CarbonLib: in CarbonLib 1.0 and later
  369. * Mac OS X: in version 10.0 and later
  370. */
  371. EXTERN_API( OSErr )
  372. SRReleaseObject(SRSpeechObject srObject) THREEWORDINLINE(0x303C, 0x0204, 0xAA56);
  373. /*
  374. * SRGetReference()
  375. *
  376. * Availability:
  377. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  378. * CarbonLib: in CarbonLib 1.0 and later
  379. * Mac OS X: in version 10.0 and later
  380. */
  381. EXTERN_API( OSErr )
  382. SRGetReference(
  383. SRSpeechObject srObject,
  384. SRSpeechObject * newObjectRef) THREEWORDINLINE(0x303C, 0x0425, 0xAA56);
  385. /* SRRecognizer Instance Functions */
  386. /*
  387. * SRNewRecognizer()
  388. *
  389. * Availability:
  390. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  391. * CarbonLib: in CarbonLib 1.0 and later
  392. * Mac OS X: in version 10.0 and later
  393. */
  394. EXTERN_API( OSErr )
  395. SRNewRecognizer(
  396. SRRecognitionSystem system,
  397. SRRecognizer * recognizer,
  398. OSType sourceID) THREEWORDINLINE(0x303C, 0x060A, 0xAA56);
  399. /*
  400. * SRStartListening()
  401. *
  402. * Availability:
  403. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  404. * CarbonLib: in CarbonLib 1.0 and later
  405. * Mac OS X: in version 10.0 and later
  406. */
  407. EXTERN_API( OSErr )
  408. SRStartListening(SRRecognizer recognizer) THREEWORDINLINE(0x303C, 0x020C, 0xAA56);
  409. /*
  410. * SRStopListening()
  411. *
  412. * Availability:
  413. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  414. * CarbonLib: in CarbonLib 1.0 and later
  415. * Mac OS X: in version 10.0 and later
  416. */
  417. EXTERN_API( OSErr )
  418. SRStopListening(SRRecognizer recognizer) THREEWORDINLINE(0x303C, 0x020D, 0xAA56);
  419. /*
  420. * SRSetLanguageModel()
  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. EXTERN_API( OSErr )
  428. SRSetLanguageModel(
  429. SRRecognizer recognizer,
  430. SRLanguageModel languageModel) THREEWORDINLINE(0x303C, 0x040E, 0xAA56);
  431. /*
  432. * SRGetLanguageModel()
  433. *
  434. * Availability:
  435. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  436. * CarbonLib: in CarbonLib 1.0 and later
  437. * Mac OS X: in version 10.0 and later
  438. */
  439. EXTERN_API( OSErr )
  440. SRGetLanguageModel(
  441. SRRecognizer recognizer,
  442. SRLanguageModel * languageModel) THREEWORDINLINE(0x303C, 0x040F, 0xAA56);
  443. /*
  444. * SRContinueRecognition()
  445. *
  446. * Availability:
  447. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  448. * CarbonLib: in CarbonLib 1.0 and later
  449. * Mac OS X: in version 10.0 and later
  450. */
  451. EXTERN_API( OSErr )
  452. SRContinueRecognition(SRRecognizer recognizer) THREEWORDINLINE(0x303C, 0x0210, 0xAA56);
  453. /*
  454. * SRCancelRecognition()
  455. *
  456. * Availability:
  457. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  458. * CarbonLib: in CarbonLib 1.0 and later
  459. * Mac OS X: in version 10.0 and later
  460. */
  461. EXTERN_API( OSErr )
  462. SRCancelRecognition(SRRecognizer recognizer) THREEWORDINLINE(0x303C, 0x0211, 0xAA56);
  463. /*
  464. * SRIdle()
  465. *
  466. * Availability:
  467. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  468. * CarbonLib: in CarbonLib 1.0 and later
  469. * Mac OS X: in version 10.0 and later
  470. */
  471. EXTERN_API( OSErr )
  472. SRIdle(void) THREEWORDINLINE(0x303C, 0x0028, 0xAA56);
  473. /* Language Model Building and Manipulation Functions */
  474. /*
  475. * SRNewLanguageModel()
  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. EXTERN_API( OSErr )
  483. SRNewLanguageModel(
  484. SRRecognitionSystem system,
  485. SRLanguageModel * model,
  486. const void * name,
  487. Size nameLength) THREEWORDINLINE(0x303C, 0x0812, 0xAA56);
  488. /*
  489. * SRNewPath()
  490. *
  491. * Availability:
  492. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  493. * CarbonLib: in CarbonLib 1.0 and later
  494. * Mac OS X: in version 10.0 and later
  495. */
  496. EXTERN_API( OSErr )
  497. SRNewPath(
  498. SRRecognitionSystem system,
  499. SRPath * path) THREEWORDINLINE(0x303C, 0x0413, 0xAA56);
  500. /*
  501. * SRNewPhrase()
  502. *
  503. * Availability:
  504. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  505. * CarbonLib: in CarbonLib 1.0 and later
  506. * Mac OS X: in version 10.0 and later
  507. */
  508. EXTERN_API( OSErr )
  509. SRNewPhrase(
  510. SRRecognitionSystem system,
  511. SRPhrase * phrase,
  512. const void * text,
  513. Size textLength) THREEWORDINLINE(0x303C, 0x0814, 0xAA56);
  514. /*
  515. * SRNewWord()
  516. *
  517. * Availability:
  518. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  519. * CarbonLib: in CarbonLib 1.0 and later
  520. * Mac OS X: in version 10.0 and later
  521. */
  522. EXTERN_API( OSErr )
  523. SRNewWord(
  524. SRRecognitionSystem system,
  525. SRWord * word,
  526. const void * text,
  527. Size textLength) THREEWORDINLINE(0x303C, 0x0815, 0xAA56);
  528. /* Operations on any object of the SRLanguageObject family */
  529. /*
  530. * SRPutLanguageObjectIntoHandle()
  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. EXTERN_API( OSErr )
  538. SRPutLanguageObjectIntoHandle(
  539. SRLanguageObject languageObject,
  540. Handle lobjHandle) THREEWORDINLINE(0x303C, 0x0416, 0xAA56);
  541. /*
  542. * SRPutLanguageObjectIntoDataFile()
  543. *
  544. * Availability:
  545. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  546. * CarbonLib: in CarbonLib 1.0 and later
  547. * Mac OS X: in version 10.0 and later
  548. */
  549. EXTERN_API( OSErr )
  550. SRPutLanguageObjectIntoDataFile(
  551. SRLanguageObject languageObject,
  552. short fRefNum) THREEWORDINLINE(0x303C, 0x0328, 0xAA56);
  553. /*
  554. * SRNewLanguageObjectFromHandle()
  555. *
  556. * Availability:
  557. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  558. * CarbonLib: in CarbonLib 1.0 and later
  559. * Mac OS X: in version 10.0 and later
  560. */
  561. EXTERN_API( OSErr )
  562. SRNewLanguageObjectFromHandle(
  563. SRRecognitionSystem system,
  564. SRLanguageObject * languageObject,
  565. Handle lObjHandle) THREEWORDINLINE(0x303C, 0x0417, 0xAA56);
  566. /*
  567. * SRNewLanguageObjectFromDataFile()
  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. EXTERN_API( OSErr )
  575. SRNewLanguageObjectFromDataFile(
  576. SRRecognitionSystem system,
  577. SRLanguageObject * languageObject,
  578. short fRefNum) THREEWORDINLINE(0x303C, 0x0427, 0xAA56);
  579. /*
  580. * SREmptyLanguageObject()
  581. *
  582. * Availability:
  583. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  584. * CarbonLib: in CarbonLib 1.0 and later
  585. * Mac OS X: in version 10.0 and later
  586. */
  587. EXTERN_API( OSErr )
  588. SREmptyLanguageObject(SRLanguageObject languageObject) THREEWORDINLINE(0x303C, 0x0218, 0xAA56);
  589. /*
  590. * SRChangeLanguageObject()
  591. *
  592. * Availability:
  593. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  594. * CarbonLib: in CarbonLib 1.0 and later
  595. * Mac OS X: in version 10.0 and later
  596. */
  597. EXTERN_API( OSErr )
  598. SRChangeLanguageObject(
  599. SRLanguageObject languageObject,
  600. const void * text,
  601. Size textLength) THREEWORDINLINE(0x303C, 0x0619, 0xAA56);
  602. /*
  603. * SRAddLanguageObject()
  604. *
  605. * Availability:
  606. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  607. * CarbonLib: in CarbonLib 1.0 and later
  608. * Mac OS X: in version 10.0 and later
  609. */
  610. EXTERN_API( OSErr )
  611. SRAddLanguageObject(
  612. SRLanguageObject base,
  613. SRLanguageObject addon) THREEWORDINLINE(0x303C, 0x041A, 0xAA56);
  614. /*
  615. * SRAddText()
  616. *
  617. * Availability:
  618. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  619. * CarbonLib: in CarbonLib 1.0 and later
  620. * Mac OS X: in version 10.0 and later
  621. */
  622. EXTERN_API( OSErr )
  623. SRAddText(
  624. SRLanguageObject base,
  625. const void * text,
  626. Size textLength,
  627. long refCon) THREEWORDINLINE(0x303C, 0x081B, 0xAA56);
  628. /*
  629. * SRRemoveLanguageObject()
  630. *
  631. * Availability:
  632. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  633. * CarbonLib: in CarbonLib 1.0 and later
  634. * Mac OS X: in version 10.0 and later
  635. */
  636. EXTERN_API( OSErr )
  637. SRRemoveLanguageObject(
  638. SRLanguageObject base,
  639. SRLanguageObject toRemove) THREEWORDINLINE(0x303C, 0x041C, 0xAA56);
  640. /* Traversing SRRecognitionResults or SRLanguageObjects */
  641. /*
  642. * SRCountItems()
  643. *
  644. * Availability:
  645. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  646. * CarbonLib: in CarbonLib 1.0 and later
  647. * Mac OS X: in version 10.0 and later
  648. */
  649. EXTERN_API( OSErr )
  650. SRCountItems(
  651. SRSpeechObject container,
  652. long * count) THREEWORDINLINE(0x303C, 0x0405, 0xAA56);
  653. /*
  654. * SRGetIndexedItem()
  655. *
  656. * Availability:
  657. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  658. * CarbonLib: in CarbonLib 1.0 and later
  659. * Mac OS X: in version 10.0 and later
  660. */
  661. EXTERN_API( OSErr )
  662. SRGetIndexedItem(
  663. SRSpeechObject container,
  664. SRSpeechObject * item,
  665. long index) THREEWORDINLINE(0x303C, 0x0606, 0xAA56);
  666. /*
  667. * SRSetIndexedItem()
  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. EXTERN_API( OSErr )
  675. SRSetIndexedItem(
  676. SRSpeechObject container,
  677. SRSpeechObject item,
  678. long index) THREEWORDINLINE(0x303C, 0x0607, 0xAA56);
  679. /*
  680. * SRRemoveIndexedItem()
  681. *
  682. * Availability:
  683. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  684. * CarbonLib: in CarbonLib 1.0 and later
  685. * Mac OS X: in version 10.0 and later
  686. */
  687. EXTERN_API( OSErr )
  688. SRRemoveIndexedItem(
  689. SRSpeechObject container,
  690. long index) THREEWORDINLINE(0x303C, 0x0408, 0xAA56);
  691. /* Utilizing the System Feedback Window */
  692. /*
  693. * SRDrawText()
  694. *
  695. * Availability:
  696. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  697. * CarbonLib: in CarbonLib 1.0 and later
  698. * Mac OS X: in version 10.0 and later
  699. */
  700. EXTERN_API( OSErr )
  701. SRDrawText(
  702. SRRecognizer recognizer,
  703. const void * dispText,
  704. Size dispLength) THREEWORDINLINE(0x303C, 0x0621, 0xAA56);
  705. /*
  706. * SRDrawRecognizedText()
  707. *
  708. * Availability:
  709. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  710. * CarbonLib: in CarbonLib 1.0 and later
  711. * Mac OS X: in version 10.0 and later
  712. */
  713. EXTERN_API( OSErr )
  714. SRDrawRecognizedText(
  715. SRRecognizer recognizer,
  716. const void * dispText,
  717. Size dispLength) THREEWORDINLINE(0x303C, 0x0622, 0xAA56);
  718. /*
  719. * SRSpeakText()
  720. *
  721. * Availability:
  722. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  723. * CarbonLib: in CarbonLib 1.0 and later
  724. * Mac OS X: in version 10.0 and later
  725. */
  726. EXTERN_API( OSErr )
  727. SRSpeakText(
  728. SRRecognizer recognizer,
  729. const void * speakText,
  730. Size speakLength) THREEWORDINLINE(0x303C, 0x0620, 0xAA56);
  731. /*
  732. * SRSpeakAndDrawText()
  733. *
  734. * Availability:
  735. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  736. * CarbonLib: in CarbonLib 1.0 and later
  737. * Mac OS X: in version 10.0 and later
  738. */
  739. EXTERN_API( OSErr )
  740. SRSpeakAndDrawText(
  741. SRRecognizer recognizer,
  742. const void * text,
  743. Size textLength) THREEWORDINLINE(0x303C, 0x061F, 0xAA56);
  744. /*
  745. * SRStopSpeech()
  746. *
  747. * Availability:
  748. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  749. * CarbonLib: in CarbonLib 1.0 and later
  750. * Mac OS X: in version 10.0 and later
  751. */
  752. EXTERN_API( OSErr )
  753. SRStopSpeech(SRRecognizer recognizer) THREEWORDINLINE(0x303C, 0x0223, 0xAA56);
  754. /*
  755. * SRSpeechBusy()
  756. *
  757. * Availability:
  758. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  759. * CarbonLib: in CarbonLib 1.0 and later
  760. * Mac OS X: in version 10.0 and later
  761. */
  762. EXTERN_API( Boolean )
  763. SRSpeechBusy(SRRecognizer recognizer) THREEWORDINLINE(0x303C, 0x0224, 0xAA56);
  764. /*
  765. * SRProcessBegin()
  766. *
  767. * Availability:
  768. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  769. * CarbonLib: in CarbonLib 1.0 and later
  770. * Mac OS X: in version 10.0 and later
  771. */
  772. EXTERN_API( OSErr )
  773. SRProcessBegin(
  774. SRRecognizer recognizer,
  775. Boolean failed) THREEWORDINLINE(0x303C, 0x031D, 0xAA56);
  776. /*
  777. * SRProcessEnd()
  778. *
  779. * Availability:
  780. * Non-Carbon CFM: in SpeechRecognitionLib 1.0 and later
  781. * CarbonLib: in CarbonLib 1.0 and later
  782. * Mac OS X: in version 10.0 and later
  783. */
  784. EXTERN_API( OSErr )
  785. SRProcessEnd(
  786. SRRecognizer recognizer,
  787. Boolean failed) THREEWORDINLINE(0x303C, 0x031E, 0xAA56);
  788. #if PRAGMA_STRUCT_ALIGN
  789. #pragma options align=reset
  790. #elif PRAGMA_STRUCT_PACKPUSH
  791. #pragma pack(pop)
  792. #elif PRAGMA_STRUCT_PACK
  793. #pragma pack()
  794. #endif
  795. #ifdef PRAGMA_IMPORT_OFF
  796. #pragma import off
  797. #elif PRAGMA_IMPORT
  798. #pragma import reset
  799. #endif
  800. #ifdef __cplusplus
  801. }
  802. #endif
  803. #endif /* __SPEECHRECOGNITION__ */