Groups > Microsoft > dotNET Speech SDK > Re: Restart the SpeechRecognitionEngine




Restart the SpeechRecognitionEngine

Restart the SpeechRecognitionEngine
Sun, 15 Apr 2007 22:57:03 +020
Hi,

I found an example on the Web which explain SR and TTS engine haven't to 
work together.
 I want to stop and restart a SpeechRecognitionEngine i launched in 
asynchrone mode.  (RecognizeMode.Multiple).
I do a "SrEngine.RecognizeAsyncCancel()" to stop it, but when i want
to 
restart it with a "SrEngine.RecognizeAsync(RecognizeMode.Multiple) ",
the 
system throws a TargetInvocationException "Impossible d'effectuer cette 
opération pendant que le module de reconnaissance effectue la 
reconnaissance".    How can i do to stop and restart the SREngine?

Great thanks,


B# 
Post Reply
Re: Restart the SpeechRecognitionEngine
16 Apr 2007 06:48:06 -0700
Bruno,

Likely the problem you are encountering is that your attempt to
restart the recognition engine is being made somewhere in the scope of
the SpeechRecognized event.  Since you are still handling that event
when you try to restart the engine, technically the engine is still
recognizing.  It's a deadlock scenario.

One of the things I do in my application is to create another thread
to turn the speech recognition back on.  This allows the current
thread to finish.

It is possible that the RecognizeCompleted event will allow you do
this in a more straightforward manner.  I wasn't able to use this in
my application because I wanted the TTS engine to run after every
SpeechRecognized event, so I needed not only for the RecognitionEngine
to complete its work, but also the TTS engine, before I turned the
SpeechRecognitionEngine back on.

James
Post Reply
Re: Restart the SpeechRecognitionEngine
Wed, 18 Apr 2007 23:18:14 +020
Hi, James,

You're right once again.And use the RecognizeCompleted event allows to 
restart the engine without problem's.
Thank you very much.

Bruno



"James Ashley" <magister.ludens@gmail.com> a écrit dans le
message de 
news:1176731286.501828.99340@n76g2000hsh.googlegroups.com...
> Bruno,
>
> Likely the problem you are encountering is that your attempt to
> restart the recognition engine is being made somewhere in the scope of
> the SpeechRecognized event.  Since you are still handling that event
> when you try to restart the engine, technically the engine is still
> recognizing.  It's a deadlock scenario.
>
> One of the things I do in my application is to create another thread
> to turn the speech recognition back on.  This allows the current
> thread to finish.
>
> It is possible that the RecognizeCompleted event will allow you do
> this in a more straightforward manner.  I wasn't able to use this in
> my application because I wanted the TTS engine to run after every
> SpeechRecognized event, so I needed not only for the RecognitionEngine
> to complete its work, but also the TTS engine, before I turned the
> SpeechRecognitionEngine back on.
>
> James
> 
Post Reply
about | contact