SpeechRecognizer AllowAudioInputFormatChangesOnNextSet Property (SAPI 5.3)

Speech API 5.3
Microsoft Speech API 5.3

Object: ISpeechRecognizer
Type: Hidden

AllowAudioInputFormatChangesOnNextSet Property

The AllowAudioInputFormatChangesOnNextSet property specifies whether the recognizer can change audio input formats on subsequent audio streams.

When this property is True, recognizer's input stream format is reset to match the speech recognition engine's preferred format. When this property is False, no changes to the audio format takes place. The default value of this property is True.

The format will not actually be changed until the next time the input is set. Calls to ISpeechRecognizer.AudioInput and ISpeechRecognizer.AudioInputStream set the input.


Set: SpeechRecognizer.AllowAudioInputFormatChangesOnNextSet = Boolean
Get: Boolean = SpeechRecognizer.AllowAudioInputFormatChangesOnNextSet


The owning object.
Set: A Boolean variable that sets the property.
Get: A Boolean variable that gets the property.


The following Visual Basic form code demonstrates hot to retrieve and set the AllowAudioInputFormatChangesOnNextSet property. To run this code, paste it into the Declarations section of a form that contains no controls.

Option Explicit

Dim R As SpeechLib.SpSharedRecognizer
Dim T As SpeechLib.SpObjectToken

Private Sub Form_Load()

    Dim fAllowFormatChanges As Boolean

    On Error GoTo EH

    Set R = New SpSharedRecognizer
    fAllowFormatChanges = R.AllowAudioInputFormatChangesOnNextSet
    MsgBox "Default setting: " & fAllowFormatChanges

    R.AllowAudioInputFormatChangesOnNextSet = False
    fAllowFormatChanges = R.AllowAudioInputFormatChangesOnNextSet
    MsgBox "New setting: " & fAllowFormatChanges


    If Err.Number Then ShowErrMsg
End Sub

Private Sub ShowErrMsg()

    ' Declare identifiers:
    Dim T As String

    T = "Desc: " & Err.Description & vbNewLine
    T = T & "Err #: " & Err.Number
    MsgBox T, vbExclamation, "Run-Time Error"

End Sub