File: sapi.idl

package info (click to toggle)
wine 10.0~repack-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, forky-proposed-updates
  • size: 326,452 kB
  • sloc: ansic: 4,155,993; perl: 23,800; yacc: 22,031; javascript: 15,872; makefile: 12,352; pascal: 9,519; objc: 6,923; lex: 5,273; xml: 3,219; python: 2,688; cpp: 1,741; sh: 895; java: 750; asm: 299; cs: 62
file content (1385 lines) | stat: -rw-r--r-- 40,979 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
/*
 * Speech API (SAPI) IDL file.
 *
 * Copyright (C) 2017 Huw Davies
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

import "oaidl.idl";
import "ocidl.idl";

#ifndef __WIDL__
#define threading(model)
#define progid(str)
#define vi_progid(str)
#endif

cpp_quote("#if 0")
typedef [restricted, hidden] struct WAVEFORMATEX
{
    WORD  wFormatTag;
    WORD  nChannels;
    DWORD nSamplesPerSec;
    DWORD nAvgBytesPerSec;
    WORD  nBlockAlign;
    WORD  wBitsPerSample;
    WORD  cbSize;
} WAVEFORMATEX;
cpp_quote("#else")
cpp_quote("#include <mmsystem.h>")
cpp_quote("#endif")

cpp_quote("#if defined(__cplusplus)")
cpp_quote("interface ISpNotifyCallback")
cpp_quote("{")
cpp_quote("virtual HRESULT STDMETHODCALLTYPE NotifyCallback(WPARAM wParam, LPARAM lParam) = 0;")
cpp_quote("};")
cpp_quote("#else")
typedef void * ISpNotifyCallback;
cpp_quote("#endif")

cpp_quote("#if 0")
typedef void * SPNOTIFYCALLBACK;
typedef void * SPSTATEHANDLE;
cpp_quote("#endif")

typedef [restricted, hidden] struct SPEVENT
{
    WORD      eEventId;
    WORD      elParamType;
    ULONG     ulStreamNum;
    ULONGLONG ullAudioStreamOffset;
    WPARAM    wParam;
    LPARAM    lParam;
} SPEVENT;

cpp_quote("typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam);")
cpp_quote("DECLARE_HANDLE(SPSTATEHANDLE);")

const ULONG SP_MAX_LANGIDS = 20;

typedef [restricted, hidden] struct SPEVENTSOURCEINFO
{
    ULONGLONG   ullEventInterest;
    ULONGLONG   ullQueuedInterest;
    ULONG       ulCount;
} SPEVENTSOURCEINFO;

typedef [hidden] enum SPGRAMMARWORDTYPE
{
    SPWT_DISPLAY,
    SPWT_LEXICAL,
    SPWT_PRONUNCIATION,
    SPWT_LEXICAL_NO_SPECIAL_CHARS
} SPGRAMMARWORDTYPE;

typedef [hidden] struct tagSPPROPERTYINFO
{
    const WCHAR *pszName;
    ULONG        ulId;
    const WCHAR *pszValue;
    VARIANT      vValue;
} SPPROPERTYINFO;

typedef [hidden] enum SPDATAKEYLOCATION
{
    SPDKL_DefaultLocation = 0,
    SPDKL_CurrentUser     = 1,
    SPDKL_LocalMachine    = 2,
    SPDKL_CurrentConfig   = 5
} SPDATAKEYLOCATION;

typedef [hidden] enum SPLOADOPTIONS
{
    SPLO_STATIC,
    SPLO_DYNAMIC
} SPLOADOPTIONS;

typedef [hidden] enum SPRULESTATE
{
    SPRS_INACTIVE               = 0,
    SPRS_ACTIVE                 = 1,
    SPRS_ACTIVE_WITH_AUTO_PAUSE = 3,
    SPRS_ACTIVE_USER_DELIMITED  = 4
} SPRULESTATE;

typedef [hidden] enum SPGRAMMARSTATE
{
    SPGS_DISABLED  = 0,
    SPGS_ENABLED   = 1,
    SPGS_EXCLUSIVE = 3
} SPGRAMMARSTATE;

typedef [hidden] struct SPBINARYGRAMMAR
{
    ULONG ulTotalSerializedSize;
} SPBINARYGRAMMAR;

typedef [hidden] struct tagSPTEXTSELECTIONINFO
{
    ULONG ulStartActiveOffset;
    ULONG cchActiveChars;
    ULONG ulStartSelection;
    ULONG cchSelection;
} SPTEXTSELECTIONINFO;

typedef [hidden] enum SPWORDPRONOUNCEABLE
{
    SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE,
    SPWP_UNKNOWN_WORD_PRONOUNCEABLE,
    SPWP_KNOWN_WORD_PRONOUNCEABLE
} SPWORDPRONOUNCEABLE;

typedef [hidden] enum SPINTERFERENCE
{
    SPINTERFERENCE_NONE,
    SPINTERFERENCE_NOISE,
    SPINTERFERENCE_NOSIGNAL,
    SPINTERFERENCE_TOOLOUD,
    SPINTERFERENCE_TOOQUIET,
    SPINTERFERENCE_TOOFAST,
    SPINTERFERENCE_TOOSLOW
} SPINTERFERENCE;

typedef [hidden] enum SPVISEMES
{
    SP_VISEME_0 = 0,
    SP_VISEME_1,
    SP_VISEME_2,
    SP_VISEME_3,
    SP_VISEME_4,
    SP_VISEME_5,
    SP_VISEME_6,
    SP_VISEME_7,
    SP_VISEME_8,
    SP_VISEME_9,
    SP_VISEME_10,
    SP_VISEME_11,
    SP_VISEME_12,
    SP_VISEME_13,
    SP_VISEME_14,
    SP_VISEME_15,
    SP_VISEME_16,
    SP_VISEME_17,
    SP_VISEME_18,
    SP_VISEME_19,
    SP_VISEME_20,
    SP_VISEME_21,
} SPVISEMES;

typedef [hidden] enum SPEVENTENUM
{
    SPEI_UNDEFINED           = 0,
    SPEI_START_INPUT_STREAM  = 1,
    SPEI_END_INPUT_STREAM    = 2,
    SPEI_VOICE_CHANGE        = 3,
    SPEI_TTS_BOOKMARK        = 4,
    SPEI_WORD_BOUNDARY       = 5,
    SPEI_PHONEME             = 6,
    SPEI_SENTENCE_BOUNDARY   = 7,
    SPEI_VISEME              = 8,
    SPEI_TTS_AUDIO_LEVEL     = 9,
    SPEI_TTS_PRIVATE         = 15,

    SPEI_MIN_TTS             = 1,
    SPEI_MAX_TTS             = 15,

    SPEI_END_SR_STREAM          = 34,
    SPEI_SOUND_START            = 35,
    SPEI_SOUND_END              = 36,
    SPEI_PHRASE_START           = 37,
    SPEI_RECOGNITION            = 38,
    SPEI_HYPOTHESIS             = 39,
    SPEI_SR_BOOKMARK            = 40,
    SPEI_PROPERTY_NUM_CHANGE    = 41,
    SPEI_PROPERTY_STRING_CHANGE = 42,
    SPEI_FALSE_RECOGNITION      = 43,
    SPEI_INTERFERENCE           = 44,
    SPEI_REQUEST_UI             = 45,
    SPEI_RECO_STATE_CHANGE      = 46,
    SPEI_ADAPTATION             = 47,
    SPEI_START_SR_STREAM        = 48,
    SPEI_RECO_OTHER_CONTEXT     = 49,
    SPEI_SR_AUDIO_LEVEL         = 50,
    SPEI_SR_RETAINEDAUDIO       = 51,
    SPEI_SR_PRIVATE             = 52,
    SPEI_ACTIVE_CATEGORY_CHANGED = 53,

    SPEI_MIN_SR              = 34,
    SPEI_MAX_SR              = 55,

    SPEI_RESERVED1           = 30,
    SPEI_RESERVED2           = 33,
    SPEI_RESERVED3           = 63
} SPEVENTENUM;

typedef [hidden] enum SPCONTEXTSTATE
{
    SPCS_DISABLED = 0,
    SPCS_ENABLED  = 1,
} SPCONTEXTSTATE;

typedef [hidden] enum SPVPRIORITY
{
    SPVPRI_NORMAL = 0,
    SPVPRI_ALERT  = 1,
    SPVPRI_OVER   = 2
} SPVPRIORITY;

typedef [hidden] enum SPRECOSTATE
{
    SPRST_INACTIVE,
    SPRST_ACTIVE,
    SPRST_ACTIVE_ALWAYS,
    SPRST_INACTIVE_WITH_PURGE,
    SPRST_NUM_STATES
} SPRECOSTATE;

typedef [hidden] enum SPWAVEFORMATTYPE
{
    SPWF_INPUT,
    SPWF_SRENGINE
} SPSTREAMFORMATTYPE;

typedef [restricted, hidden] struct SPRECOCONTEXTSTATUS
{
    SPINTERFERENCE  eInterference;
    WCHAR           szRequestTypeOfUI[255];
    DWORD           dwReserved1;
    DWORD           dwReserved2;
} SPRECOCONTEXTSTATUS;

typedef [hidden] enum SPAUDIOOPTIONS
{
    SPAO_NONE,
    SPAO_RETAIN_AUDIO
} SPAUDIOOPTIONS;

typedef [hidden] struct SPSERIALIZEDRESULT
{
    ULONG ulSerializedSize;
} SPSERIALIZEDRESULT;

typedef [hidden] enum SPDISPLYATTRIBUTES
{
    SPAF_ONE_TRAILING_SPACE     = 0x02,
    SPAF_TWO_TRAILING_SPACES    = 0x04,
    SPAF_CONSUME_LEADING_SPACES = 0x08,
    SPAF_ALL                    = 0x0f
} SPDISPLAYATTRIBUTES;

typedef [hidden] enum SPBOOKMARKOPTIONS
{
    SPBO_NONE,
    SPBO_PAUSE
} SPBOOKMARKOPTIONS;

typedef [hidden] enum _SPAUDIOSTATE
{
    SPAS_CLOSED,
    SPAS_STOP,
    SPAS_PAUSE,
    SPAS_RUN
} SPAUDIOSTATE;

typedef [hidden] enum SPRUNSTATE
{
    SPRS_DONE        = (1L << 0),
    SPRS_IS_SPEAKING = (1L << 1)
} SPRUNSTATE;

typedef [hidden] enum SPEAKFLAGS
{
    SPF_DEFAULT            = 0,
    SPF_ASYNC              = (1L << 0),
    SPF_PURGEBEFORESPEAK   = (1L << 1),
    SPF_IS_FILENAME        = (1L << 2),
    SPF_IS_XML             = (1L << 3),
    SPF_IS_NOT_XML         = (1L << 4),
    SPF_PERSIST_XML        = (1L << 5),
    SPF_NLP_SPEAK_PUNC     = (1L << 6),
    SPF_PARSE_SAPI         = (1L << 7),
    SPF_PARSE_SSML         = (1L << 8),
    SPF_PARSE_AUTODETECT   = 0,
    SPF_NLP_MASK           = (SPF_NLP_SPEAK_PUNC),
    SPF_PARSE_MASK         = (SPF_PARSE_SAPI|SPF_PARSE_SSML),
    SPF_VOICE_MASK         = (SPF_ASYNC|SPF_PURGEBEFORESPEAK|SPF_IS_FILENAME|SPF_IS_XML|SPF_IS_NOT_XML|SPF_NLP_MASK|SPF_PERSIST_XML|SPF_PARSE_MASK),
    SPF_UNUSED_FLAGS       = ~(SPF_VOICE_MASK)
} SPEAKFLAGS;

typedef [hidden] enum SPCFGRULEATTRIBUTES
{
    SPRAF_TopLevel      = (1 << 0),
    SPRAF_Active        = (1 << 1),
    SPRAF_Export        = (1 << 2),
    SPRAF_Import        = (1 << 3),
    SPRAF_Interpreter   = (1 << 4),
    SPRAF_Dynamic       = (1 << 5),
    SPRAF_Root          = (1 << 6),
    SPRAF_AutoPause     = (1 << 16),
    SPRAF_UserDelimited = (1 << 17)
} SPCFGRULEATTRIBUTES;

typedef [hidden] enum SPPHRASERNG
{
    SPPR_ALL_ELEMENTS = -1
} SPPHRASERNG;

typedef [hidden] enum SPVALUETYPE
{
    SPDF_PROPERTY      = 0x00000001,
    SPDF_REPLACEMENT   = 0x00000002,
    SPDF_RULE          = 0x00000004,
    SPDF_DISPLAYTEXT   = 0x00000008,
    SPDF_LEXICALFORM   = 0x00000010,
    SPDF_PRONUNCIATION = 0x00000020,
    SPDF_AUDIO         = 0x00000040,
    SPDF_ALTERNATES    = 0x00000080,
    SPDF_ALL           = 0x000000ff
} SPVALUETYPE;

typedef [hidden] enum SPSTREAMFORMAT
{
    SPSF_Default = -1,
    SPSF_NoAssignedFormat = 0,
    SPSF_Text,
    SPSF_NonStandardFormat,
    SPSF_ExtendedAudioFormat,
    SPSF_8kHz8BitMono,
    SPSF_8kHz8BitStereo,
    SPSF_8kHz16BitMono,
    SPSF_8kHz16BitStereo,
    SPSF_11kHz8BitMono,
    SPSF_11kHz8BitStereo,
    SPSF_11kHz16BitMono,
    SPSF_11kHz16BitStereo,
    SPSF_12kHz8BitMono,
    SPSF_12kHz8BitStereo,
    SPSF_12kHz16BitMono,
    SPSF_12kHz16BitStereo,
    SPSF_16kHz8BitMono,
    SPSF_16kHz8BitStereo,
    SPSF_16kHz16BitMono,
    SPSF_16kHz16BitStereo,
    SPSF_22kHz8BitMono,
    SPSF_22kHz8BitStereo,
    SPSF_22kHz16BitMono,
    SPSF_22kHz16BitStereo,
    SPSF_24kHz8BitMono,
    SPSF_24kHz8BitStereo,
    SPSF_24kHz16BitMono,
    SPSF_24kHz16BitStereo,
    SPSF_32kHz8BitMono,
    SPSF_32kHz8BitStereo,
    SPSF_32kHz16BitMono,
    SPSF_32kHz16BitStereo,
    SPSF_44kHz8BitMono,
    SPSF_44kHz8BitStereo,
    SPSF_44kHz16BitMono,
    SPSF_44kHz16BitStereo,
    SPSF_48kHz8BitMono,
    SPSF_48kHz8BitStereo,
    SPSF_48kHz16BitMono,
    SPSF_48kHz16BitStereo,
    SPSF_TrueSpeech_8kHz1BitMono,
    SPSF_CCITT_ALaw_8kHzMono,
    SPSF_CCITT_ALaw_8kHzStereo,
    SPSF_CCITT_ALaw_11kHzMono,
    SPSF_CCITT_ALaw_11kHzStereo,
    SPSF_CCITT_ALaw_22kHzMono,
    SPSF_CCITT_ALaw_22kHzStereo,
    SPSF_CCITT_ALaw_44kHzMono,
    SPSF_CCITT_ALaw_44kHzStereo,
    SPSF_CCITT_uLaw_8kHzMono,
    SPSF_CCITT_uLaw_8kHzStereo,
    SPSF_CCITT_uLaw_11kHzMono,
    SPSF_CCITT_uLaw_11kHzStereo,
    SPSF_CCITT_uLaw_22kHzMono,
    SPSF_CCITT_uLaw_22kHzStereo,
    SPSF_CCITT_uLaw_44kHzMono,
    SPSF_CCITT_uLaw_44kHzStereo,
    SPSF_ADPCM_8kHzMono,
    SPSF_ADPCM_8kHzStereo,
    SPSF_ADPCM_11kHzMono,
    SPSF_ADPCM_11kHzStereo,
    SPSF_ADPCM_22kHzMono,
    SPSF_ADPCM_22kHzStereo,
    SPSF_ADPCM_44kHzMono,
    SPSF_ADPCM_44kHzStereo,
    SPSF_GSM610_8kHzMono,
    SPSF_GSM610_11kHzMono,
    SPSF_GSM610_22kHzMono,
    SPSF_GSM610_44kHzMono,
    SPSF_NUM_FORMATS
} SPSTREAMFORMAT;

cpp_quote("EXTERN_C const GUID SPDFID_Text;")
cpp_quote("EXTERN_C const GUID SPDFID_WaveFormatEx;")

typedef unsigned short SPPHONEID;

typedef [restricted, hidden] struct SPPHRASEELEMENT
{
    ULONG           ulAudioTimeOffset;
    ULONG           ulAudioSizeTime;
    ULONG           ulAudioStreamOffset;
    ULONG           ulAudioSizeBytes;
    ULONG           ulRetainedStreamOffset;
    ULONG           ulRetainedSizeBytes;
    const WCHAR     *pszDisplayText;
    const WCHAR     *pszLexicalForm;
    const SPPHONEID *pszPronunciation;
    BYTE            bDisplayAttributes;
    signed char     RequiredConfidence;
    signed char     ActualConfidence;
    BYTE            Reserved;
    float           SREngineConfidence;
} SPPHRASEELEMENT;

typedef [restricted, hidden] struct SPVOICESTATUS
{
    ULONG     ulCurrentStream;
    ULONG     ulLastStreamQueued;
    HRESULT   hrLastResult;
    DWORD     dwRunningState;
    ULONG     ulInputWordPos;
    ULONG     ulInputWordLen;
    ULONG     ulInputSentPos;
    ULONG     ulInputSentLen;
    LONG      lBookmarkId;
    SPPHONEID PhonemeId;
    SPVISEMES VisemeId;
    DWORD     dwReserved1;
    DWORD     dwReserved2;
} SPVOICESTATUS;

typedef [restricted, hidden] struct SPAUDIOSTATUS
{
    long         cbFreeBuffSpace;
    ULONG        cbNonBlockingIO;
    SPAUDIOSTATE State;
    ULONGLONG    CurSeekPos;
    ULONGLONG    CurDevicePos;
    DWORD        dwAudioLevel;
    DWORD        dwReserved2;
} SPAUDIOSTATUS;

typedef [restricted, hidden] struct SPRECOGNIZERSTATUS
{
    SPAUDIOSTATUS AudioStatus;
    ULONGLONG     ullRecognitionStreamPos;
    ULONG         ulStreamNumber;
    ULONG         ulNumActive;
    CLSID         clsidEngine;
    ULONG         cLangIDs;
    LANGID        aLangID[SP_MAX_LANGIDS];
    ULONGLONG     ullRecognitionStreamTime;
} SPRECOGNIZERSTATUS;

typedef [restricted, hidden] struct SPPHRASERULE SPPHRASERULE;

struct SPPHRASERULE
{
    LPCWSTR                 pszName;
    ULONG                   ulId;
    ULONG                   ulFirstElement;
    ULONG                   ulCountOfElements;
    const SPPHRASERULE*     pNextSibling;
    const SPPHRASERULE*     pFirstChild;
    float                   SREngineConfidence;
    signed char             Confidence;
};

typedef [restricted, hidden] struct SPPHRASEPROPERTY SPPHRASEPROPERTY;

struct SPPHRASEPROPERTY
{
    const WCHAR            *pszName;
    ULONG                   ulId;
    const WCHAR            *pszValue;
    VARIANT                 vValue;
    ULONG                   ulFirstElement;
    ULONG                   ulCountOfElements;
    const SPPHRASEPROPERTY *pNextSibling;
    const SPPHRASEPROPERTY *pFirstChild;
    float                   SREngineConfidence;
    signed char             Confidence;
};

typedef [restricted, hidden] struct SPPHRASEREPLACEMENT
{
    BYTE         bDisplayAttributes;
    const WCHAR *pszReplacementText;
    ULONG        ulFirstElement;
    ULONG        ulCountOfElements;
} SPPHRASEREPLACEMENT;

typedef [restricted, hidden] struct SPPHRASE
{
    ULONG                   cbSize;
    LANGID                  LangID;
    WORD                    wReserved;
    ULONGLONG               ullGrammarID;
    ULONGLONG               ftStartTime;
    ULONGLONG               ullAudioStreamPosition;
    ULONG                   ulAudioSizeBytes;
    ULONG                   ulRetainedSizeBytes;
    ULONG                   ulAudioSizeTime;
    SPPHRASERULE            Rule;
    const SPPHRASEPROPERTY *pProperties;
    const SPPHRASEELEMENT  *pElements;
    ULONG                   cReplacements;
    const SPPHRASEREPLACEMENT *pReplacements;
    GUID                    SREngineID;
    ULONG                   ulSREnginePrivateDataSize;
    const BYTE             *pSREnginePrivateData;
} SPPHRASE;

typedef [restricted, hidden] struct SPSERIALIZEDPHRASE
{
    ULONG ulSerializedSize;
} SPSERIALIZEDPHRASE;

typedef [restricted, hidden] struct SPRECORESULTTIMES
{
    FILETIME  ftStreamTime;
    ULONGLONG ullLength;
    DWORD     dwTickCount;
    ULONGLONG ullStart;
} SPRECORESULTTIMES;

typedef [hidden] enum SPFILEMODE
{
    SPFM_OPEN_READONLY,
    SPFM_OPEN_READWRITE,
    SPFM_CREATE,
    SPFM_CREATE_ALWAYS,
    SPFM_NUM_MODES
} SPFILEMODE;

typedef [restricted, hidden] struct SPAUDIOBUFFERINFO
{
    ULONG ulMsMinNotification;
    ULONG ulMsBufferSize;
    ULONG ulMsEventBias;
} SPAUDIOBUFFERINFO;

typedef [hidden] enum SPPARTOFSPEECH
{
    SPPS_NotOverriden  = -1,
    SPPS_Unknown       = 0,
    SPPS_Noun          = 0x1000,
    SPPS_Verb          = 0x2000,
    SPPS_Modifier      = 0x3000,
    SPPS_Function      = 0x4000,
    SPPS_Interjection  = 0x5000,
    SPPS_Noncontent    = 0x6000,
    SPPS_LMA           = 0x7000,
    SPPS_SuppressWord  = 0xF000
} SPPARTOFSPEECH;

typedef [restricted, hidden] struct SPVPITCH
{
    long MiddleAdj;
    long RangeAdj;
} SPVPITCH;

typedef [hidden] enum SPVACTIONS
{
    SPVA_Speak = 0,
    SPVA_Silence,
    SPVA_Pronounce,
    SPVA_Bookmark,
    SPVA_SpellOut,
    SPVA_Section,
    SPVA_ParseUnknownTag
} SPVACTIONS;

typedef [restricted, hidden] struct SPVCONTEXT
{
    LPCWSTR pCategory;
    LPCWSTR pBefore;
    LPCWSTR pAfter;
} SPVCONTEXT;

typedef [restricted, hidden] struct SPVSTATE
{
    SPVACTIONS      eAction;
    LANGID          LangID;
    WORD            wReserved;
    long            EmphAdj;
    long            RateAdj;
    ULONG           Volume;
    SPVPITCH        PitchAdj;
    ULONG           SilenceMSecs;
    SPPHONEID      *pPhoneIds;
    SPPARTOFSPEECH  ePartOfSpeech;
    SPVCONTEXT      Context;
} SPVSTATE;

cpp_quote("#if defined(__GNUC__)")

cpp_quote("#define SPCAT_AUDIOOUT (const WCHAR []){ 'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\\\','S','O','F','T','W','A','R','E','\\\\','M','i','c','r','o','s','o','f','t','\\\\','S','p','e','e','c','h','\\\\','A','u','d','i','o','O','u','t','p','u','t',0 }")
cpp_quote("#define SPCAT_AUDIOIN (const WCHAR []){ 'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\\\','S','O','F','T','W','A','R','E','\\\\','M','i','c','r','o','s','o','f','t','\\\\','S','p','e','e','c','h','\\\\','A','u','d','i','o','I','n','p','u','t',0 }")
cpp_quote("#define SPCAT_VOICES (const WCHAR []){ 'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\\\','S','O','F','T','W','A','R','E','\\\\','M','i','c','r','o','s','o','f','t','\\\\','S','p','e','e','c','h','\\\\','V','o','i','c','e','s',0 }")

cpp_quote("#elif defined(_MSC_VER)")

cpp_quote("#define SPCAT_AUDIOOUT L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioOutput\"")
cpp_quote("#define SPCAT_AUDIOIN L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioInput\"")
cpp_quote("#define SPCAT_VOICES L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\Voices\"")

cpp_quote("#else")

cpp_quote("static const WCHAR SPCAT_AUDIOOUT[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\\\','S','O','F','T','W','A','R','E','\\\\','M','i','c','r','o','s','o','f','t','\\\\','S','p','e','e','c','h','\\\\','A','u','d','i','o','O','u','t','p','u','t',0};")
cpp_quote("static const WCHAR SPCAT_AUDIOIN[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\\\','S','O','F','T','W','A','R','E','\\\\','M','i','c','r','o','s','o','f','t','\\\\','S','p','e','e','c','h','\\\\','A','u','d','i','o','I','n','p','u','t',0};")
cpp_quote("static const WCHAR SPCAT_VOICES[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\\\','S','O','F','T','W','A','R','E','\\\\','M','i','c','r','o','s','o','f','t','\\\\','S','p','e','e','c','h','\\\\','V','o','i','c','e','s',0};")

cpp_quote("#endif")

interface IEnumSpObjectTokens;
interface ISpEventSource;
interface ISpRecoContext;
interface ISpRecognizer;
interface ISpStreamFormat;
interface ISpVoice;

[
    object,
    uuid(14056581-e16c-11d2-bb90-00c04f8ee6c0),
    helpstring("ISpDataKey"),
    pointer_default(unique),
    local,
    restricted
]
interface ISpDataKey : IUnknown
{
    HRESULT SetData([in] LPCWSTR pszValueName,
                    [in] ULONG cbData,
                    [in] const BYTE *pData);
    HRESULT GetData([in] LPCWSTR pszValueName,
                    [in] ULONG *pcbData,
                    [out] BYTE *pData);
    HRESULT SetStringValue([in] LPCWSTR pszValueName,
                           [in] LPCWSTR pszValue);
    HRESULT GetStringValue([in] LPCWSTR pszValueName,
                           [out] LPWSTR *ppszValue);
    HRESULT SetDWORD([in] LPCWSTR pszValueName,
                     [in] DWORD dwValue);
    HRESULT GetDWORD([in] LPCWSTR pszValueName,
                     [out] DWORD *pdwValue);
    HRESULT OpenKey([in] LPCWSTR pszSubKeyName,
                    [out] ISpDataKey **ppSubKey);
    HRESULT CreateKey([in] LPCWSTR pszSubKey,
                      [out] ISpDataKey **ppSubKey);
    HRESULT DeleteKey([in] LPCWSTR pszSubKey);
    HRESULT DeleteValue([in] LPCWSTR pszValueName);
    HRESULT EnumKeys([in] ULONG Index,
                     [out] LPWSTR *ppszSubKeyName);
    HRESULT EnumValues([in] ULONG Index,
                       [out] LPWSTR *ppszValueName);
}
[
    object,
    uuid(92a66e2b-c830-4149-83df-6fc2ba1e7a5b),
    helpstring("ISpRegDataKey"),
    pointer_default(unique),
    restricted
]
interface ISpRegDataKey : ISpDataKey
{
    [local] HRESULT SetKey([in] HKEY hkey, [in] BOOL fReadOnly);
}

[
    object,
    uuid(2d3d3845-39af-4850-bbf9-40b49780011d),
    helpstring("ISpObjectTokenCategory"),
    pointer_default(unique),
    local,
    restricted
]
interface ISpObjectTokenCategory : ISpDataKey
{
    HRESULT SetId([in] LPCWSTR pszCategoryId,
                  [in] BOOL fCreateIfNotExist);
    HRESULT GetId([out] LPWSTR *ppszCoMemCategoryId);
    HRESULT GetDataKey([in] SPDATAKEYLOCATION spdkl,
                       [out] ISpDataKey **ppDataKey);
    HRESULT EnumTokens([in, string] LPCWSTR pszReqAttribs,
                       [in, string] LPCWSTR pszOptAttribs,
                       [out] IEnumSpObjectTokens **ppEnum);
    HRESULT SetDefaultTokenId([in] LPCWSTR pszTokenId);
    HRESULT GetDefaultTokenId([out] LPWSTR *ppszCoMemTokenId);
}

[
    object,
    uuid(14056589-e16c-11d2-bb90-00c04f8ee6c0),
    helpstring("ISpObjectToken"),
    pointer_default(unique),
    local,
    restricted
]
interface ISpObjectToken : ISpDataKey
{
    HRESULT SetId(/*[in]*/ LPCWSTR pszCategoryId,
                  [in] LPCWSTR pszTokenId,
                  [in] BOOL fCreateIfNotExist);
    HRESULT GetId([out] LPWSTR *ppszCoMemTokenId);
    HRESULT GetCategory([out] ISpObjectTokenCategory **ppTokenCategory);
    HRESULT CreateInstance([in] IUnknown *pUnkOuter,
                           [in] DWORD dwClsContext,
                           [in] REFIID riid,
                           [out, iid_is(riid)] void **ppvObject);
    HRESULT GetStorageFileName([in] REFCLSID clsidCaller,
                               [in] LPCWSTR pszValueName,
                               [in, string] LPCWSTR pszFileNameSpecifier,
                               [in] ULONG nFolder,
                               [out] LPWSTR *ppszFilePath);
    HRESULT RemoveStorageFileName([in] REFCLSID clsidCaller,
                                  [in] LPCWSTR pszKeyName,
                                  [in] BOOL fDeleteFile);
    HRESULT Remove(/*[in]*/ const CLSID *pclsidCaller);
    [local] HRESULT IsUISupported([in] LPCWSTR pszTypeOfUI,
                                  [in] void *pvExtraData,
                                  [in] ULONG cbExtraData,
                                  [in] IUnknown *punkObject,
                                  [out] BOOL *pfSupported);
    [local] HRESULT DisplayUI([in] HWND hwndParent,
                              [in] LPCWSTR pszTitle,
                              [in] LPCWSTR pszTypeOfUI,
                              [in] void *pvExtraData,
                              [in] ULONG cbExtraData,
                              [in] IUnknown *punkObject);
    HRESULT MatchesAttributes([in] LPCWSTR pszAttributes,
                              [out] BOOL *pfMatches);
}

[
    object,
    uuid(06b64f9e-7fda-11d2-b4f2-00c04f797396),
    helpstring("IEnumSpObjectTokens"),
    pointer_default(unique),
    local,
    restricted
]
interface IEnumSpObjectTokens : IUnknown
{
    HRESULT Next([in] ULONG celt,
                 [out, size_is(celt), length_is(*pceltFetched)] ISpObjectToken **pelt,
                 [out] ULONG *pceltFetched);
    HRESULT Skip([in] ULONG celt);
    HRESULT Reset(void);
    HRESULT Clone([out] IEnumSpObjectTokens **ppEnum);
    HRESULT Item([in] ULONG Index,
                 [out] ISpObjectToken **ppToken);
    HRESULT GetCount([out] ULONG *pCount);
}

[
    object,
    uuid(93384e18-5014-43d5-adbb-a78e055926bd),
    helpstring("ISpResourceManager"),
    pointer_default(unique),
    restricted
]
interface ISpResourceManager : IServiceProvider
{
    HRESULT SetObject([in] REFGUID guidServiceId,
                      [in] IUnknown *pUnkObject);
    HRESULT GetObject([in] REFGUID guidServiceId,
                      [in] REFCLSID ObjectCLSID,
                      [in] REFIID ObjectIID,
                      [in] BOOL fReleaseWhenLastExternalRefReleased,
                      [out, iid_is(ObjectIID)] void** ppObject);
}

[
    object,
    uuid(1a5c0354-b621-4b5a-8791-d306ed379e53),
    local,
    pointer_default(unique),
    restricted
]
interface ISpPhrase : IUnknown
{
    HRESULT GetPhrase([out] SPPHRASE **phrase);
    HRESULT GetSerializedPhrase([out] SPSERIALIZEDPHRASE **phrase);
    HRESULT GetText([in] ULONG start, [in] ULONG count, [in] BOOL replacements,
					[out] WCHAR **text, [out] BYTE *attributes);
    HRESULT Discard([in] DWORD types);
};

[
    object,
    uuid(8fcebc98-4e49-4067-9c6c-d86a0e092e3d),
    local,
    pointer_default(unique),
    restricted
]
interface ISpPhraseAlt : ISpPhrase
{
    HRESULT GetAltInfo(ISpPhrase **parent, ULONG *start, ULONG *count,
                        ULONG *elements);
    HRESULT Commit();
};

[
    object,
    uuid(20b053be-e235-43cd-9a2a-8d17a48b7842),
    pointer_default(unique),
    local,
    restricted
]
interface ISpRecoResult : ISpPhrase
{
    HRESULT GetResultTimes([out] SPRECORESULTTIMES *times);

    HRESULT GetAlternates(
                [in] ULONG start,
                [in] ULONG elements,
                [in] ULONG count,
                [out] ISpPhraseAlt **phrases,
                [out] ULONG *returned);

    HRESULT GetAudio(
                [in] ULONG start,
                [in] ULONG elements,
                [out] ISpStreamFormat **stream);
    HRESULT SpeakAudio(
                [in] ULONG start,
                [in] ULONG elements,
                [in] DWORD flags,
                [out] ULONG *number);

    HRESULT Serialize([out] SPSERIALIZEDRESULT **result);

    HRESULT ScaleAudio([in] const GUID *format, [in] const WAVEFORMATEX *wave);

    HRESULT GetRecoContext([out] ISpRecoContext *context);
};

[
    object,
    uuid(8137828f-591a-4a42-be58-49ea7ebaac68),
    helpstring("ISpGrammarBuilder Interface"),
    pointer_default(unique),
    restricted,
    local
]
interface ISpGrammarBuilder : IUnknown
{
    HRESULT ResetGrammar([in] LANGID language);

    HRESULT GetRule([in] const WCHAR *rule,
                    [in] DWORD id,
                    [in] DWORD attributes,
                    [in] BOOL should_create,
                    [out] SPSTATEHANDLE *state);
    HRESULT ClearRule(SPSTATEHANDLE state);

    HRESULT CreateNewState(
                [in] SPSTATEHANDLE instate,
                [out] SPSTATEHANDLE *outstate);

    HRESULT AddWordTransition(
                    [in] SPSTATEHANDLE from_state,
                    [in] SPSTATEHANDLE to_state,
                    [in] const WCHAR *value,
                    [in] const WCHAR *separators,
                    [in] SPGRAMMARWORDTYPE type,
                    [in] float weight,
                    [in] const SPPROPERTYINFO *info);

    HRESULT AddRuleTransition(
                [in] SPSTATEHANDLE from_state,
                [in] SPSTATEHANDLE to_state,
                [in] SPSTATEHANDLE rule,
                [in] float weight,
                [in] const SPPROPERTYINFO *info);

    HRESULT AddResource([in] SPSTATEHANDLE state,
                        [in] const WCHAR *name,
                        [in] const WCHAR *value);

    HRESULT Commit([in] DWORD reserved);
};

[
    object,
    uuid(2177db29-7f45-47d0-8554-067e91c80502),
    pointer_default(unique),
    restricted,
    local
]
interface ISpRecoGrammar : ISpGrammarBuilder
{
    HRESULT GetGrammarId([out] ULONGLONG *grammar);
    HRESULT GetRecoContext([out] ISpRecoContext **context);

    HRESULT LoadCmdFromFile([in, string] const WCHAR * pszFileName, [in] SPLOADOPTIONS options);
    HRESULT LoadCmdFromObject([in] REFCLSID rcid, [in, string] const WCHAR * pszGrammarName, [in] SPLOADOPTIONS options);
    HRESULT LoadCmdFromResource([in] HMODULE hmod,
                                [in, string] const WCHAR *name,
                                [in, string] const WCHAR *type,
                                [in] WORD language,
                                [in] SPLOADOPTIONS options);
    HRESULT LoadCmdFromMemory([in] const SPBINARYGRAMMAR *grammar, [in] SPLOADOPTIONS options);
    HRESULT LoadCmdFromProprietaryGrammar(
                                [in] REFGUID guid,
                                [in, string] const WCHAR *param,
                                [in] const void *data,
                                [in] ULONG size,
                                [in] SPLOADOPTIONS options);
    HRESULT SetRuleState([in, string] const WCHAR *name, [in] void *reserved,
                         [in] SPRULESTATE state);
    HRESULT SetRuleIdState([in] ULONG rule, [in] SPRULESTATE state);

    HRESULT LoadDictation([in, string] const WCHAR *name, [in] SPLOADOPTIONS options);
    HRESULT UnloadDictation();
    HRESULT SetDictationState([in] SPRULESTATE state);

    HRESULT SetWordSequenceData([in] const WCHAR *text, [in] ULONG count, [in] const SPTEXTSELECTIONINFO *info);
    HRESULT SetTextSelection([in] const SPTEXTSELECTIONINFO *info);

    HRESULT IsPronounceable([in, string] const WCHAR *word, [out] SPWORDPRONOUNCEABLE *pronounceable);

    HRESULT SetGrammarState([in] SPGRAMMARSTATE state);

    HRESULT SaveCmd([in] IStream *stream, [out, optional] WCHAR **error);

    HRESULT GetGrammarState([out] SPGRAMMARSTATE *state);
};

[
    object,
    uuid(259684dc-37c3-11d2-9603-00c04f8ee628),
    pointer_default(unique),
    restricted
]
interface ISpNotifySink : IUnknown
{
    HRESULT Notify(void);
}

[
    object,
    uuid(5eff4aef-8487-11d2-961c-00c04f8ee628),
    pointer_default(unique),
    restricted
]
interface ISpNotifySource : IUnknown
{
    HRESULT SetNotifySink([in] ISpNotifySink *sink);
    [local] HRESULT SetNotifyWindowMessage(
                [in] HWND hwnd,
                [in] UINT msg,
                [in] WPARAM wparam,
                [in] LPARAM lparam);
    [local] HRESULT SetNotifyCallbackFunction(
                [in] SPNOTIFYCALLBACK *callback,
                [in] WPARAM wparam,
                [in] LPARAM lparam);
    [local] HRESULT SetNotifyCallbackInterface(
                [in] ISpNotifyCallback *callback,
                [in] WPARAM wparam,
                [in] LPARAM lparam);
    [local] HRESULT SetNotifyWin32Event(void);
    [local] HRESULT WaitForNotifyEvent([in] DWORD milliseconds);
    [local] HANDLE  GetNotifyEventHandle();
}

[
    object,
    uuid(be7a9cce-5f9e-11d2-960f-00c04f8ee628),
    pointer_default(unique),
    local,
    restricted
]
interface ISpEventSource : ISpNotifySource
{
    HRESULT SetInterest([in] ULONGLONG event, [in] ULONGLONG queued);
    HRESULT GetEvents([in] ULONG count,
                    [out, size_is(count)] SPEVENT *array,
                    [out] ULONG *fetched);
    HRESULT GetInfo([out] SPEVENTSOURCEINFO *info);
};

[
    object,
    uuid(f740a62f-7c15-489e-8234-940a33d9272d),
    pointer_default(unique),
    local,
    restricted
]
interface ISpRecoContext : ISpEventSource
{
    HRESULT GetRecognizer([out] ISpRecognizer **recognizer);

    HRESULT CreateGrammar([in] ULONGLONG grammar, [out] ISpRecoGrammar **spgrammar);

    HRESULT GetStatus([out] SPRECOCONTEXTSTATUS *status);

    HRESULT GetMaxAlternates([in] ULONG *alternates);
    HRESULT SetMaxAlternates([in] ULONG alternates);

    HRESULT SetAudioOptions([in] SPAUDIOOPTIONS options, [in] const GUID *format, [in] const WAVEFORMATEX *wave);
    HRESULT GetAudioOptions([in] SPAUDIOOPTIONS *options, [out] GUID *format, [out] WAVEFORMATEX **wave);

    HRESULT DeserializeResult([in] const SPSERIALIZEDRESULT *serialized, [out] ISpRecoResult **result);

    HRESULT Bookmark([in] SPBOOKMARKOPTIONS options, [in] ULONGLONG position, [in] LPARAM event);

    HRESULT SetAdaptationData([in, string] const WCHAR *data, [in] const ULONG count);

    HRESULT Pause(DWORD reserved);
    HRESULT Resume(DWORD reserved);

    HRESULT SetVoice([in] ISpVoice *voice, [in] BOOL changes);
    HRESULT GetVoice([out] ISpVoice **voice);
    HRESULT SetVoicePurgeEvent([in] ULONGLONG interest);
    HRESULT GetVoicePurgeEvent([out] ULONGLONG *interest);

    HRESULT SetContextState([in] SPCONTEXTSTATE state);
    HRESULT GetContextState([in] SPCONTEXTSTATE *state);
};

[
    object,
    uuid(6c44df74-72b9-4992-a1ec-ef996e0422d4),
    pointer_default(unique),
    restricted
]
interface ISpVoice : ISpEventSource
{
    HRESULT SetOutput([in] IUnknown *unk, [in] BOOL changes);
    HRESULT GetOutputObjectToken([out] ISpObjectToken **token);
    HRESULT GetOutputStream([out] ISpStreamFormat **stream);

    HRESULT Pause(void);
    HRESULT Resume(void);

    HRESULT SetVoice([in] ISpObjectToken *token);
    HRESULT GetVoice([out] ISpObjectToken **token);

    HRESULT Speak([in, string] const WCHAR *pwcs,
                [in] DWORD flags,
                [out] ULONG *number);
    HRESULT SpeakStream([in] IStream *stream,
                [in] DWORD flags,
                [out] ULONG *number);

    HRESULT GetStatus(
                [out] SPVOICESTATUS *status,
                [out, string] WCHAR **bookmark);

    HRESULT Skip([in,string] const WCHAR *type, [in] long items, [out] ULONG *skipped);

    HRESULT SetPriority([in] SPVPRIORITY priority);
    HRESULT GetPriority([out] SPVPRIORITY* priority);

    HRESULT SetAlertBoundary([in] SPEVENTENUM boundary);
    HRESULT GetAlertBoundary([out] SPEVENTENUM* boundary);

    HRESULT SetRate([in] long adjust);
    HRESULT GetRate([out] long *adjust);

    HRESULT SetVolume([in] USHORT volume);
    HRESULT GetVolume([out] USHORT *volume);

    HRESULT WaitUntilDone([in] ULONG timeout);

    HRESULT SetSyncSpeakTimeout([in] ULONG timeout);
    HRESULT GetSyncSpeakTimeout([out] ULONG *timeout);

    [local] HANDLE SpeakCompleteEvent();

    [local] HRESULT IsUISupported(
                [in] const WCHAR *type,
                [in] void * extra,
                [in] ULONG count,
                [out] BOOL *supported);
    [local] HRESULT DisplayUI(
                [in] HWND parent,
                [in] const WCHAR *title,
                [in] const WCHAR *type,
                [in] void *extra,
                [in] ULONG count);
};

[
    object,
    uuid(be7a9cc9-5f9e-11d2-960f-00c04f8ee628),
    pointer_default(unique),
    local,
    restricted
]
interface ISpEventSink : IUnknown
{
    HRESULT AddEvents([in] const SPEVENT *events, [in] ULONG count);
    HRESULT GetEventInterest([out] ULONGLONG *interest);
};

[
    object,
    uuid(5b559f40-e952-11d2-bb91-00c04f8ee6c0),
    pointer_default(unique),
    restricted
]
interface ISpObjectWithToken : IUnknown
{
    HRESULT SetObjectToken([in] ISpObjectToken *token);
    HRESULT GetObjectToken([out] ISpObjectToken **token);
};

[
    object,
    uuid(bed530be-2606-4f4d-a1c0-54c5cda5566f),
    pointer_default(unique),
    restricted
]
interface ISpStreamFormat : IStream
{
    HRESULT GetFormat(GUID *format, WAVEFORMATEX **wave);
}

[
    object,
    uuid(c05c768f-fae8-4ec2-8e07-338321c12452),
    pointer_default(unique),
    local,
    restricted
]
interface ISpAudio : ISpStreamFormat
{
    HRESULT SetState([in] SPAUDIOSTATE state, [in] ULONGLONG reserved);
    HRESULT SetFormat([in] REFGUID guid, [in] const WAVEFORMATEX *wave);
    HRESULT GetStatus([out] SPAUDIOSTATUS *status);
    HRESULT SetBufferInfo([in] const SPAUDIOBUFFERINFO *buffer);
    HRESULT GetBufferInfo([out] SPAUDIOBUFFERINFO *buffer);
    HRESULT GetDefaultFormat([out] GUID *guid, [out] WAVEFORMATEX **wave);
    HANDLE  EventHandle();
    HRESULT GetVolumeLevel([out] ULONG *level);
    HRESULT SetVolumeLevel([in] ULONG level);
    HRESULT GetBufferNotifySize([out] ULONG *size);
    HRESULT SetBufferNotifySize([in] ULONG size);
};
[
    object,
    uuid(15806f6e-1d70-4b48-98e6-3b1a007509ab),
    pointer_default(unique),
    local,
    restricted
]
interface ISpMMSysAudio : ISpAudio
{
    HRESULT GetDeviceId([out] UINT *id);
    HRESULT SetDeviceId([in] UINT id);
    HRESULT GetMMHandle([out] void **handle);
    HRESULT GetLineId([out] UINT *id);
    HRESULT SetLineId([in] UINT id);
};

[
    object,
    uuid(5b4fb971-b115-4de1-ad97-e482e3bf6ee4),
    pointer_default(unique),
    local,
    restricted
]
interface ISpProperties : IUnknown
{
    HRESULT SetPropertyNum([in] const WCHAR *name, [in] long value);
    HRESULT GetPropertyNum([in] const WCHAR *name, [out] long *value);
    HRESULT SetPropertyString([in] const WCHAR *name, [in] const WCHAR *value);
    HRESULT GetPropertyString([in] const WCHAR *name, [out] WCHAR **value);
};

[
    object,
    uuid(c2b5f241-daa0-4507-9e16-5a1eaa2b7a5c),
    pointer_default(unique),
    restricted
]
interface ISpRecognizer : ISpProperties
{
    HRESULT SetRecognizer([in] ISpObjectToken *recognizer);
    HRESULT GetRecognizer([out] ISpObjectToken **recognizer);

    HRESULT SetInput([in] IUnknown *input, [in] BOOL changes);
    HRESULT GetInputObjectToken([out] ISpObjectToken **token);

    HRESULT GetInputStream( [out] ISpStreamFormat **stream);
    HRESULT CreateRecoContext([out] ISpRecoContext **cxt);

    HRESULT GetRecoProfile([out] ISpObjectToken **token);
    HRESULT SetRecoProfile([in] ISpObjectToken *token);

    HRESULT IsSharedInstance(void);

    HRESULT GetRecoState([out] SPRECOSTATE *state);
    HRESULT SetRecoState([in] SPRECOSTATE state);

    HRESULT GetStatus([out] SPRECOGNIZERSTATUS *status);
    HRESULT GetFormat([in] SPSTREAMFORMATTYPE type, [out] GUID *format, [out] WAVEFORMATEX **wave);

    [local] HRESULT IsUISupported([in] const WCHAR *type, [in] void *extra, [in] ULONG count,
                [out] BOOL *supported);
    [local] HRESULT DisplayUI([in] HWND hwnd,[in] const WCHAR *title, [in] const WCHAR *type,
                [in] void *extra, [in] ULONG cnt);
    HRESULT EmulateRecognition([in] ISpPhrase *phrase);
};

[
    object,
    uuid(12e3cca9-7518-44c5-a5e7-ba5a79cb929e),
    pointer_default(unique),
    local,
    restricted
]
interface ISpStream : ISpStreamFormat
{
    HRESULT SetBaseStream([in] IStream *stream, [in] REFGUID format, [in] const WAVEFORMATEX *wave);
    HRESULT GetBaseStream([out] IStream **stream);
    HRESULT BindToFile([in] LPCWSTR filename, [in] SPFILEMODE mode, [in] const GUID *format,
                       const WAVEFORMATEX *wave, [in] ULONGLONG interest);
    HRESULT Close();
}

[
    helpstring("Speech Object Library"),
    uuid(c866ca3a-32f7-11d2-9602-00c04f8ee628),
    version(5.4)
]
library SpeechLib
{
    importlib("stdole2.tlb");

#include "sapiaut.idl"

    [
        uuid(a910187f-0c7a-45ac-92cc-59edafb77b53),
        helpstring("SpObjectTokenCategory Class"),
        progid("SAPI.SpObjectTokenCategory.1"),
        vi_progid("SAPI.SpObjectTokenCategory"),
        threading(both)
    ]
    coclass SpObjectTokenCategory
    {
        interface ISpObjectTokenCategory;
    }

    [
        uuid(ef411752-3736-4cb4-9c8c-8ef4ccb58efe),
        helpstring("Object Token"),
        progid("SAPI.SpObjectToken.1"),
        vi_progid("SAPI.SpObjectToken"),
        threading(both)
    ]
    coclass SpObjectToken
    {
        interface ISpObjectToken;
        [default] interface ISpeechObjectToken;
    }

    [
        uuid(96749373-3391-11d2-9ee3-00c04f797396),
        helpstring("Resource Manager"),
        progid("SAPI.SpResourceManager.1"),
        vi_progid("SAPI.SpResourceManager"),
        threading(both),
        restricted,
        hidden
    ]
    coclass SpResourceManager
    {
        [default] interface ISpResourceManager;
    };

    [
        uuid(3bee4890-4fe9-4a37-8c1e-5e7e12791c1f)
    ]
    coclass SpSharedRecognizer
    {
        /*[default] interface ISpeechRecognizer;*/
        interface ISpRecognizer;
    };

    [
        uuid(715d9c59-4442-11d2-9605-00c04f8ee628),
        helpstring("Speech Stream"),
        progid("SAPI.SpStream.1"),
        vi_progid("SAPI.SpStream"),
        threading(both),
        restricted,
        hidden
    ]
    coclass SpStream
    {
        interface ISpStream;
    };

    [
        uuid(96749377-3391-11d2-9ee3-00c04f797396)
    ]
    coclass SpVoice
    {
        interface ISpVoice;
        [default] interface ISpeechVoice;
    };

    [
        uuid(947812b3-2ae1-4644-ba86-9e90ded7ec91),
    ]
    coclass SpFileStream
    {
        interface ISpStream;
        [default] interface ISpeechFileStream;
    };

    [
        uuid(ab1890a0-e91f-11d2-bb91-00c04f8ee6c0),
        restricted,
        hidden
    ]
    coclass SpMMAudioEnum
    {
        interface IEnumSpObjectTokens;
    };

    [
        uuid(cf3d2e50-53f2-11d2-960c-00c04f8ee628)
    ]
    coclass SpMMAudioIn
    {
        interface ISpEventSource;
        interface ISpEventSink;
        interface ISpObjectWithToken;
        interface ISpMMSysAudio;
    };

    [
        uuid(a8c680eb-3d32-11d2-9ee7-00c04f797396)
    ]
    coclass SpMMAudioOut
    {
        interface ISpEventSource;
        interface ISpEventSink;
        interface ISpObjectWithToken;
        interface ISpMMSysAudio;
    };
}