PromptBuilder::StartStyle Method (PromptStyle^)
Specifies the start of a style in the PromptBuilder object.
Assembly: System.Speech (in System.Speech.dll)
Parameters
- style
-
Type:
System.Speech.Synthesis::PromptStyle^
The style to start.
The StartStyle method takes a PromptStyle object as its argument. You can use the properties of the PromptStyle object to set the emphasis, speaking rate, and volume (loudness) to apply to speech output while the style is in effect. To stop using the current style, call the EndStyle method.
Note |
|---|
|
The following example creates a PromptBuilder object and appends text strings. The example uses the StartStyle method to specify a slow speaking rate for the string being added, which enumerates the contents of an order.
using System; using System.Speech.Synthesis; namespace SampleSynthesis { class Program { static void Main(string[] args) { // Initialize a new instance of the SpeechSynthesizer. using (SpeechSynthesizer synth = new SpeechSynthesizer()) { // Configure the audio output. synth.SetOutputToDefaultAudioDevice(); // Create a PromptBuilder object and add content. PromptBuilder style = new PromptBuilder(); style.AppendText("Your order for"); style.StartStyle(new PromptStyle(PromptRate.Slow)); style.AppendText("one kitchen sink and one faucet"); style.EndStyle(); style.AppendText("has been confirmed."); // Speak the contents of the SSML prompt. synth.Speak(style); } Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } }
Available since 3.0
