|
@@ -123,7 +123,7 @@ static T_JZsdkReturnCode TTS_Synthesis(const char* src_text, const char* params) |
|
@@ -123,7 +123,7 @@ static T_JZsdkReturnCode TTS_Synthesis(const char* src_text, const char* params) |
123
|
* 获取音源
|
123
|
* 获取音源
|
124
|
*
|
124
|
*
|
125
|
* ********/
|
125
|
* ********/
|
126
|
-static T_JZsdkReturnCode TTS_GetSoundSource(int tone,unsigned char *name_tts, unsigned char *name_path)
|
126
|
+static T_JZsdkReturnCode TTS_GetSoundSource(int tone,unsigned char *name_tts, unsigned char *name_path, unsigned char *rule_path)
|
127
|
{
|
127
|
{
|
128
|
|
128
|
|
129
|
/*
|
129
|
/*
|
|
@@ -182,6 +182,25 @@ static T_JZsdkReturnCode TTS_GetSoundSource(int tone,unsigned char *name_tts, un |
|
@@ -182,6 +182,25 @@ static T_JZsdkReturnCode TTS_GetSoundSource(int tone,unsigned char *name_tts, un |
182
|
snprintf(name_path,64, "fo|/root/tts/xiaoyan.jet");
|
182
|
snprintf(name_path,64, "fo|/root/tts/xiaoyan.jet");
|
183
|
break;
|
183
|
break;
|
184
|
}
|
184
|
}
|
|
|
185
|
+
|
|
|
186
|
+ //写入发音规则
|
|
|
187
|
+ memset(rule_path,0,128);
|
|
|
188
|
+ snprintf(rule_path,128,"/root/tts/common.jet");
|
|
|
189
|
+
|
|
|
190
|
+ //不是英文就直接返回
|
|
|
191
|
+ if ( tone != 0x11 && tone != 0x12)
|
|
|
192
|
+ {
|
|
|
193
|
+ return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
|
|
194
|
+ }
|
|
|
195
|
+
|
|
|
196
|
+ //由于有讯飞更新,让英文有了新的发音规则,所以要检测本地是否有新的发音规则
|
|
|
197
|
+ if(JZsdk_check_file_exists("/root/tts/common_en.jet") == JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
|
|
198
|
+ {
|
|
|
199
|
+ memset(rule_path,0,128);
|
|
|
200
|
+ snprintf(rule_path,128,"/root/tts/common_en.jet");
|
|
|
201
|
+ }
|
|
|
202
|
+
|
|
|
203
|
+ return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
185
|
}
|
204
|
}
|
186
|
|
205
|
|
187
|
static T_JZsdkReturnCode TTS_FILE_GenerateAndPlay(struct t_Megaphone_tts_param *Megaphone_tts_param)
|
206
|
static T_JZsdkReturnCode TTS_FILE_GenerateAndPlay(struct t_Megaphone_tts_param *Megaphone_tts_param)
|
|
@@ -196,15 +215,18 @@ static T_JZsdkReturnCode TTS_FILE_GenerateAndPlay(struct t_Megaphone_tts_param * |
|
@@ -196,15 +215,18 @@ static T_JZsdkReturnCode TTS_FILE_GenerateAndPlay(struct t_Megaphone_tts_param * |
196
|
int ret = MSP_SUCCESS;
|
215
|
int ret = MSP_SUCCESS;
|
197
|
char name_tts[16];
|
216
|
char name_tts[16];
|
198
|
char name_path[64];
|
217
|
char name_path[64];
|
|
|
218
|
+
|
199
|
char session_begin_params[512];
|
219
|
char session_begin_params[512];
|
200
|
char tts_add_params[512];
|
220
|
char tts_add_params[512];
|
|
|
221
|
+ char rule[128];
|
201
|
|
222
|
|
202
|
- //获取音源
|
|
|
203
|
- TTS_GetSoundSource(tone, name_tts, name_path);
|
223
|
+ //获取音源,以及规则
|
|
|
224
|
+ TTS_GetSoundSource(tone, name_tts, name_path, rule);
|
204
|
|
225
|
|
|
|
226
|
+ //配置合成参数
|
205
|
snprintf(session_begin_params,512,
|
227
|
snprintf(session_begin_params,512,
|
206
|
- "engine_type = local,voice_name=%s, text_encoding = UTF8, tts_res_path = %s;fo|/root/tts/common.jet, sample_rate = 16000, speed = %d, volume = %d, pitch = 50, rdn = 2"
|
|
|
207
|
- ,name_tts,name_path,speed,volume);
|
228
|
+ "engine_type = local,voice_name=%s, text_encoding = UTF8, tts_res_path = %s;fo|%s, sample_rate = 16000, speed = %d, volume = %d, pitch = 50, rdn = 2"
|
|
|
229
|
+ ,name_tts , name_path, rule, speed, volume);
|
208
|
|
230
|
|
209
|
printf("session_begin_params=%s\n",session_begin_params);
|
231
|
printf("session_begin_params=%s\n",session_begin_params);
|
210
|
printf("argv=%s\n",argv);
|
232
|
printf("argv=%s\n",argv);
|
|
@@ -383,4 +405,4 @@ T_JZsdkReturnCode Megaphone_cnTTS_Play(unsigned char *str, unsigned int str_len, |
|
@@ -383,4 +405,4 @@ T_JZsdkReturnCode Megaphone_cnTTS_Play(unsigned char *str, unsigned int str_len, |
383
|
}
|
405
|
}
|
384
|
|
406
|
|
385
|
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
407
|
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
386
|
-} |
408
|
+} |