没有用于 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数组:… 总结以上是内存溢出为你收集整理的objective-c – 如何将多种语言加载到IVONA SDK – 文本到语音全部内容,希望文章能够帮你解决objective-c – 如何将多种语言加载到IVONA SDK – 文本到语音所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)