FliteController within a loop

353 views Asked by At

So I have this loop:

for (int i =0; i< ([rounds_words count]-1); i++){
  [self.fliteController say:[rounds_words objectAtIndex:(i)] withVoice:self.slt];
}

Where array_o_words is an array of strings that I would like to use OpenEars' TtS engine flite to say.

I have followed the instructions on http://www.politepix.com/openears/#FliteController_Class_Reference but of course this just states that there can only be one instance. I have tried reseting fliteController = nil but this just prevents it from working at all.

Any advice to make the loop work?

2

There are 2 answers

4
Halle On BEST ANSWER

OpenEars developer here. For the current implementation of FliteController you will get the desired results by speaking the NSString at the first index, waiting for the OpenEarsEventsObserver delegate method fliteDidFinishSpeaking to fire, speaking the NSString at the next index, etc.

0
Mick MacCallum On

The loop looks to me like it should be working fine, leading me to believe that the problem exists elsewhere. Since you say that there can only be one instance of the object in question at a time I would presume that you'll have to come up with some kind of completion handler for each event so you know at what point to start the next event.

Additionally, you're right that passing nil to the object in the loop would break operation. That's basically like cycling through your array and telling each object to start then immediately telling said object to be nil.

Side note, if you're looking to perform an operation for every item in your array consider the following changes.

Use:

for (int i =0; i < ([rounds_words count]); i++)

As it stands your current loop will always come up one short.