我想加载多种语言以使用带有SSML for iPhone的IVONA SDK。 没有用于 Xcode / objective-C 的文档,只给出了SDK本身和几个C / java示例。
如何使用适用于iOS的IVONA SDK为文本加载多种语言?
编辑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, NSUserDomainMask, 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上的一个流媒体中加载多种语言?
答案 0 :(得分:1)
可能添加到数组allVoices的对象不符合预期的initWithVoices数组:...