I have an application that is a user dialing a phone number. When the number is correct, then the user will hear a prompt to confirm it.
Here we use the third party dll to play the prompt, which converts text to speech. I believe that it invokes a thread.
vr.PlayTTS("If you are finished to enter the number, please press pound sign again to confirm it.");
To press a letter, we have the code:
vr.GetDigits(1, 5, ""); // get a char in 5 seconds string digit = vr.DigitBuffer;
Now the question is that I hope I can hear the entire prompt without being interrupted. The fact is when the prompt is playing, but the user presses the keypad at the same time. The method only plays partial prompt.
I want the thread is not interrupted.
My current code:
public static ManualResetEvent waitHandle = new ManualResetEvent(false); try { waitHandle.Set(); // blah blah while (true) { waitHandle.WaitOne(); vr.GetDigits(1, timeOut, ""); digit = vr.DigitBuffer; vr.PlayTTS(digit); // blah blah vr.PlayTTS("If you are finished to enter the number, please press pound sign again to confirm it."); // many blah and logging waitHandle.Set(); }Thanks for code.