Κοινή χρήση μέσω


PromptBuilder Constructors

Definition

Creates a new instance of the PromptBuilder class.

Overloads

PromptBuilder()

Creates a new instance of the PromptBuilder class.

PromptBuilder(CultureInfo)

Creates a new instance of the PromptBuilder class and specifies a culture.

PromptBuilder()

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

Creates a new instance of the PromptBuilder class.

public:
 PromptBuilder();
public PromptBuilder ();
Public Sub New ()

Examples

The following example creates a new PromptBuilder instance and adds a text string to it.

using System.Speech.Synthesis;  

public void MySimpleText ()  
{  
    PromptBuilder builder = new PromptBuilder ();  
    builder.AppendText("Hello world!");  
}  

The following markup shows the equivalent in Speech Synthesis Markup Language (SSML), (xml:lang is a required attribute of the speak element):

<speak version="1.0"  
 xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">  
  Hello world!  
</speak>  

Applies to

PromptBuilder(CultureInfo)

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

Creates a new instance of the PromptBuilder class and specifies a culture.

public:
 PromptBuilder(System::Globalization::CultureInfo ^ culture);
public PromptBuilder (System.Globalization.CultureInfo culture);
new System.Speech.Synthesis.PromptBuilder : System.Globalization.CultureInfo -> System.Speech.Synthesis.PromptBuilder
Public Sub New (culture As CultureInfo)

Parameters

culture
CultureInfo

Provides information about a specific culture, such as its language, the name of the culture, the writing system, the calendar used, and how to format dates and sort strings.

Examples

The example that follows creates a PromptBuilder instance and specifies its Culture.

using System.Speech.Synthesis;  

public void MySimpleText ()  
{  
    PromptBuilder builder = new PromptBuilder(new System.Globalization.CultureInfo("en-US"));  
    builder.AppendText("Hello world!");  
}  

The following markup shows the equivalent SSML:

<speak version="1.0"  
 xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">  
  Hello world!  
</speak>  

Remarks

This constructor sets the value for the Culture property. The SpeechSynthesizer object will attempt to select an installed voice that supports the language specified by the culture parameter to process the prompt. If a voice with the specified culture is found, it will be used. If a voice with the specified culture cannot be found, the default voice will be used.

To correctly pronounce words in the language specified by the culture parameter, a speech synthesis (text-to-speech or TTS) engine that supports the language must be installed. An installed TTS engine is called a voice. To get information about which voices are installed for a specific culture, use the GetInstalledVoices method.

Microsoft Windows and the System.Speech API accept all valid language-country codes as values for culture. The TTS engines that shipped with Windows 7 support the following language-country codes:

  • en-US. English (United States)

  • zh-CN. Chinese (China)

  • zh-TW. Chinese (Taiwan)

Two-letter language codes such as "en" are also permitted.

Applies to