Question

In one of the Table view delegate method I am accessing some strings based on some conditions and i want to speak those strings using ESpeak Engine..In the Log it is giving all the matched strings...but ESpeak Engine is only taking last string (i.e., it is only spelling last string.)

How to make to spell all the strings..

Here is my code..

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)celle forRowAtIndexPath:(NSIndexPath *)indexPath {
        NSLog(@"Final Speak Child List:%@",[stringComponentsForArray objectAtIndex:1]);

       [engine speak:[stringComponentsForArray objectAtIndex:1]];

}
Was it helpful?

Solution

If you are trying to speak all of the strings from the array then you can append all of the strings to an NSString property and then when the UITableView finishes loading you can begin speaking all the strings by speaking that long appended NSString. Otherwise place that in didSelectRowForIndex and call that method there relating to the appropriate indexPath.row for the array.

 [engine speak [stringComponentsForArray objectAtIndex:indexPath.row];

OTHER TIPS

From a quick look at the header, ESpeak doesn't queue up requests, which is why the last one overrides the earlier.

You could combine the text into a big string and do it that way, but that doesn't work if you want to change speaker or control timing.

What you'll have to do is make a little queue and then implement the delegate method

- (void)speechEngineDidFinishSpeaking:(ESpeakEngine*)engine successfully:(BOOL)flag;

As each text completes, you can add the next one.

Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top