ms-types 0.4.13 → 0.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/package.json +22 -22
  2. package/types/action.d.ts +296 -296
  3. package/types/appleocr.d.ts +102 -102
  4. package/types/config.d.ts +97 -97
  5. package/types/cryptoUtils.d.ts +59 -59
  6. package/types/device.d.ts +117 -117
  7. package/types/global.d.ts +230 -230
  8. package/types/hid.d.ts +329 -329
  9. package/types/hotUpdate.d.ts +104 -104
  10. package/types/http.d.ts +300 -300
  11. package/types/image.d.ts +19 -0
  12. package/types/ime.d.ts +99 -99
  13. package/types/index.d.ts +27 -27
  14. package/types/media.d.ts +101 -101
  15. package/types/mysql.d.ts +174 -174
  16. package/types/netCard.d.ts +77 -77
  17. package/types/node.d.ts +292 -292
  18. package/types/paddleocr.d.ts +73 -73
  19. package/types/pip.d.ts +51 -51
  20. package/types/system.d.ts +225 -225
  21. package/types/thread.d.ts +42 -42
  22. package/types/tomatoocr.d.ts +209 -209
  23. package/types/tts.d.ts +91 -91
  24. package/types/ui.d.ts +185 -185
  25. package/types/utils.d.ts +77 -77
  26. package/types/yolo.d.ts +114 -114
  27. package/types/zh/HID/346/250/241/345/235/227.d.ts +333 -333
  28. package/types/zh/HTTP/346/250/241/345/235/227.d.ts +301 -301
  29. package/types/zh/MySql/346/250/241/345/235/227.d.ts +175 -175
  30. package/types/zh/PaddleOCR/346/250/241/345/235/227.d.ts +74 -74
  31. package/types/zh/YOLO/346/250/241/345/235/227.d.ts +118 -118
  32. package/types/zh/index.d.ts +24 -24
  33. package/types/zh//345/205/250/345/261/200/346/250/241/345/235/227.d.ts +220 -220
  34. package/types/zh//345/212/250/344/275/234/346/250/241/345/235/227.d.ts +298 -298
  35. package/types/zh//345/215/241/345/257/206/346/250/241/345/235/227.d.ts +90 -90
  36. package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +19 -0
  37. package/types/zh//345/252/222/344/275/223/346/250/241/345/235/227.d.ts +102 -102
  38. package/types/zh//345/267/245/345/205/267/346/250/241/345/235/227.d.ts +77 -77
  39. package/types/zh//346/202/254/346/265/256/347/252/227/346/250/241/345/235/227.d.ts +55 -55
  40. package/types/zh//346/226/207/345/255/227/350/275/254/350/257/255/351/237/263/346/250/241/345/235/227.d.ts +92 -92
  41. package/types/zh//347/203/255/346/233/264/346/226/260/346/250/241/345/235/227.d.ts +105 -105
  42. package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +225 -225
  43. package/types/zh//347/272/277/347/250/213/346/250/241/345/235/227.d.ts +43 -43
  44. package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +290 -290
  45. package/types/zh//350/213/271/346/236/234OCR.d.ts +104 -104
  46. package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +90 -90
  47. package/types/zh//350/256/276/345/244/207/346/250/241/345/235/227.d.ts +118 -118
  48. package/types/zh//350/276/223/345/205/245/346/263/225/346/250/241/345/235/227.d.ts +100 -100
  49. package/types/zh//351/205/215/347/275/256/346/250/241/345/235/227.d.ts +99 -99
@@ -1,209 +1,209 @@
1
- /**
2
- * TomatoOCR 模块
3
- * 提供基于 TomatoOCR 框架的文字识别和 YOLO 目标检测功能
4
- */
5
- declare namespace tomatoOcr {
6
- /**
7
- * 初始化TomatoOCR并设置基本配置
8
- * @param mode 运行模式 debug:调试模型;删除或传别的任何值为正式模式
9
- * @param licenseData 授权码 请传入你在 TomatoOCR 官网申请的授权码
10
- * @param remark 备注信息(可选)
11
- * @returns 设置结果
12
- * @example
13
- * ```typescript
14
- * // 不带备注
15
- * const result1 = tomatoOcr.initializeWithConfig("online", "授权码");
16
- * // 带备注
17
- * const result2 = tomatoOcr.initializeWithConfig("online", "授权码", "测试环境");
18
- * logi(result1, result2);
19
- * ```
20
- */
21
- function initializeWithConfig(
22
- mode: string,
23
- licenseData: string,
24
- remark?: string
25
- ): {
26
- deviceId: string;
27
- expiryTime: string;
28
- message: string;
29
- status: string;
30
- versionName: string;
31
- } | null;
32
-
33
- /**
34
- * 设置 HTTP 请求间隔时间
35
- * @param second 间隔秒数 设置网络请求间隔时间,非必设置。0-86400
36
- * @example
37
- * ```typescript
38
- * tomatoOcr.setHttpIntervalTime(3600);
39
- * ```
40
- */
41
- function setHttpIntervalTime(second: number): void;
42
-
43
- /**
44
- * 设置识别类型
45
- * @param recType 识别类型 模型类型,默认 ch-3.0,除此之外还有 ch-2.0, ch, cht, japan, korean, number
46
- * @example
47
- * ```typescript
48
- * // 普通中英文识别,3.0版模型
49
- * tomatoOcr.setRecType("ch-3.0");
50
- * // 普通中英文识别,2.0版模型
51
- * tomatoOcr.setRecType("ch-2.0");
52
- * // 普通中英文识别,1.0版模型
53
- * tomatoOcr.setRecType("ch");
54
- * // 繁体
55
- * tomatoOcr.setRecType("cht");
56
- * // 日语
57
- * tomatoOcr.setRecType("japan");
58
- * // 韩语
59
- * tomatoOcr.setRecType("korean");
60
- * // 数字模型
61
- * tomatoOcr.setRecType("number");
62
- * ```
63
- */
64
- function setRecType(recType: string): void;
65
-
66
- /**
67
- * 设置检测框类型
68
- * @param detBoxType 检测框类型 默认"rect": 由于手机上截图文本均为矩形文本;"quad":可准确检测倾斜文本
69
- * @example
70
- * ```typescript
71
- * // 矩形文本
72
- * tomatoOcr.setDetBoxType("rect");
73
- * // 倾斜文本
74
- * tomatoOcr.setDetBoxType("quad");
75
- * ```
76
- */
77
- function setDetBoxType(detBoxType: string): void;
78
-
79
- /**
80
- * 设置检测框展开比例
81
- * @param detUnclipRatio 设置检测模型框选文本范围大小的参数,非必设置,默认为1.9。值范围1.6-2.5之间,值越大框选范围越大,值越小框选范围越小;当框选到了,但识别得分较低,就可以调整该参数改善准确率。
82
- * @example
83
- * ```typescript
84
- * tomatoOcr.setDetUnclipRatio(1.9);
85
- * ```
86
- */
87
- function setDetUnclipRatio(detUnclipRatio: number): void;
88
-
89
- /**
90
- * 设置检测框缩放比例
91
- * @param detScaleRatio 检测框缩放比例
92
- * @example
93
- * ```typescript
94
- * tomatoOcr.setDetScaleRatio(1.2);
95
- * ```
96
- */
97
- function setDetScaleRatio(detScaleRatio: number): void;
98
-
99
- /**
100
- * 设置识别分数阈值
101
- * @param recScoreThreshold 设置识别模型过滤得分的参数,非必设置,默认0.1。由于返回的识别结果数据太多太乱,可以通过设置该参数,过滤一些得分较低不准的数据,使得结果看起来更加简练。
102
- * @example
103
- * ```typescript
104
- * tomatoOcr.setRecScoreThreshold(0.1);
105
- * ```
106
- */
107
- function setRecScoreThreshold(recScoreThreshold: number): void;
108
-
109
- /**
110
- * 设置返回类型
111
- * @param returnType 设置调用插件识别返回格式的参数,非必设置,默认为json。默认"json": 包含得分、坐标和文字;"text":纯文字;"num":纯数字;自定义输入想要返回的文本:".¥1234567890",仅只返回这些内容
112
- * @example
113
- * ```typescript
114
- * tomatoOcr.setReturnType("json");
115
- * ```
116
- */
117
- function setReturnType(returnType: string): void;
118
-
119
- /**
120
- * 设置二值化阈值
121
- * @param binaryThresh 设置图像二值化的参数,非必设置,默认0,不进行二值化。 二值化设定0-255,常规情况下不需要设置,可配合中调试应用使用。
122
- * @example
123
- * ```typescript
124
- * tomatoOcr.setBinaryThresh(0);
125
- * ```
126
- */
127
- function setBinaryThresh(binaryThresh: number): void;
128
-
129
- /**
130
- * 设置运行模式
131
- * @param runMode 运行模式
132
- * @example
133
- * ```typescript
134
- * tomatoOcr.setRunMode("fast");
135
- * ```
136
- */
137
- function setRunMode(runMode: string): void;
138
-
139
- /**
140
- * 设置图像滤色参数,非必设置,默认"",对图片中的文字进行颜色过滤,可以是单色也可以为多色,配合调试工具使用,如下图:
141
- * @param filterColor 颜色过滤,通过逗号相互连,第一个是颜色值,第二个是负偏色,第三个是正偏色;不同颜色之间以"|"连接
142
- * @param backgroundColor 滤色后的背景色,传""或black的时候,背景是黑色,传“white”的时候,背景是白色
143
- * @example
144
- * ```typescript
145
- * tomatoOcr.setFilterColor("#41917A,38,38", "black");
146
- * tomatoOcr.setFilterColor("#41917A,38,38|#E091A8,50,50", "white");
147
- * ```
148
- */
149
- function setFilterColor(filterColor: string, backgroundColor: string): void;
150
-
151
- /**
152
- * 对图像执行 OCR 识别
153
- * @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
154
- * @param type 识别类型 默认3: 检测 + 识别;0: 只检测;1: 方向分类+识别;2: 只识别;3: 检测+识别
155
- * @param x 边界框左上角x坐标
156
- * @param y 边界框左上角y坐标
157
- * @param ex 边界框右下角x坐标
158
- * @param ey 边界框右下角y坐标
159
- * @returns OCR识别结果JSON字符串
160
- * @example
161
- * ```typescript
162
- * // 识别屏幕
163
- * const result1 = tomatoOcr.ocrImage("screen", 0, 0, 0, 0, 0);
164
- * logi(`识别屏幕结果:${result1}`);
165
- *
166
- * // 识别文件
167
- * const result2 = tomatoOcr.ocrImage("/path/to/image.png", 0);
168
- * logi(`识别文件结果:${result2}`);
169
- *
170
- * // 识别指定屏幕区域
171
- * const result3 = tomatoOcr.ocrImage("screen", 0);
172
- * logi(`识别指定屏幕区域结果:${result3}`);
173
- * ```
174
- */
175
- function ocrImage(
176
- input: string,
177
- type: number,
178
- x?: number,
179
- y?: number,
180
- ex?: number,
181
- ey?: number
182
- ): string;
183
-
184
- /**
185
- * 查找点击点
186
- * @param data 要找的文字
187
- * @returns 找“要找的文字”的中心点 没有找到返回空字符串
188
- * @example
189
- * ```typescript
190
- * const result = tomatoOcr.findTapPoint('{"text": "确定"}');
191
- * const tapPoint = JSON.parse(result);
192
- * logi(tapPoint);
193
- * ```
194
- */
195
- function findTapPoint(data: string): string;
196
-
197
- /**
198
- * 查找多个点击点
199
- * @param data 要找的文字
200
- * @returns 找“要找的文字”的所有相匹配的中心点 没有找到返回空字符串
201
- * @example
202
- * ```typescript
203
- * const result = tomatoOcr.findTapPoints('{"texts": ["确定", "取消"]}');
204
- * const tapPoints = JSON.parse(result);
205
- * logi(tapPoints);
206
- * ```
207
- */
208
- function findTapPoints(data: string): string;
209
- }
1
+ /**
2
+ * TomatoOCR 模块
3
+ * 提供基于 TomatoOCR 框架的文字识别和 YOLO 目标检测功能
4
+ */
5
+ declare namespace tomatoOcr {
6
+ /**
7
+ * 初始化TomatoOCR并设置基本配置
8
+ * @param mode 运行模式 debug:调试模型;删除或传别的任何值为正式模式
9
+ * @param licenseData 授权码 请传入你在 TomatoOCR 官网申请的授权码
10
+ * @param remark 备注信息(可选)
11
+ * @returns 设置结果
12
+ * @example
13
+ * ```typescript
14
+ * // 不带备注
15
+ * const result1 = tomatoOcr.initializeWithConfig("online", "授权码");
16
+ * // 带备注
17
+ * const result2 = tomatoOcr.initializeWithConfig("online", "授权码", "测试环境");
18
+ * logi(result1, result2);
19
+ * ```
20
+ */
21
+ function initializeWithConfig(
22
+ mode: string,
23
+ licenseData: string,
24
+ remark?: string
25
+ ): {
26
+ deviceId: string;
27
+ expiryTime: string;
28
+ message: string;
29
+ status: string;
30
+ versionName: string;
31
+ } | null;
32
+
33
+ /**
34
+ * 设置 HTTP 请求间隔时间
35
+ * @param second 间隔秒数 设置网络请求间隔时间,非必设置。0-86400
36
+ * @example
37
+ * ```typescript
38
+ * tomatoOcr.setHttpIntervalTime(3600);
39
+ * ```
40
+ */
41
+ function setHttpIntervalTime(second: number): void;
42
+
43
+ /**
44
+ * 设置识别类型
45
+ * @param recType 识别类型 模型类型,默认 ch-3.0,除此之外还有 ch-2.0, ch, cht, japan, korean, number
46
+ * @example
47
+ * ```typescript
48
+ * // 普通中英文识别,3.0版模型
49
+ * tomatoOcr.setRecType("ch-3.0");
50
+ * // 普通中英文识别,2.0版模型
51
+ * tomatoOcr.setRecType("ch-2.0");
52
+ * // 普通中英文识别,1.0版模型
53
+ * tomatoOcr.setRecType("ch");
54
+ * // 繁体
55
+ * tomatoOcr.setRecType("cht");
56
+ * // 日语
57
+ * tomatoOcr.setRecType("japan");
58
+ * // 韩语
59
+ * tomatoOcr.setRecType("korean");
60
+ * // 数字模型
61
+ * tomatoOcr.setRecType("number");
62
+ * ```
63
+ */
64
+ function setRecType(recType: string): void;
65
+
66
+ /**
67
+ * 设置检测框类型
68
+ * @param detBoxType 检测框类型 默认"rect": 由于手机上截图文本均为矩形文本;"quad":可准确检测倾斜文本
69
+ * @example
70
+ * ```typescript
71
+ * // 矩形文本
72
+ * tomatoOcr.setDetBoxType("rect");
73
+ * // 倾斜文本
74
+ * tomatoOcr.setDetBoxType("quad");
75
+ * ```
76
+ */
77
+ function setDetBoxType(detBoxType: string): void;
78
+
79
+ /**
80
+ * 设置检测框展开比例
81
+ * @param detUnclipRatio 设置检测模型框选文本范围大小的参数,非必设置,默认为1.9。值范围1.6-2.5之间,值越大框选范围越大,值越小框选范围越小;当框选到了,但识别得分较低,就可以调整该参数改善准确率。
82
+ * @example
83
+ * ```typescript
84
+ * tomatoOcr.setDetUnclipRatio(1.9);
85
+ * ```
86
+ */
87
+ function setDetUnclipRatio(detUnclipRatio: number): void;
88
+
89
+ /**
90
+ * 设置检测框缩放比例
91
+ * @param detScaleRatio 检测框缩放比例
92
+ * @example
93
+ * ```typescript
94
+ * tomatoOcr.setDetScaleRatio(1.2);
95
+ * ```
96
+ */
97
+ function setDetScaleRatio(detScaleRatio: number): void;
98
+
99
+ /**
100
+ * 设置识别分数阈值
101
+ * @param recScoreThreshold 设置识别模型过滤得分的参数,非必设置,默认0.1。由于返回的识别结果数据太多太乱,可以通过设置该参数,过滤一些得分较低不准的数据,使得结果看起来更加简练。
102
+ * @example
103
+ * ```typescript
104
+ * tomatoOcr.setRecScoreThreshold(0.1);
105
+ * ```
106
+ */
107
+ function setRecScoreThreshold(recScoreThreshold: number): void;
108
+
109
+ /**
110
+ * 设置返回类型
111
+ * @param returnType 设置调用插件识别返回格式的参数,非必设置,默认为json。默认"json": 包含得分、坐标和文字;"text":纯文字;"num":纯数字;自定义输入想要返回的文本:".¥1234567890",仅只返回这些内容
112
+ * @example
113
+ * ```typescript
114
+ * tomatoOcr.setReturnType("json");
115
+ * ```
116
+ */
117
+ function setReturnType(returnType: string): void;
118
+
119
+ /**
120
+ * 设置二值化阈值
121
+ * @param binaryThresh 设置图像二值化的参数,非必设置,默认0,不进行二值化。 二值化设定0-255,常规情况下不需要设置,可配合中调试应用使用。
122
+ * @example
123
+ * ```typescript
124
+ * tomatoOcr.setBinaryThresh(0);
125
+ * ```
126
+ */
127
+ function setBinaryThresh(binaryThresh: number): void;
128
+
129
+ /**
130
+ * 设置运行模式
131
+ * @param runMode 运行模式
132
+ * @example
133
+ * ```typescript
134
+ * tomatoOcr.setRunMode("fast");
135
+ * ```
136
+ */
137
+ function setRunMode(runMode: string): void;
138
+
139
+ /**
140
+ * 设置图像滤色参数,非必设置,默认"",对图片中的文字进行颜色过滤,可以是单色也可以为多色,配合调试工具使用,如下图:
141
+ * @param filterColor 颜色过滤,通过逗号相互连,第一个是颜色值,第二个是负偏色,第三个是正偏色;不同颜色之间以"|"连接
142
+ * @param backgroundColor 滤色后的背景色,传""或black的时候,背景是黑色,传“white”的时候,背景是白色
143
+ * @example
144
+ * ```typescript
145
+ * tomatoOcr.setFilterColor("#41917A,38,38", "black");
146
+ * tomatoOcr.setFilterColor("#41917A,38,38|#E091A8,50,50", "white");
147
+ * ```
148
+ */
149
+ function setFilterColor(filterColor: string, backgroundColor: string): void;
150
+
151
+ /**
152
+ * 对图像执行 OCR 识别
153
+ * @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
154
+ * @param type 识别类型 默认3: 检测 + 识别;0: 只检测;1: 方向分类+识别;2: 只识别;3: 检测+识别
155
+ * @param x 边界框左上角x坐标
156
+ * @param y 边界框左上角y坐标
157
+ * @param ex 边界框右下角x坐标
158
+ * @param ey 边界框右下角y坐标
159
+ * @returns OCR识别结果JSON字符串
160
+ * @example
161
+ * ```typescript
162
+ * // 识别屏幕
163
+ * const result1 = tomatoOcr.ocrImage("screen", 0, 0, 0, 0, 0);
164
+ * logi(`识别屏幕结果:${result1}`);
165
+ *
166
+ * // 识别文件
167
+ * const result2 = tomatoOcr.ocrImage("/path/to/image.png", 0);
168
+ * logi(`识别文件结果:${result2}`);
169
+ *
170
+ * // 识别指定屏幕区域
171
+ * const result3 = tomatoOcr.ocrImage("screen", 0);
172
+ * logi(`识别指定屏幕区域结果:${result3}`);
173
+ * ```
174
+ */
175
+ function ocrImage(
176
+ input: string,
177
+ type: number,
178
+ x?: number,
179
+ y?: number,
180
+ ex?: number,
181
+ ey?: number
182
+ ): string;
183
+
184
+ /**
185
+ * 查找点击点
186
+ * @param data 要找的文字
187
+ * @returns 找“要找的文字”的中心点 没有找到返回空字符串
188
+ * @example
189
+ * ```typescript
190
+ * const result = tomatoOcr.findTapPoint('{"text": "确定"}');
191
+ * const tapPoint = JSON.parse(result);
192
+ * logi(tapPoint);
193
+ * ```
194
+ */
195
+ function findTapPoint(data: string): string;
196
+
197
+ /**
198
+ * 查找多个点击点
199
+ * @param data 要找的文字
200
+ * @returns 找“要找的文字”的所有相匹配的中心点 没有找到返回空字符串
201
+ * @example
202
+ * ```typescript
203
+ * const result = tomatoOcr.findTapPoints('{"texts": ["确定", "取消"]}');
204
+ * const tapPoints = JSON.parse(result);
205
+ * logi(tapPoints);
206
+ * ```
207
+ */
208
+ function findTapPoints(data: string): string;
209
+ }
package/types/tts.d.ts CHANGED
@@ -1,91 +1,91 @@
1
- /**
2
- * TTS(文本转语音)模块 包含语音合成、播放控制等功能
3
- */
4
- declare namespace tts {
5
- /**
6
- * 语音信息接口
7
- */
8
- interface VoiceInfo {
9
- /** 语音标识符 */
10
- identifier: string;
11
- /** 语音名称 */
12
- name: string;
13
- /** 语言代码 */
14
- language: string;
15
- /** 语音质量等级 */
16
- quality: number;
17
- }
18
-
19
- /**
20
- * 播放文本转语音(5参数版本)
21
- * @param text 要转换的文本
22
- * @param rate 语速,范围0.0-1.0,默认0.5
23
- * @param pitch 音调,范围0.5-2.0,默认1.0
24
- * @param volume 音量,范围0.0-1.0,默认1.0
25
- * @param language 语言代码,默认"zh-CN"
26
- * @returns 是否成功开始播放
27
- * @example
28
- * const success = tts.speak("你好世界", 0.5, 1.0, 1.0, "zh-CN");
29
- */
30
- function speak(
31
- text: string,
32
- rate?: number,
33
- pitch?: number,
34
- volume?: number,
35
- language?: string
36
- ): boolean;
37
-
38
- /**
39
- * 等待当前语音播放结束
40
- * @example
41
- * tts.waitEnd();
42
- */
43
- function waitEnd(): void;
44
-
45
- /**
46
- * 停止当前播放
47
- * @example
48
- * tts.stop();
49
- */
50
- function stop(): void;
51
-
52
- /**
53
- * 检查是否正在播放
54
- * @returns 是否正在播放
55
- * @example
56
- * if (tts.isSpeaking()) {
57
- * logi("正在播放");
58
- * }
59
- */
60
- function isSpeaking(): boolean;
61
-
62
- /**
63
- * 获取可用的语音列表
64
- * @returns 语音信息数组
65
- * @example
66
- * const voices = tts.getAvailableVoices();
67
- * voices.forEach(voice => {
68
- * logi(`语音: ${voice.name}, 语言: ${voice.language}, 标识符: ${voice.identifier}, 质量: ${voice.quality}`);
69
- * });
70
- */
71
- function getAvailableVoices(): VoiceInfo[];
72
-
73
- /**
74
- * 设置语音
75
- * @param voiceIdentifier 语音标识符
76
- * @returns 是否设置成功
77
- * @example
78
- * const success = tts.setVoice("com.apple.ttsbundle.siri_Yu-shu_zh-CN_compact");
79
- * if (success) {
80
- * logi("语音设置成功");
81
- * }
82
- */
83
- function setVoice(voiceIdentifier: string): boolean;
84
-
85
- /**
86
- * 释放TTS资源(调用时,会停止当前播放并释放资源)
87
- * @example
88
- * tts.free();
89
- */
90
- function free(): void;
91
- }
1
+ /**
2
+ * TTS(文本转语音)模块 包含语音合成、播放控制等功能
3
+ */
4
+ declare namespace tts {
5
+ /**
6
+ * 语音信息接口
7
+ */
8
+ interface VoiceInfo {
9
+ /** 语音标识符 */
10
+ identifier: string;
11
+ /** 语音名称 */
12
+ name: string;
13
+ /** 语言代码 */
14
+ language: string;
15
+ /** 语音质量等级 */
16
+ quality: number;
17
+ }
18
+
19
+ /**
20
+ * 播放文本转语音(5参数版本)
21
+ * @param text 要转换的文本
22
+ * @param rate 语速,范围0.0-1.0,默认0.5
23
+ * @param pitch 音调,范围0.5-2.0,默认1.0
24
+ * @param volume 音量,范围0.0-1.0,默认1.0
25
+ * @param language 语言代码,默认"zh-CN"
26
+ * @returns 是否成功开始播放
27
+ * @example
28
+ * const success = tts.speak("你好世界", 0.5, 1.0, 1.0, "zh-CN");
29
+ */
30
+ function speak(
31
+ text: string,
32
+ rate?: number,
33
+ pitch?: number,
34
+ volume?: number,
35
+ language?: string
36
+ ): boolean;
37
+
38
+ /**
39
+ * 等待当前语音播放结束
40
+ * @example
41
+ * tts.waitEnd();
42
+ */
43
+ function waitEnd(): void;
44
+
45
+ /**
46
+ * 停止当前播放
47
+ * @example
48
+ * tts.stop();
49
+ */
50
+ function stop(): void;
51
+
52
+ /**
53
+ * 检查是否正在播放
54
+ * @returns 是否正在播放
55
+ * @example
56
+ * if (tts.isSpeaking()) {
57
+ * logi("正在播放");
58
+ * }
59
+ */
60
+ function isSpeaking(): boolean;
61
+
62
+ /**
63
+ * 获取可用的语音列表
64
+ * @returns 语音信息数组
65
+ * @example
66
+ * const voices = tts.getAvailableVoices();
67
+ * voices.forEach(voice => {
68
+ * logi(`语音: ${voice.name}, 语言: ${voice.language}, 标识符: ${voice.identifier}, 质量: ${voice.quality}`);
69
+ * });
70
+ */
71
+ function getAvailableVoices(): VoiceInfo[];
72
+
73
+ /**
74
+ * 设置语音
75
+ * @param voiceIdentifier 语音标识符
76
+ * @returns 是否设置成功
77
+ * @example
78
+ * const success = tts.setVoice("com.apple.ttsbundle.siri_Yu-shu_zh-CN_compact");
79
+ * if (success) {
80
+ * logi("语音设置成功");
81
+ * }
82
+ */
83
+ function setVoice(voiceIdentifier: string): boolean;
84
+
85
+ /**
86
+ * 释放TTS资源(调用时,会停止当前播放并释放资源)
87
+ * @example
88
+ * tts.free();
89
+ */
90
+ function free(): void;
91
+ }