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

GetVoices Method


The GetVoices method returns a selection of voices available to the voice.

Selection criteria may be applied optionally. In the absence of selection criteria, all voices are returned in the selection, ordered alphabetically by the voice name. If no voices match the criteria, GetVoices returns an empty selection, that is, an ISpeechObjectTokens collection with a Count of zero.

See Object Tokens and Registry Settings White Paper for a list of SAPI 5-defined attributes.


SpVoice.GetVoices(
     [RequiredAttributes As String = ""],
     [OptionalAttributes As String = ""]
) As ISpeechObjectTokens

Parameters

RequiredAttributes
[Optional] Specifies the RequiredAttributes. All voices selected will match these specifications. If no voices match the selection, the selection returned will contain no voices. By default, no attributes are required and so the list returns all the tokens discovered.
OptionalAttributes
[Optional] Specifies the OptionalAttributes. Voices which match these specifications will be returned at the front of the selection. By default, no attribute is specified and the list returned from the speech configuration database is in the order that attributes were discovered.

Return Value

An ISpeechObjectTokens variable containing the collection of voice tokens selected.


Remarks

The format of selection criteria is "Attribute = Value" and "Attribute != Value." Voice attributes include "Gender," "Age," "Name," "Language," and "Vendor."

Example

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

  • A command button called Command1
  • A list box called List1
  • Paste this code into the Declarations section of the form.

    The Form_Load procedure creates a voice object, and displays the names of all available voices in the list box. Select a voice name in the list box, and then click Command1. The Command1 procedure sets the voice object's Voice property to the selected name, and causes the voice to speak its new name.


    Option Explicit
    
    Private V As SpeechLib.SpVoice
    Private T As SpeechLib.ISpeechObjectToken
    
    Private Sub Command1_Click()
    
        If List1.ListIndex > -1 Then
        
            'Set voice object to voice name selected in list box
            'The new voice speaks its own name
            
            Set V.Voice = V.GetVoices().Item(List1.ListIndex)
            V.Speak V.Voice.GetDescription
            
        Else
            MsgBox "Please select a voice from the listbox"
        End If
            
    End Sub
    
    Private Sub Form_Load()
        Dim strVoice As String
        
        Set V = New SpVoice
        
        'Get each token in the collection returned by GetVoices
        For Each T In V.GetVoices
            strVoice = T.GetDescription     'The token's name
            List1.AddItem strVoice          'Add to listbox
        Next
        
    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