PromptStyle Konstruktorer

Definition

Initierar en ny instans av PromptStyle klassen.

Överlagringar

Name Description
PromptStyle()

Initierar en ny instans av PromptStyle klassen.

PromptStyle(PromptEmphasis)

Initierar en ny instans av PromptStyle klassen och anger inställningen för stilens betoning.

PromptStyle(PromptRate)

Initierar en ny instans av PromptStyle klassen och anger inställningen för talhastigheten för formatet.

PromptStyle(PromptVolume)

Initierar en ny instans av PromptStyle klassen och anger inställningen för formatmallens talvolym.

PromptStyle()

Initierar en ny instans av PromptStyle klassen.

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

Gäller för

PromptStyle(PromptEmphasis)

Initierar en ny instans av PromptStyle klassen och anger inställningen för stilens betoning.

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)

Parametrar

emphasis
PromptEmphasis

Inställningen för stilens betoning.

Kommentarer

Talsyntesmotorerna i Windows stöder inte variationer i betoningen av talutdata just nu. Om du anger värden för betoning med hjälp av en medlem i PromptEmphasis uppräkningen genereras ingen hörbar ändring i talutdata som syntetiserats.

Gäller för

PromptStyle(PromptRate)

Initierar en ny instans av PromptStyle klassen och anger inställningen för talhastigheten för formatet.

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)

Parametrar

rate
PromptRate

Inställningen för talhastigheten för formatet.

Exempel

I följande exempel skapas ett PromptBuilder objekt och textsträngar läggs till. I exemplet används PromptStyle konstruktorn som ett argument till StartStyle metoden för att ange en långsam talfrekvens för strängen som läggs till, vilket räknar upp innehållet i en 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();
    }
  }
}

Gäller för

PromptStyle(PromptVolume)

Initierar en ny instans av PromptStyle klassen och anger inställningen för formatmallens talvolym.

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)

Parametrar

volume
PromptVolume

Inställningen för volymen (ljudvolymen) för formatet.

Exempel

I följande exempel används PromptStyle konstruktorn för att ange volyminställningar som SpeechSynthesizer ska gälla för talutdata.

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

Kommentarer

Inställningen Default för PromptVolume är full volym, vilket är samma som ExtraLoud. De andra inställningarna minskar volymen av talutdata i förhållande till full volym.

Se även

Gäller för