Reply To: Pausing app while FliteController is speaking

Home Forums OpenEars Pausing app while FliteController is speaking Reply To: Pausing app while FliteController is speaking

#10532
woodyard
Participant

Sorry for the poor explanation – I had one foot out the dooor at the time.

I’m writing an application to help young children with their literacy skills. The application shows them a word, and then they have six seconds to say the word correctly. If they say it correctly, the app says “Correct”. If they say it incorrectly, the app says the word correctly.

So – the app uses all the OpenEars components!

Anyway – the problem I’m trying to overcome is that currently, when the timer runs out and “correct” or the word is said the next word is shown and the timer for the enxt word is starting while the FliteController is in the process of saying “correct” or saying the word that was missed. I need the app to wait for FliteController to finish speaking, and THEN move on to the next word/timer.

I’ve tried inserting a BOOL flag into fliteDidStartSpeaking and flitedDidFInishSpeaking and then writing a convenience method that calls fliteController then “waits” using a WHILE loop based on that Boolean value, but have not been successful using that approach.

Is there a better way to accomplish this, and if not – perhaps I’ve just missed something. Here is my convenience method and my overrides for both flite methods:

– (void) claraSay: (NSString *)message;
{
[self.fliteController say:message withVoice:kVoice];
while ( self.fliteIsSpeaking ) {
NSLog(@”Clara is waiting….”);
}
}

– (void) fliteDidStartSpeaking
{
NSLog(@”Flite has started speaking”); // Log it.

self.fliteIsSpeaking=TRUE;

}

– (void) fliteDidFinishSpeaking
{

NSLog(@”Flite has finished speaking”); // Log it.

self.fliteIsSpeaking=FALSE;

}