Microsoft Speech API (SAPI) SpVoice A function to stop

I work with the Microsoft Runtime platform and I use the interface SpVoiceso that the runtime appears in the sentences I want.

To stop the speech average sentence, I created my function as follows

public void StopSpeak()
{
    try
    {
      Speaker.Speak("", SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
    }
    catch (COMException ex)
    {

    }
}

But when I run this when it comes to the speech platform, I get this com error:

Exception from HRESULT: 0x80045006

I looked at Microsoft and that means the wave device is busy, now I understand that I get this error every time the speech platform is busy pronouncing the sentence.

Is there any other way to stop the average speech sentence using SpVoice or any other interface or class that comes with the Runtime speech platform?

Thank.

+3
2

, , Skip SpVoice. .

, int.MaxValue :

public void StopSpeak()
{
    Speaker.Skip("Sentence", int.MaxValue);
}
+1

, SpeechVoiceSpeakFlags Asyncronous. , . Pause.

Speaker.Speak( " ", SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync);

Speaker.Pause();

, , , . , .

null; Speaker = null; aftre resume, , .

0

All Articles