objective-c – 如何将多种语言加载到IVONA SDK – 文本到语音
发布时间:2020-12-16 07:00:22 所属栏目:百科 来源:网络整理
导读:我想加载多种语言以使用带有SSML for iPhone的IVONA SDK. 没有用于 Xcode / objective-C的文档,只给出了SDK本身和几个C / java示例. 如何使用IVONA SDK for iOS加载多种语言文本? 编辑1:请参阅下面的代码 首先加载声音: - (NSInteger) loadVoice: (NSStri
|
我想加载多种语言以使用带有SSML for iPhone的IVONA SDK.
没有用于 Xcode / objective-C的文档,只给出了SDK本身和几个C / java示例. 如何使用IVONA SDK for iOS加载多种语言文本? 编辑1:请参阅下面的代码 首先加载声音: - (NSInteger) loadVoice: (NSString*) vox {
if(voice != nil) {
XLog(@"(voice != nil)");
[voice unload];
voice = nil;
}
NSString *pathIvona = [[NSString alloc] initWithFormat:@"%@",vox];
self.paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
self.documentsDirectory = [self.paths objectAtIndex:0];
self.path = [self.documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",pathIvona]];
voice = [[IvonaVoice alloc] init:instance withLibrary:self.path withVox:self.path];
[pathIvona release];
if (voice == nil) {
XLog(@"Cannot load voice");
[self setTtsError: @"Cannot load voice"];
return 0;
}
[voice setParam:@"vol" withInteger: 99];
return 1;
}
试图将多种语言加载到一个流转化器(流光仍然是零,它不会改变): NSArray *allVoices = [self getAvaliableVoxes]; /** * Here the streamer is still nil,* i cant find the mistake here. * */ IvonaStreamer *streamer = [[IvonaStreamer alloc] initWithVoices:allVoices withText:[NSString stringWithContentsOfFile:self.path encoding:NSUTF8StringEncoding error:&error] atSpeed:[NSNumber numberWithFloat:-1]]; 方法getAvailableVoices: - (NSArray*)getAvaliableVoxes {
XLog(@"-----------------------------------entered");
self.paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,YES);
self.documentsDirectory = [self.paths objectAtIndex:0];
NSFileManager *manager = [NSFileManager defaultManager];
NSArray *fileList = [manager contentsOfDirectoryAtPath:[self.paths objectAtIndex:0] error:nil];
for (NSString *s in fileList){
//XLog(@"s: %@",s);
}
NSMutableArray *pathsIvona = [[NSMutableArray alloc] init];
NSEnumerator *e = [fileList objectEnumerator];
NSString *vox;
while (vox = [e nextObject]) {
if([[vox lastPathComponent] hasPrefix:@"vox_"]) {
XLog(@"vox: %@",vox);
[pathsIvona addObject: [vox lastPathComponent]];
XLog(@"pathsIvona: %@",pathsIvona);
}
}
XLog(@"pathsIvona: %@",pathsIvona);
return [pathsIvona autorelease];
}
如何使用IVONA SDK在iOS上的一个流媒体中加载多种语言? 解决方法
也许添加到数组中的对象allVoices不符合预期的initWithVoices数组:…
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
