Source code of Windows XP (NT5)
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.

818 lines
27 KiB

  1. /****************************************************************************
  2. * sapiddk.idl
  3. *
  4. * This is the interface definition file for the Microsoft Speech API DLL's
  5. * Version 5.0.
  6. *
  7. * It contains definitions for the DDI layer between SAPI.DLL and both
  8. * TTS and SR engines.
  9. *
  10. * Copyright (c) Microsoft Corporation. All rights reserved.
  11. *****************************************************************************/
  12. //--- Includes --------------------------------------------------------------
  13. import "oaidl.idl";
  14. import "ocidl.idl";
  15. import "sapi.idl";
  16. //--- Locally scoped define for LANGID
  17. #ifndef LANGID
  18. #define LANGID WORD
  19. #endif
  20. //--- ITN Processor
  21. interface ISpITNProcessor;
  22. //--- Grammar compiler and dynamic manipulation
  23. interface ISpErrorLog;
  24. interface ISpGrammarCompiler;
  25. interface ISpGramCompBackend;
  26. //--- Phrase builder
  27. interface ISpPhraseBuilder;
  28. //--- Token String Key Names
  29. cpp_quote("#define SPRECOEXTENSION L\"RecoExtension\"")
  30. cpp_quote("#define SPALTERNATESCLSID L\"AlternatesCLSID\"")
  31. //--- ISpTokenUI -----------------------------------------------------------
  32. [
  33. object,
  34. uuid(F8E690F0-39CB-4843-B8D7-C84696E1119D),
  35. helpstring("ISpTokenUI Interface"),
  36. pointer_default(unique),
  37. restricted
  38. ]
  39. interface ISpTokenUI : IUnknown
  40. {
  41. [local] HRESULT IsUISupported(
  42. [in] const WCHAR * pszTypeOfUI,
  43. [in] void * pvExtraData,
  44. [in] ULONG cbExtraData,
  45. [in] IUnknown * punkObject,
  46. [out] BOOL *pfSupported);
  47. [local] HRESULT DisplayUI(
  48. [in] HWND hwndParent,
  49. [in] const WCHAR * pszTitle,
  50. [in] const WCHAR * pszTypeOfUI,
  51. [in] void * pvExtraData,
  52. [in] ULONG cbExtraData,
  53. [in] ISpObjectToken * pToken,
  54. [in] IUnknown * punkObject);
  55. };
  56. //--- ISpObjectTokenEnumBuilder ---------------------------------------------
  57. [
  58. object,
  59. uuid(06B64F9F-7FDA-11d2-B4F2-00C04F797396),
  60. helpstring("ISpObjectTokensEnumBuilder Interface"),
  61. pointer_default(unique),
  62. restricted
  63. ]
  64. interface ISpObjectTokenEnumBuilder : IEnumSpObjectTokens
  65. {
  66. HRESULT SetAttribs(const WCHAR * pszReqAttribs, const WCHAR * pszOptAttribs);
  67. HRESULT AddTokens(ULONG cTokens, ISpObjectToken ** pToken);
  68. HRESULT AddTokensFromDataKey(ISpDataKey * pDataKey, const WCHAR * pszSubKey, const WCHAR * pszCategoryId);
  69. HRESULT AddTokensFromTokenEnum(IEnumSpObjectTokens * pTokenEnum);
  70. HRESULT Sort(const WCHAR * pszTokenIdToListFirst);
  71. };
  72. //--- Handles for SR grammars and results
  73. cpp_quote("#if 0")
  74. typedef void * SPWORDHANDLE;
  75. typedef void * SPRULEHANDLE;
  76. typedef void * SPGRAMMARHANDLE;
  77. typedef void * SPRECOCONTEXTHANDLE;
  78. typedef void * SPPHRASERULEHANDLE;
  79. typedef void * SPPHRASEPROPERTYHANDLE;
  80. typedef void * SPTRANSITIONID;
  81. cpp_quote("#else")
  82. cpp_quote("DECLARE_HANDLE(SPWORDHANDLE);")
  83. cpp_quote("DECLARE_HANDLE(SPRULEHANDLE);")
  84. cpp_quote("DECLARE_HANDLE(SPGRAMMARHANDLE);")
  85. cpp_quote("DECLARE_HANDLE(SPRECOCONTEXTHANDLE);")
  86. cpp_quote("DECLARE_HANDLE(SPPHRASERULEHANDLE);")
  87. cpp_quote("DECLARE_HANDLE(SPPHRASEPROPERTYHANDLE);")
  88. cpp_quote("DECLARE_HANDLE(SPTRANSITIONID);")
  89. cpp_quote("#endif")
  90. //--- ISpErrorLog -----------------------------------------------------------
  91. // This interface is used to log error information.
  92. [
  93. object,
  94. uuid(F4711347-E608-11d2-A086-00C04F8EF9B5),
  95. helpstring("ISpErrorLog Interface"),
  96. pointer_default(unique),
  97. restricted
  98. ]
  99. interface ISpErrorLog : IUnknown
  100. {
  101. HRESULT AddError(
  102. const long lLineNumber,
  103. HRESULT hr,
  104. const WCHAR * pszDescription,
  105. const WCHAR * pszHelpFile,
  106. DWORD dwHelpContext);
  107. };
  108. //--- ISpGrammarCompiler ----------------------------------------------------
  109. [
  110. object,
  111. uuid(B1E29D58-A675-11D2-8302-00C04F8EE6C0),
  112. helpstring("ISpGrammarCompiler Interface"),
  113. pointer_default(unique),
  114. restricted
  115. ]
  116. interface ISpGrammarCompiler : IUnknown
  117. {
  118. HRESULT CompileStream(
  119. IStream * pSource,
  120. IStream * pDest,
  121. IStream * pHeader,
  122. IUnknown * pReserved,
  123. ISpErrorLog * pErrorLog,
  124. [in] DWORD dwFlags);
  125. };
  126. [
  127. object,
  128. uuid(3DDCA27C-665C-4786-9F97-8C90C3488B61),
  129. helpstring("ISpGramCompBackend Interface"),
  130. pointer_default(unique),
  131. restricted
  132. ]
  133. interface ISpGramCompBackend : ISpGrammarBuilder
  134. {
  135. HRESULT SetSaveObjects(IStream * pStream, ISpErrorLog * pErrorLog);
  136. HRESULT InitFromBinaryGrammar(const SPBINARYGRAMMAR * pBinaryData);
  137. };
  138. //--- ISpITNProcessor ----------------------------------------------------------
  139. [
  140. object,
  141. uuid(12D7360F-A1C9-11d3-BC90-00C04F72DF9F),
  142. helpstring("ISpITNProcessor Interface"),
  143. pointer_default(unique),
  144. local,
  145. restricted
  146. ]
  147. interface ISpITNProcessor : IUnknown
  148. {
  149. HRESULT LoadITNGrammar(WCHAR *pszCLSID);
  150. HRESULT ITNPhrase(ISpPhraseBuilder *pPhrase);
  151. };
  152. [
  153. object,
  154. uuid(88A3342A-0BED-4834-922B-88D43173162F),
  155. local,
  156. helpstring("ISpPhraseBuilder Interface"),
  157. pointer_default(unique),
  158. restricted
  159. ]
  160. interface ISpPhraseBuilder : ISpPhrase
  161. {
  162. HRESULT InitFromPhrase(const SPPHRASE * pPhrase);
  163. HRESULT InitFromSerializedPhrase(const SPSERIALIZEDPHRASE * pPhrase);
  164. HRESULT AddElements(ULONG cElements, const SPPHRASEELEMENT *pElement);
  165. HRESULT AddRules(const SPPHRASERULEHANDLE hParent, const SPPHRASERULE * pRule, SPPHRASERULEHANDLE * phNewRule);
  166. HRESULT AddProperties(const SPPHRASEPROPERTYHANDLE hParent, const SPPHRASEPROPERTY * pProperty, SPPHRASEPROPERTYHANDLE * phNewProperty);
  167. HRESULT AddReplacements(ULONG cReplacements, const SPPHRASEREPLACEMENT * pReplacements);
  168. };
  169. //--- ISpTask ---------------------------------------------------------------
  170. cpp_quote("#if defined(__cplusplus)")
  171. cpp_quote("interface ISpTask")
  172. cpp_quote("{")
  173. cpp_quote("virtual HRESULT STDMETHODCALLTYPE Execute(")
  174. cpp_quote(" void *pvTaskData,")
  175. cpp_quote(" volatile const BOOL* pfContinueProcessing) = 0;")
  176. cpp_quote("};")
  177. cpp_quote("#else")
  178. typedef void * ISpTask;
  179. cpp_quote("#endif")
  180. //--- ISpThreadTask ---------------------------------------------------------
  181. cpp_quote("#if defined(__cplusplus)")
  182. cpp_quote("interface ISpThreadTask")
  183. cpp_quote("{")
  184. cpp_quote("virtual HRESULT STDMETHODCALLTYPE InitThread(")
  185. cpp_quote(" void * pvTaskData,")
  186. cpp_quote(" HWND hwnd) = 0;")
  187. cpp_quote("virtual HRESULT STDMETHODCALLTYPE ThreadProc(")
  188. cpp_quote(" void *pvTaskData,")
  189. cpp_quote(" HANDLE hExitThreadEvent,")
  190. cpp_quote(" HANDLE hNotifyEvent,")
  191. cpp_quote(" HWND hwndWorker,")
  192. cpp_quote(" volatile const BOOL * pfContinueProcessing) = 0;")
  193. cpp_quote("virtual LRESULT STDMETHODCALLTYPE WindowMessage(")
  194. cpp_quote(" void *pvTaskData,")
  195. cpp_quote(" HWND hWnd,")
  196. cpp_quote(" UINT Msg,")
  197. cpp_quote(" WPARAM wParam,")
  198. cpp_quote(" LPARAM lParam) = 0;")
  199. cpp_quote("};")
  200. cpp_quote("#else")
  201. typedef void * ISpThreadTask;
  202. cpp_quote("#endif")
  203. //--- ISpThreadControl ------------------------------------------------------
  204. [
  205. object,
  206. uuid(A6BE4D73-4403-4358-B22D-0346E23B1764),
  207. helpstring("ISpThreadControl Interface"),
  208. pointer_default(unique),
  209. local,
  210. restricted
  211. ]
  212. interface ISpThreadControl : ISpNotifySink
  213. {
  214. HRESULT StartThread(DWORD dwFlags, HWND * phwnd);
  215. HRESULT WaitForThreadDone(
  216. BOOL fForceStop,
  217. HRESULT * phrThreadResult,
  218. ULONG msTimeOut);
  219. HRESULT TerminateThread(void);
  220. HANDLE ThreadHandle(void);
  221. DWORD ThreadId(void);
  222. HANDLE NotifyEvent(void);
  223. HWND WindowHandle(void);
  224. HANDLE ThreadCompleteEvent(void);
  225. HANDLE ExitThreadEvent(void);
  226. };
  227. //--- ISpTaskManager --------------------------------------------------------
  228. // This interface is used to implement a task managment service provider
  229. // to optimize thread usage.
  230. typedef [restricted] struct SPTMTHREADINFO
  231. {
  232. long lPoolSize; // Number of threads in pool (-1 default)
  233. long lPriority; // Priority of threads in pool
  234. ULONG ulConcurrencyLimit; // Number of threads allowed to concurrently execute (0 default)
  235. ULONG ulMaxQuickAllocThreads; // Maximum number of dedicated threads retained
  236. } SPTMTHREADINFO;
  237. [
  238. local,
  239. uuid(2BAEEF81-2CA3-4331-98F3-26EC5ABEFB03),
  240. helpstring("ISpTaskManager Interface"),
  241. pointer_default(unique),
  242. restricted
  243. ]
  244. interface ISpTaskManager : IUnknown
  245. {
  246. HRESULT SetThreadPoolInfo([in] const SPTMTHREADINFO* pPoolInfo);
  247. HRESULT GetThreadPoolInfo([out] SPTMTHREADINFO* pPoolInfo);
  248. HRESULT QueueTask(
  249. [in] ISpTask* pTask,
  250. [in] void* pvTaskData,
  251. [in] HANDLE hCompEvent,
  252. [in, out] DWORD* pdwGroupId,
  253. [out] DWORD* pTaskID);
  254. HRESULT CreateReoccurringTask(
  255. [in] ISpTask* pTask,
  256. [in] void* pvTaskData,
  257. [in] HANDLE hCompEvent,
  258. [out] ISpNotifySink** ppTaskCtrl);
  259. HRESULT CreateThreadControl(
  260. [in] ISpThreadTask* pTask,
  261. [in] void* pvTaskData,
  262. [in] long nPriority,
  263. [out] ISpThreadControl** ppTaskCtrl);
  264. HRESULT TerminateTask([in] DWORD dwTaskId, [in] ULONG ulWaitPeriod);
  265. HRESULT TerminateTaskGroup([in] DWORD dwGroupId, [in] ULONG ulWaitPeriod);
  266. };
  267. //--- ISpTTSEngineSite ------------------------------------------------------
  268. typedef enum SPVSKIPTYPE
  269. {
  270. SPVST_SENTENCE = (1L << 0) // Skip sentences
  271. } SPVSKIPTYPE;
  272. typedef enum SPVESACTIONS
  273. {
  274. SPVES_CONTINUE = 0,
  275. SPVES_ABORT = ( 1L << 0 ),
  276. SPVES_SKIP = ( 1L << 1 ),
  277. SPVES_RATE = ( 1L << 2 ),
  278. SPVES_VOLUME = ( 1L << 3 )
  279. } SPVESACTIONS;
  280. [
  281. object,
  282. local,
  283. uuid(9880499B-CCE9-11d2-B503-00C04F797396),
  284. helpstring("ISpTTSEngineSite Interface"),
  285. pointer_default(unique)
  286. ]
  287. interface ISpTTSEngineSite : ISpEventSink
  288. {
  289. DWORD GetActions( void );
  290. HRESULT Write( [in]const void* pBuff, [in]ULONG cb, [out]ULONG *pcbWritten );
  291. HRESULT GetRate( [out]long* pRateAdjust );
  292. HRESULT GetVolume( [out]USHORT* pusVolume );
  293. HRESULT GetSkipInfo( [out]SPVSKIPTYPE* peType, [out]long* plNumItems );
  294. HRESULT CompleteSkip( [in]long ulNumSkipped );
  295. };
  296. //--- ISpTTSEngine ----------------------------------------------------------
  297. typedef struct SPVTEXTFRAG
  298. {
  299. struct SPVTEXTFRAG* pNext; // Next text fragment in list, NULL == end of list
  300. SPVSTATE State; // Current XML attribute state
  301. LPCWSTR pTextStart;
  302. ULONG ulTextLen;
  303. ULONG ulTextSrcOffset; // Original source position of the fragment text
  304. } SPVTEXTFRAG;
  305. [
  306. object,
  307. local,
  308. uuid(A74D7C8E-4CC5-4f2f-A6EB-804DEE18500E),
  309. helpstring("ISpTTSEngine Interface"),
  310. pointer_default(unique)
  311. ]
  312. interface ISpTTSEngine : IUnknown
  313. {
  314. HRESULT Speak( [in]DWORD dwSpeakFlags,
  315. [in]REFGUID rguidFormatId, [in]const WAVEFORMATEX * pWaveFormatEx,
  316. [in]const SPVTEXTFRAG* pTextFragList, [in]ISpTTSEngineSite* pOutputSite );
  317. HRESULT GetOutputFormat( [in] const GUID * pTargetFmtId, [in] const WAVEFORMATEX * pTargetWaveFormatEx,
  318. [out] GUID * pOutputFormatId, [out] WAVEFORMATEX ** ppCoMemOutputWaveFormatEx);
  319. };
  320. //--- SR Engine data structures ----------------------------------------
  321. typedef [restricted] struct SPWORDENTRY
  322. {
  323. SPWORDHANDLE hWord;
  324. LANGID LangID;
  325. WCHAR * pszDisplayText;
  326. WCHAR * pszLexicalForm;
  327. SPPHONEID * aPhoneId;
  328. void * pvClientContext;
  329. } SPWORDENTRY;
  330. typedef [restricted] struct SPRULEENTRY
  331. {
  332. SPRULEHANDLE hRule;
  333. SPSTATEHANDLE hInitialState;
  334. DWORD Attributes; // SPCFGRULEATTRIBUTES
  335. void * pvClientRuleContext;
  336. void * pvClientGrammarContext;
  337. } SPRULEENTRY;
  338. typedef enum SPTRANSITIONTYPE
  339. {
  340. SPTRANSEPSILON,
  341. SPTRANSWORD,
  342. SPTRANSRULE,
  343. SPTRANSTEXTBUF,
  344. SPTRANSWILDCARD,
  345. SPTRANSDICTATION
  346. } SPTRANSITIONTYPE;
  347. typedef [restricted] struct SPTRANSITIONENTRY
  348. {
  349. SPTRANSITIONID ID;
  350. SPSTATEHANDLE hNextState;
  351. BYTE Type; // SPTRANSITIONTYPE
  352. char RequiredConfidence;
  353. struct
  354. {
  355. DWORD fHasProperty; // Boolean type
  356. };
  357. float Weight;
  358. union
  359. {
  360. struct
  361. {
  362. SPSTATEHANDLE hRuleInitialState; // Only if Type == SPTRANSRULE
  363. SPRULEHANDLE hRule;
  364. void * pvClientRuleContext;
  365. };
  366. struct
  367. {
  368. SPWORDHANDLE hWord; // Only if Type == SPTRANSWORD
  369. void * pvClientWordContext;
  370. };
  371. struct
  372. {
  373. void * pvGrammarCookie; // Only if Type == SPTRANSTEXTBUF or SPTRANSWILDCARD or SPTRANSDICTATION
  374. };
  375. };
  376. } SPTRANSITIONENTRY;
  377. typedef [restricted] struct SPTRANSITIONPROPERTY
  378. {
  379. const WCHAR * pszName;
  380. ULONG ulId;
  381. const WCHAR * pszValue;
  382. VARIANT vValue; // Will be VT_BOOL, VT_I4, VT_R4, VT_R8, or VT_BYREF (only for dynamic grammars)
  383. } SPTRANSITIONPROPERTY;
  384. typedef [restricted] struct SPSTATEINFO
  385. {
  386. ULONG cAllocatedEntries;
  387. SPTRANSITIONENTRY * pTransitions;
  388. ULONG cEpsilons;
  389. ULONG cRules;
  390. ULONG cWords;
  391. ULONG cSpecialTransitions;
  392. } SPSTATEINFO;
  393. typedef [restricted] struct SPPATHENTRY
  394. {
  395. SPTRANSITIONID hTransition;
  396. SPPHRASEELEMENT elem;
  397. } SPPATHENTRY;
  398. //--- ISpCFGInterpreterSite -------------------------------------------------
  399. [
  400. object,
  401. uuid(6A6FFAD8-78B6-473d-B844-98152E4FB16B),
  402. helpstring("ISpCFGInterpreterSite Interface"),
  403. pointer_default(unique),
  404. local,
  405. restricted
  406. ]
  407. interface ISpCFGInterpreterSite : IUnknown
  408. {
  409. HRESULT AddTextReplacement([in] SPPHRASEREPLACEMENT * pReplace);
  410. HRESULT AddProperty([in] const SPPHRASEPROPERTY *pProperty);
  411. HRESULT GetResourceValue(
  412. [in] const WCHAR *pszResourceName,
  413. [out] WCHAR ** ppCoMemResource);
  414. };
  415. //--- ISpCFGInterpreter -----------------------------------------------------
  416. [
  417. object,
  418. uuid(F3D3F926-11FC-11d3-BB97-00C04F8EE6C0),
  419. helpstring("ISpCFGInterpreter Interface"),
  420. pointer_default(unique),
  421. local,
  422. restricted
  423. ]
  424. interface ISpCFGInterpreter : IUnknown
  425. {
  426. HRESULT InitGrammar(
  427. [in] const WCHAR * pszGrammarName,
  428. [in] const void ** pvGrammarData);
  429. HRESULT Interpret(
  430. [in] ISpPhraseBuilder * pPhrase,
  431. [in] const ULONG ulFirstElement,
  432. [in] const ULONG ulCountOfElements,
  433. [in] ISpCFGInterpreterSite * pSite);
  434. };
  435. typedef enum SPCFGNOTIFY
  436. {
  437. SPCFGN_ADD,
  438. SPCFGN_REMOVE,
  439. SPCFGN_INVALIDATE,
  440. SPCFGN_ACTIVATE,
  441. SPCFGN_DEACTIVATE
  442. } SPCFGNOTIFY;
  443. //--- ISpSREngineSite -------------------------------------------------------
  444. typedef enum SPRESULTTYPE
  445. {
  446. SPRT_CFG = 0,
  447. SPRT_SLM = 1,
  448. SPRT_PROPRIETARY = 2,
  449. SPRT_FALSE_RECOGNITION = ( 1L << 2 ) // Flag used to indicate a false recognition
  450. } SPRESULTTYPE;
  451. typedef struct tagSPPHRASEALT
  452. {
  453. ISpPhraseBuilder * pPhrase;
  454. ULONG ulStartElementInParent;
  455. ULONG cElementsInParent;
  456. ULONG cElementsInAlternate;
  457. void * pvAltExtra;
  458. ULONG cbAltExtra;
  459. } SPPHRASEALT;
  460. // Result structure passed from engine to SAPI
  461. typedef struct SPRECORESULTINFO
  462. {
  463. ULONG cbSize; // Total size of this structure
  464. SPRESULTTYPE eResultType; // Type of result object (CFG, SLM, or Proprietary)
  465. BOOL fHypothesis; // If true then this recognition is a hypothesis
  466. BOOL fProprietaryAutoPause;// This field is only used for SPERT_PROPRIETARY grammars. If true, recognition will pause.
  467. ULONGLONG ullStreamPosStart; // Start and end stream positions of recognition
  468. ULONGLONG ullStreamPosEnd;
  469. SPGRAMMARHANDLE hGrammar; // Required for SPERT_SLM and SPERT_PROPRIETARY else NULL
  470. ULONG ulSizeEngineData; // Size of pvEngineData
  471. void * pvEngineData; // Extra engine specific data
  472. ISpPhraseBuilder* pPhrase; // Pointer to phrase object
  473. SPPHRASEALT* aPhraseAlts; // Alternates array
  474. ULONG ulNumAlts; // Number of alternates in the array
  475. } SPRECORESULTINFO;
  476. typedef enum SPWORDINFOOPT
  477. {
  478. SPWIO_NONE = 0,
  479. SPWIO_WANT_TEXT = 1
  480. } SPWORDINFOOPT;
  481. typedef enum SPRULEINFOOPT
  482. {
  483. SPRIO_NONE = 0,
  484. } SPRULEINFOOPT;
  485. typedef struct SPPARSEINFO
  486. {
  487. ULONG cbSize;
  488. SPRULEHANDLE hRule;
  489. ULONGLONG ullAudioStreamPosition;
  490. ULONG ulAudioSize;
  491. ULONG cTransitions;
  492. SPPATHENTRY * pPath;
  493. GUID SREngineID;
  494. ULONG ulSREnginePrivateDataSize;
  495. const BYTE * pSREnginePrivateData;
  496. BOOL fHypothesis;
  497. } SPPARSEINFO;
  498. [
  499. object,
  500. uuid(3B414AEC-720C-4883-B9EF-178CD394FB3A),
  501. helpstring("ISpSREngineSite Interface"),
  502. pointer_default(unique),
  503. local
  504. ]
  505. interface ISpSREngineSite : IUnknown
  506. {
  507. HRESULT Read([in] void * pv, [in] ULONG cb, [out] ULONG * pcbRead);
  508. HRESULT DataAvailable(ULONG * pcb);
  509. HRESULT SetBufferNotifySize([in] ULONG cbSize);
  510. HRESULT ParseFromTransitions([in] const SPPARSEINFO * pParseInfo,
  511. [out] ISpPhraseBuilder ** ppNewPhrase);
  512. HRESULT Recognition([in] const SPRECORESULTINFO * pResultInfo);
  513. HRESULT AddEvent([in] const SPEVENT* pEvent, [in] SPRECOCONTEXTHANDLE hSAPIRecoContext);
  514. HRESULT Synchronize([in] ULONGLONG ullProcessedThruPos);
  515. HRESULT GetWordInfo([in, out] SPWORDENTRY * pWordEntry, [in] SPWORDINFOOPT Options); // Caller must fill in hWord. if fWantWordText then caller must CoTaskMemFree the pszWord.
  516. HRESULT SetWordClientContext(SPWORDHANDLE hWord, void * pvClientContext);
  517. HRESULT GetRuleInfo([in, out] SPRULEENTRY * pRuleEntry, [in] SPRULEINFOOPT Options); // Caller must fill in hRule.SPRULEHANDLE hRule, BOOL * pfActive, BOOL *pfAutoPause, SPSTATEHANDLE * phInitialState, void ** ppvClientContext);
  518. HRESULT SetRuleClientContext(SPRULEHANDLE hRule, void * pvClientContext);
  519. HRESULT GetStateInfo(SPSTATEHANDLE hState, SPSTATEINFO * pStateInfo);
  520. HRESULT GetResource( [in] SPRULEHANDLE hRule, [in] const WCHAR *pszResourceName, [out] WCHAR ** ppCoMemResource );
  521. HRESULT GetTransitionProperty([in] SPTRANSITIONID ID, [out] SPTRANSITIONPROPERTY **ppCoMemProperty);
  522. HRESULT IsAlternate( [in]SPRULEHANDLE hRule, [in]SPRULEHANDLE hAltRule );
  523. HRESULT GetMaxAlternates( [in]SPRULEHANDLE hRule, [out]ULONG* pulNumAlts );
  524. HRESULT GetContextMaxAlternates( [in] SPRECOCONTEXTHANDLE hContext, [out] ULONG * pulNumAlts);
  525. HRESULT UpdateRecoPos([in] ULONGLONG ullCurrentRecoPos);
  526. };
  527. //--- ISpSREngine -----------------------------------------------------------
  528. typedef enum SPPROPSRC
  529. {
  530. SPPROPSRC_RECO_INST,
  531. SPPROPSRC_RECO_CTX,
  532. SPPROPSRC_RECO_GRAMMAR
  533. } SPPROPSRC;
  534. [
  535. object,
  536. uuid(2F472991-854B-4465-B613-FBAFB3AD8ED8),
  537. helpstring("ISpSREngine Interface"),
  538. pointer_default(unique),
  539. local
  540. ]
  541. interface ISpSREngine : IUnknown
  542. {
  543. HRESULT SetSite([in] ISpSREngineSite *pSite);
  544. HRESULT GetInputAudioFormat(
  545. [in] const GUID * pguidSourceFormatId,
  546. [in] const WAVEFORMATEX * pSourceWaveFormatEx,
  547. [out] GUID * pguidDesiredFormatId,
  548. [out] WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx);
  549. HRESULT RecognizeStream([in] REFGUID rguidFmtId, [in] const WAVEFORMATEX * pWaveFormatEx,
  550. [in] HANDLE hRequestSync, [in] HANDLE hDataAvailable,
  551. [in] HANDLE hExit, [in] BOOL fNewAudioStream, [in] BOOL fRealTimeAudio,
  552. [in] ISpObjectToken * pAudioObjectToken);
  553. HRESULT SetRecoProfile(ISpObjectToken * pProfile);
  554. HRESULT OnCreateGrammar([in] void * pvEngineRecoContext,
  555. [in] SPGRAMMARHANDLE hSAPIGrammar,
  556. [out] void ** ppvEngineGrammarContext);
  557. HRESULT OnDeleteGrammar([in] void * pvEngineGrammar);
  558. HRESULT LoadProprietaryGrammar(
  559. [in] void * pvEngineGrammar,
  560. [in] REFGUID rguidParam,
  561. [in, string] const WCHAR * pszStringParam,
  562. [in] const void * pvDataParam,
  563. [in] ULONG ulDataSize,
  564. [in] SPLOADOPTIONS Options); // Note for SAPI 5.0 this is always SPLO_NONE
  565. HRESULT UnloadProprietaryGrammar([in] void * pvEngineGrammar);
  566. HRESULT SetProprietaryRuleState([in] void * pvEngineGrammar,
  567. [in, string] const WCHAR * pszName,
  568. [in] void * pReserved,
  569. [in] SPRULESTATE NewState,
  570. [out] ULONG * pcRulesChanged);
  571. HRESULT SetProprietaryRuleIdState([in] void * pvEngineGrammar,
  572. [in] DWORD dwRuleId,
  573. [in] SPRULESTATE NewState);
  574. HRESULT LoadSLM([in] void * pvEngineGrammar, [in, string] const WCHAR * pszTopicName);
  575. HRESULT UnloadSLM([in] void * pvEngineGrammar);
  576. HRESULT SetSLMState([in] void * pvEngineGrammar, [in] SPRULESTATE NewState);
  577. HRESULT SetWordSequenceData([in] void * pvEngineGrammar, [in] const WCHAR * pText, [in] ULONG cchText, [in] const SPTEXTSELECTIONINFO * pInfo);
  578. HRESULT SetTextSelection([in] void * pvEngineGrammar, [in] const SPTEXTSELECTIONINFO * pInfo);
  579. HRESULT IsPronounceable([in] void * pvEngineGrammar, [in, string] const WCHAR * pszWord, [out] SPWORDPRONOUNCEABLE *pWordPronounceable);
  580. HRESULT OnCreateRecoContext(
  581. [in] SPRECOCONTEXTHANDLE hSAPIRecoContext,
  582. [out] void ** ppvEngineContext);
  583. HRESULT OnDeleteRecoContext([in] void * pvEngineContext);
  584. HRESULT PrivateCall([in] void * pvEngineContext, [in, out] PVOID pCallFrame, [in] ULONG ulCallFrameSize);
  585. HRESULT SetAdaptationData([in] void * pvEngineContext, const WCHAR *pAdaptationData, const ULONG cch);
  586. HRESULT SetPropertyNum( [in]SPPROPSRC eSrc, [in]void* pvSrcObj,
  587. [in]const WCHAR* pName, [in]LONG lValue );
  588. HRESULT GetPropertyNum( [in]SPPROPSRC eSrc, [in]void* pvSrcObj,
  589. [in]const WCHAR* pName, [out]LONG* lValue );
  590. HRESULT SetPropertyString( [in]SPPROPSRC eSrc, [in]void* pvSrcObj,
  591. [in]const WCHAR* pName, [in]const WCHAR* pValue );
  592. HRESULT GetPropertyString( [in]SPPROPSRC eSrc, [in]void* pvSrcObj,
  593. [in]const WCHAR* pName, [out]WCHAR** ppCoMemValue );
  594. HRESULT SetGrammarState([in] void * pvEngineGrammar, [in] SPGRAMMARSTATE eGrammarState);
  595. HRESULT WordNotify(SPCFGNOTIFY Action, ULONG cWords, const SPWORDENTRY * pWords);
  596. HRESULT RuleNotify(SPCFGNOTIFY Action, ULONG cRules, const SPRULEENTRY * pRules);
  597. HRESULT PrivateCallEx([in] void * pvEngineContext, [in] const void * pInCallFrame, [in] ULONG ulInCallFrameSize,
  598. [out] void ** ppvCoMemResponse, [out] ULONG * pulResponseSize);
  599. HRESULT SetContextState([in] void * pvEngineContext, [in] SPCONTEXTSTATE eContextState);
  600. };
  601. //--- ISpSRAlternates
  602. typedef struct tagSPPHRASEALTREQUEST
  603. {
  604. ULONG ulStartElement;
  605. ULONG cElements;
  606. ULONG ulRequestAltCount;
  607. void * pvResultExtra;
  608. ULONG cbResultExtra;
  609. ISpPhrase * pPhrase;
  610. ISpRecoContext * pRecoContext;
  611. } SPPHRASEALTREQUEST;
  612. [
  613. object,
  614. uuid(FECE8294-2BE1-408f-8E68-2DE377092F0E),
  615. helpstring("ISpSRAlternates Interface"),
  616. pointer_default(unique),
  617. local
  618. ]
  619. interface ISpSRAlternates : IUnknown
  620. {
  621. HRESULT GetAlternates([in] SPPHRASEALTREQUEST * pAltRequest,
  622. [out] SPPHRASEALT **ppAlts,
  623. [out] ULONG *pcAlts);
  624. HRESULT Commit([in] SPPHRASEALTREQUEST * pAltRequest,
  625. [in] SPPHRASEALT * pAlt,
  626. [out] void **ppvResultExtra,
  627. [out] ULONG *pcbResultExtra);
  628. }
  629. // Interface used by engine specific recoctxt extension object to call into engine
  630. [
  631. object,
  632. uuid(8E7C791E-4467-11d3-9723-00C04F72DB08),
  633. helpstring("_ISpPrivateEngineCall Interface"),
  634. pointer_default(unique),
  635. local
  636. ]
  637. interface _ISpPrivateEngineCall : IUnknown
  638. {
  639. HRESULT CallEngine([in, out] void * pCallFrame, [in] ULONG ulCallFrameSize);
  640. HRESULT CallEngineEx([in] const void * pInFrame, [in] ULONG ulInFrameSize,
  641. [out] void ** ppCoMemOutFrame, [out] ULONG * pulOutFrameSize);
  642. }
  643. //
  644. //--- CoClass definitions ---------------------------------------------------
  645. //
  646. [
  647. helpstring("Microsoft Speech Object DDK Library"),
  648. uuid(9903F14C-12CE-4c99-9986-2EE3D7D588A8),
  649. version(5.0)
  650. ]
  651. library SpeechDDKLib
  652. {
  653. importlib("stdole32.tlb");
  654. importlib("stdole2.tlb");
  655. //--- SpDataKey ---------------------------------------------------------
  656. [
  657. uuid(D9F6EE60-58C9-458b-88E1-2F908FD7F87C),
  658. helpstring("Data Key")
  659. ]
  660. coclass SpDataKey
  661. {
  662. interface ISpRegDataKey;
  663. [default] interface ISpDataKey;
  664. }
  665. //--- SpObjectTokenEnum --------------------------------------------------
  666. [
  667. uuid(3918D75F-0ACB-41f2-B733-92AA15BCECF6),
  668. helpstring("Object Token Enumerator")
  669. ]
  670. coclass SpObjectTokenEnum
  671. {
  672. interface ISpObjectTokenEnumBuilder;
  673. [default] interface IEnumSpObjectTokens;
  674. }
  675. //--- SpPhraseBuilder ---------------------------------------------------
  676. [
  677. uuid(777B6BBD-2FF2-11d3-88FE-00C04F8EF9B5),
  678. helpstring("Phrase Builder Class")
  679. ]
  680. coclass SpPhraseBuilder
  681. {
  682. [default] interface ISpPhraseBuilder;
  683. }
  684. //--- SpITNProcessor ----------------------------------------------------
  685. [
  686. uuid(12D73610-A1C9-11d3-BC90-00C04F72DF9F),
  687. helpstring("SpITNProcessor Class"),
  688. restricted
  689. ]
  690. coclass SpITNProcessor
  691. {
  692. [default] interface ISpITNProcessor;
  693. };
  694. //--- SpGrammarCompiler ---------------------------------------------
  695. [
  696. uuid(B1E29D59-A675-11D2-8302-00C04F8EE6C0),
  697. helpstring("Microsoft Speech Grammar Compiler")
  698. ]
  699. coclass SpGrammarCompiler
  700. {
  701. [default] interface ISpGrammarCompiler;
  702. };
  703. //--- SpGramCompBackend ---------------------------------------------
  704. [
  705. uuid(DA93E903-C843-11D2-A084-00C04F8EF9B5),
  706. helpstring("Grammar Class"),
  707. restricted
  708. ]
  709. coclass SpGramCompBackend
  710. {
  711. [default] interface ISpGramCompBackend;
  712. };
  713. }