I’m working with Speech Platform Run time of Microsoft and i’m using the SpVoice interface to make the run time speak the sentences i want.
To Stop the speech mid sentence i created my function like this
public void StopSpeak()
{
try
{
Speaker.Speak("", SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
}
catch (COMException ex)
{
}
}
But when i run this while the Speech Platform is speaking i get this com error:
Exception from HRESULT: 0x80045006
I looked it up by Microsoft and it means that the wave device is busy, i now realize that i get this error every time the Speech Platform is busy speaking a sentence.
Is there a other way to stop the speech mid sentence using SpVoice or any other interface or class that comes with the Speech Platform Runtime ?
Thanks.
To stop the Speech without having to deal with the exception, use the
Skipmethod onSpVoice. Documentation here.This should work, as it will skip
int.MaxValuesentences: