Alzer Casiño
Alzer Casiño

Reputation: 73

How to Speed Up Performance of ISpVoice?

I am trying to build a game menu that reads the highlighted text using ISpVoice and keyboard.

My problem is that there is a delay whenever I change the highlighted text using the keyboard. This only happens when I use ISpVoice.

tts->Speak(myWstring.c_str(), SPF_PURGEBEFORESPEAK | SPF_ASYNC, 0);

I tried the above code but still there is a lag.

tts->Speak(myWstring.c_str(), SPF_ASYNC, 0);

the above code works but I want it to immediate stop whenever I want to change the highlighted text.

Upvotes: 0

Views: 192

Answers (1)

Mohamed Noordin
Mohamed Noordin

Reputation: 173

You could purge previous speech tasks using the SVSFPurgeBeforeSpeak flag in the SpeechVoiceSpeakFlags enumeration.

tts->Speak(myWstring.c_str(), SVSFlagsAsync | SVSFPurgeBeforeSpeak, 0);

Or:

tts->Speak(myWstring.c_str(), 1 | 2, 0);

That will clean (purge) all previous asynchronous speech tasks without any lag.

Upvotes: 0

Related Questions