CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Object: SpVoice
Type: Hidden

AllowAudioOutputFormatChangesOnNextSet Property


The AllowOutputFormatChangesOnNextSet property gets and sets the flag that specifies whether SAPI will adjust the format of a voice object's new audio output device automatically.

By default, when an application sets a voice object's AudioOutput property to an audio device, SAPI will change the format of that device to match the engine's preferred format. In cases where a specific audio format is required, such as telephony applications, the AllowOutputFormatChangesOnNextSet property can be used to prevent this format change.

When this property is true, SAPI adjusts the format of the audio output object to the engine's preferred format. When it is false, SAPI uses the audio output object's format. If the output is set to a stream object, SAPI will convert the output to the format of the stream.


Syntax

Set: SpVoice.AllowAudioOutputFormatChangesOnNextSet = Boolean
Get: Boolean = SpVoice.AllowAudioOutputFormatChangesOnNextSet

Parts

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

Remarks

Using the same audio format for input and output source is useful for sound cards that do not support full-duplex audio (i.e., input format must match output format). If the input format quality is lower than the output format quality, the output format quality will be reduced to equal the input quality.


Example

The following Visual Basic form code demonstrates the use of the AllowAudioOutputFormatChangesOnNextSet property. To run this code, create a form with the following controls:

  • Two command buttons called Command1 and Command2.
  • Paste this code into the Declarations section of the form.

    The Form_Load procedure creates a voice object, an audio output object, and a SpeechAudioFormatType variable. Both command button procedures set the format of the audio output object to SAFT22kHz8BitMono, then set the AudioOutputStream of the voice to the audio output object, and then test if the voice's audio format has been changed.

    In the Command1 procedure, the AllowAudioOutputFormatChangesOnNextSet is set to True, and the voice's format is changed. In the Command2 procedure, this property is set to False, and the voice's format is not changed.


    Option Explicit
    
    Dim V As SpeechLib.SpVoice
    Dim O As SpMMAudioOut
    Dim S As ISpeechBaseStream
    
    Dim f As SpeechLib.SpeechAudioFormatType    'This is an Enum
    
    Private Sub Command1_Click()
        
        V.AllowAudioOutputFormatChangesOnNextSet = True
        
        O.Format.Type = f               'AudioOut obj gets SAFT22kHz8BitMono format
        Set V.AudioOutputStream = O     'The "Next Set"
        V.Speak "Adjust my format"      'Speak
        Set S = V.AudioOutputStream     'Stream object gets voice's format
        
        If S.Format.Type = f Then
            MsgBox "format not adjusted"
        Else
            MsgBox "format adjusted"
        End If
    End Sub
    
    Private Sub Command2_Click()
    
        V.AllowAudioOutputFormatChangesOnNextSet = False
    
        O.Format.Type = f               'AudioOut obj gets SAFT22kHz8BitMono format
        Set V.AudioOutputStream = O     'The "Next Set"
        V.Speak "Leave my format alone" 'Speak
        Set S = V.AudioOutputStream     'Stream object gets voice's format
        
        If S.Format.Type = f Then
            MsgBox "format not adjusted"
        Else
            MsgBox "format adjusted"
        End If
    End Sub
    
    Private Sub Form_Load()
    
        Set V = New SpVoice
        Set O = New SpMMAudioOut
        f = SAFT22kHz8BitMono       'The test audio output format
    End Sub


    You are reading help file online using chmlib.com

    If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
    Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web