Prompt Konstruktory

Definice

Vytvoří novou instanci třídy Prompt.

Přetížení

Prompt(PromptBuilder)

Vytvoří novou instanci Prompt třídy z objektu PromptBuilder .

Prompt(String)

Vytvoří novou instanci Prompt třídy a určuje text, který se má vyslovovat.

Prompt(String, SynthesisTextFormat)

Vytvoří novou instanci Prompt třídy a určuje text, který se má vyslovovat, a zda je jeho formát prostý text nebo jazyk značky.

Prompt(PromptBuilder)

Zdroj:
Prompt.cs
Zdroj:
Prompt.cs
Zdroj:
Prompt.cs

Vytvoří novou instanci Prompt třídy z objektu PromptBuilder .

public:
 Prompt(System::Speech::Synthesis::PromptBuilder ^ promptBuilder);
public Prompt (System.Speech.Synthesis.PromptBuilder promptBuilder);
new System.Speech.Synthesis.Prompt : System.Speech.Synthesis.PromptBuilder -> System.Speech.Synthesis.Prompt
Public Sub New (promptBuilder As PromptBuilder)

Parametry

promptBuilder
PromptBuilder

Obsah, který se má vyslovit.

Platí pro

Prompt(String)

Zdroj:
Prompt.cs
Zdroj:
Prompt.cs
Zdroj:
Prompt.cs

Vytvoří novou instanci Prompt třídy a určuje text, který se má vyslovovat.

public:
 Prompt(System::String ^ textToSpeak);
public Prompt (string textToSpeak);
new System.Speech.Synthesis.Prompt : string -> System.Speech.Synthesis.Prompt
Public Sub New (textToSpeak As String)

Parametry

textToSpeak
String

Text, který se má vyslovit.

Příklady

Následující příklad vytvoří Prompt objekt z řetězce a předá objekt jako argument Speak metodě.

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 prompt from a string.  
        Prompt color = new Prompt("What is your favorite color?");  

        // Speak the contents of the prompt synchronously.  
        synth.Speak(color);  
      }  

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

Platí pro

Prompt(String, SynthesisTextFormat)

Zdroj:
Prompt.cs
Zdroj:
Prompt.cs
Zdroj:
Prompt.cs

Vytvoří novou instanci Prompt třídy a určuje text, který se má vyslovovat, a zda je jeho formát prostý text nebo jazyk značky.

public:
 Prompt(System::String ^ textToSpeak, System::Speech::Synthesis::SynthesisTextFormat media);
public Prompt (string textToSpeak, System.Speech.Synthesis.SynthesisTextFormat media);
new System.Speech.Synthesis.Prompt : string * System.Speech.Synthesis.SynthesisTextFormat -> System.Speech.Synthesis.Prompt
Public Sub New (textToSpeak As String, media As SynthesisTextFormat)

Parametry

textToSpeak
String

Text, který se má vyslovit.

media
SynthesisTextFormat

Hodnota, která určuje formát textu.

Příklady

Následující příklad sestaví řetězec, který obsahuje značky SSML, vytvoří Prompt objekt z řetězce a vysloví výzvu.

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 an SSML prompt in a string.  
        string fileName = "<speak version=\"1.0\" ";  
        fileName += "xmlns=\"http://www.w3.org/2001/10/synthesis\" ";  
        fileName += "xml:lang=\"en-US\">";  
        fileName += "Say a name for the new file <mark name=\"fileName\" />.";  
        fileName += "</speak>";  

        // Create a Prompt object from the string.  
        Prompt ssmlFile = new Prompt(fileName, SynthesisTextFormat.Ssml);  

        // Speak the contents of the SSML prompt.  
        synth.Speak(ssmlFile);  
      }  

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

Poznámky

Obsah parametru textToSpeak musí obsahovat speak prvek a musí odpovídat jazyku SSML (Speech Synthesis Markup Language) verze 1.0. Další informace najdete v tématu Referenční informace k jazyku pro revize syntézy řeči.

Platí pro