I was wondering if anyone had any experience or advice on the following matter:

We're trying to develop a pedagogical agent, with a cartoon face that have a sequence of .jpg files that can animate to simulate "talking." When the user presses a button, the string entered in a textbox will use a text-to-speech engine and the audio will be heard. We used two threads, but there is no way for the speech-to0text engine to signal the other thread when it's done speaking, hence the animation of the talking face continues.

Does anyone know if there is a way to control the animation sequence so once there is no more audio or it is done speaking, the sequence loop will end?