When I try the MicrophoneSetup method nothing happens
Last reviewed: 8/7/1999
PRB Article ID: P089903
The information in this article applies to:
- SpeechKit 2.1
Symptoms
When I try the MicrophoneSetup method in VB, nothing happens. Am I calling the function incorrectly?
oChantSR.MicrophoneSetup "My Application", AlwaysRun, Unknown, ""
If I call this function before oChantSR.StartRecognition nothing happens. If I call this function after oChantSR.StartRecognition I either get an "Out of Stack Space" or a page fault in KERNEL32, or both.
Cause
We are unable to reproduce the problem.
We added the following to number sample before or after the if start recognition. It worked both places.
Private Sub Form_Load()
Dim x As Boolean
Dim vocabTypes As Long
Dim NullArray() As String
Set oChantSR = New ChantSR
Rem We tried it here
Rem oChantSR.MicrophoneSetup "Number Sample", AlwaysRun, Unknown, ""
Rem Check to see if this engine/mode supports GrammarVocabulary type.
oChantSR.GetVocabularyTypes "Number Sample", vocabTypes
If (vocabTypes And GrammarVocabulary) Then
Rem Check to see if this engine/mode supports GrammarVocabulary type.
oChantSR.RegisterCallback ChantHasPhrase, Number.hWnd
Rem Start the session with the engine.
oChantSR.StartRecognition "Number Sample", "numbers", GrammarVocabulary, NullArray, True, Number.hWnd
Else
MsgBox ("This application does not support the speech engine selected.")
End If
Rem And we tried it here
Rem oChantSR.MicrophoneSetup "Number Sample", AlwaysRun, Unknown, ""
End Sub
You probably only want to select AlwaysRun if you have this statement in code that knows this is a first time run or in a set up option in your change settings dialog.
You probably want to assign a name to the microphone set up like "MyApp Microphone" so you can do a SetMicrophone after you start recognition. This will ensure that every time the user runs your application they are using the proper microphone settings (very important). If the user setting changes (i.e., if there on a laptop or have TV going or moved computer), then you probably want the set up option in your change settings dialog.
Status
Cannot recreate problem.