bd_etts_ch_text.dat
bd_etts_ch_speech_female.dat
bd_etts_ch_speech_male.dat
放在项目的Resources下。代码初始化如下:
// 离线相关设置
NSString *textDataFile =[[NSBundle mainBundle] pathForResource:@"bd_etts_ch_text" ofType:@"dat"];
NSString *speechDataFile =[[NSBundle mainBundle] pathForResource:@"bd_etts_ch_speech_female" ofType:@"dat"];
/*std::string textpath = getTextAbSolutePath();
std::string speechPath = getFemaleAbSolutePath();
NSString *textDataFile =[NSString stringWithUTF8String:textpath.c_str()];
NSString *speechDataFile =[NSString stringWithUTF8String:speechPath.c_str()];*/
NSLog(@"path = %@", textDataFile);
NSLog(@"path = %@", speechDataFile);
NSLog(@"path = %@", [[NSBundle mainBundle]resourcePath]);
NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile:textDataFile];
NSLog(@"data = %@", data);
NSFileHandle *handle = [NSFileHandle fileHandleForReadingAtPath:textDataFile];
NSLog(@"data = %@", handle);
//#error 请替换你申请的app id
[[BDTTSSynthesizer sharedInstance] setOfflineEngineLicense: nil withAppCode:@"5826489"];
[[BDTTSSynthesizer sharedInstance] setOfflineEngineTextDatPath:textDataFile andSpeechData:speechDataFile];
BOOL ver = [[BDTTSSynthesizer sharedInstance] verifyOfflineEngineDataFile:textDataFile error:nil];
log 显示path是非nil的。但是 verifyOfflineEngineDataFile 返回 -1. 详细日志如下:(** 隐藏了 应用名称)
2015-09-05 23:56:19.620 **[2686:60b] path = /var/mobile/Applications/114F0EFE-E77E-4EDE-83C4-E2395A36CBD6/**.app/bd_etts_ch_text.dat
2015-09-05 23:56:19.624 **[2686:60b] path = /var/mobile/Applications/114F0EFE-E77E-4EDE-83C4-E2395A36CBD6/**.app/bd_etts_ch_speech_female.dat
2015-09-05 23:56:19.626 **[2686:60b] path = /var/mobile/Applications/114F0EFE-E77E-4EDE-83C4-E2395A36CBD6/**.app
2015-09-05 23:56:19.810 **[2686:60b] data = (null)
2015-09-05 23:56:19.814 **[2686:60b] data =
2015-09-05 23:56:19.818 **[2686:60b] ver = (null)
2015-09-05 23:56:19.819 D|BDOfflineTTSEngine.mm:233 verify data file failed, error code is -1
2015-09-05 23:56:19.999 D|BDOfflineTTSEngine.mm:784 read license file: /var/mobile/Applications/114F0EFE-E77E-4EDE-83C4-E2395A36CBD6/Documents/bdtts_license.dat
2015-09-05 23:56:19.999 D|BDOfflineTTSEngine.mm:787 read license file length: 512
2015-09-05 23:56:20.030 E|BDOfflineTTSEngine.mm:425 start tts engine failed, error code is 10005
2015-09-05 23:56:20.033 E|BDOfflineTTSEngine.mm:129 falied to start tts engine: 10005
2015-09-05 23:56:20.036 E|BDTTSSynthesizerImpl.m:540 init offline tts engine failed
2015-09-05 23:56:20.039 D|BDTTSSynthesizerImpl.m:256 load offline tts engine failed, offline disabled
麻烦帮我看看问题。
有谁ios离线合成成功了的?
估计是数据文件和引擎版本不匹配导致的
您好,verify data失败了,应该是设置的音库文件有问题
选择的SDK版本是离在线的ISOsdk版本。