1

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 Answers2

1

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.

Halle
  • 3,584
  • 1
  • 37
  • 53
  • So I attempted to do this but was unable to access the OpenEarsEventsObserver method fliteDidFinishSpeaking. Is there a possibility you could show an example in code to further clarify? – user1770069 Oct 25 '12 at 03:07
  • The tutorial explains implementing OpenEarsEventsObserver: http://www.politepix.com/openears/tutorial and there is an example of fliteDidFinishSpeaking in the sample app. – Halle Oct 25 '12 at 06:39
  • Awesome, I hadn't realized that. Thank you! – user1770069 Oct 25 '12 at 11:39
  • No prob, in case you haven't seen it yet, OpenEars has its own forum at http://www.politepix.com/forums/openears which is the best place to get assistance with things that need further troubleshooting. – Halle Oct 25 '12 at 14:23
0

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.

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281