Last reviewed: 10/17/1998
Article ID: H109802
HOW: Deactivating and reactivating speech recognition
The information in this article applies to:
- SpeechKit 2.0 and higher
I am having trouble deactivating and reactivating speech recognition.
I am using SpeechKit for Delphi and MS SAPI 4. I have tried the following to deactivate, but with no success.
EnableSleepVocabulary("Sleep", m_hWnd) SetRecognitionAsleep(m_hWnd)
I did not see an example of this in the source so maybe you could provide an example. Is there a more robust example using Delphi that would show more of these features?
The most efficient way to deactivate and reactivate recognition is to use the SuspendRecognition and ResumeRecognition functions. SuspendRecognition will disable all active vocabularies without totally freeing up session resources. This enables you to quickly resume recognition and automatically enable all vocabularies that were active at the time the session was suspended.
If you are looking to put your application in a sleep mode where it can be activated by special words or phrases, then you can create a vocabulary, designate it as a sleep vocabulary, then set recognition asleep.
To create the vocabulary, you can use AddVocabulary. To designate the vocabulary as a sleep vocabulary you use EnableSleepVocabulary. You only have to define and enable the vocabulary as a sleep vocabulary once.
Every time you want to put the application in sleep mode, you issue SetRecognitionAsleep. If you want to resume recognition before the sleep words or phrases are recognition, you can invoke SetRecognitionAwake.