Comparteix a través de


PromptStyle Constructors

Definition

Initializes a new instance of the PromptStyle class.

Overloads

PromptStyle()

Initializes a new instance of the PromptStyle class.

PromptStyle(PromptEmphasis)

Initializes a new instance of the PromptStyle class and specifies the setting for the emphasis of the style.

PromptStyle(PromptRate)

Initializes a new instance of the PromptStyle class and specifies the setting for the speaking rate of the style.

PromptStyle(PromptVolume)

Initializes a new instance of the PromptStyle class and specifies the setting for the speaking volume of the style.

PromptStyle()

Source:
PromptStyle.cs
Source:
PromptStyle.cs
Source:
PromptStyle.cs

Initializes a new instance of the PromptStyle class.

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

Applies to

PromptStyle(PromptEmphasis)

Source:
PromptStyle.cs
Source:
PromptStyle.cs
Source:
PromptStyle.cs

Initializes a new instance of the PromptStyle class and specifies the setting for the emphasis of the style.

public:
 PromptStyle(System::Speech::Synthesis::PromptEmphasis emphasis);
public PromptStyle (System.Speech.Synthesis.PromptEmphasis emphasis);
new System.Speech.Synthesis.PromptStyle : System.Speech.Synthesis.PromptEmphasis -> System.Speech.Synthesis.PromptStyle
Public Sub New (emphasis As PromptEmphasis)

Parameters

emphasis
PromptEmphasis

The setting for the emphasis of the style.

Remarks

The speech synthesis engines in Windows do not support variations in the emphasis of speech output at this time. Setting values for emphasis using a member of the PromptEmphasis enumeration will produce no audible change in the synthesized speech output.

Applies to

PromptStyle(PromptRate)

Source:
PromptStyle.cs
Source:
PromptStyle.cs
Source:
PromptStyle.cs

Initializes a new instance of the PromptStyle class and specifies the setting for the speaking rate of the style.

public:
 PromptStyle(System::Speech::Synthesis::PromptRate rate);
public PromptStyle (System.Speech.Synthesis.PromptRate rate);
new System.Speech.Synthesis.PromptStyle : System.Speech.Synthesis.PromptRate -> System.Speech.Synthesis.PromptStyle
Public Sub New (rate As PromptRate)

Parameters

rate
PromptRate

The setting for the speaking rate of the style.

Examples

The following example creates a PromptBuilder object and appends text strings. The example uses the PromptStyle constructor as an argument to 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();  
    }  
  }  
}  

Applies to

PromptStyle(PromptVolume)

Source:
PromptStyle.cs
Source:
PromptStyle.cs
Source:
PromptStyle.cs

Initializes a new instance of the PromptStyle class and specifies the setting for the speaking volume of the style.

public:
 PromptStyle(System::Speech::Synthesis::PromptVolume volume);
public PromptStyle (System.Speech.Synthesis.PromptVolume volume);
new System.Speech.Synthesis.PromptStyle : System.Speech.Synthesis.PromptVolume -> System.Speech.Synthesis.PromptStyle
Public Sub New (volume As PromptVolume)

Parameters

volume
PromptVolume

The setting for the volume (loudness) of the style.

Examples

The following example uses the PromptStyle constructor to specify volume settings that the SpeechSynthesizer should apply to speech output.

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();  

        // Build a prompt that applies different volume settings.  
        PromptBuilder builder = new PromptBuilder();  
        builder.StartStyle(new PromptStyle(PromptVolume.Default));  
        builder.AppendText("This is the default speaking volume.");  
        builder.EndStyle();  
        builder.AppendBreak();  
        builder.StartStyle(new PromptStyle(PromptVolume.ExtraLoud));  
        builder.AppendText("This is the extra-loud speaking volume.");  
        builder.EndStyle();  
        builder.AppendBreak();  
        builder.StartStyle(new PromptStyle(PromptVolume.Medium));  
        builder.AppendText("This is the medium speaking volume.");  
        builder.EndStyle();  

        // Speak the prompt.  
        synth.Speak(builder);  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

Remarks

The Default setting for PromptVolume is full volume, which is the same as ExtraLoud. The other settings decrease the volume of speech output relative to full volume.

See also

Applies to