0

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]];

}
Ankur
  • 5,086
  • 19
  • 37
  • 62
Sandeep
  • 221
  • 1
  • 9
  • Are you trying to speak all strings for each tableViewCell? You probably want to place that call in the didSelectRowForIndex method if you are trying to speak only the current cell and change to [engine speak [stringComponentsForArray objectAtIndex:indexPath.row];. – Mark McCorkle May 03 '13 at 14:04
  • I dont want to speech the name while selecting the row..So we cant add it to didSelectRow..Here based on some condition i want to filter some strings, and i want to speak only that filtered strings continuosly... – Sandeep May 03 '13 at 14:11
  • Is the array being changed elsewhere because you are calling [engine speak:[stringComponentsForArray objectAtIndex:1] over and over. Wouldn't you want to change the index? – Mark McCorkle May 03 '13 at 14:14

2 Answers2

0

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];
Mark McCorkle
  • 9,349
  • 2
  • 32
  • 42
0

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

Gordon Dove
  • 2,537
  • 1
  • 22
  • 23