Język

Prompt Konstruktory

Definicja

Tworzy nowe wystąpienie Prompt klasy.

Przeciążenia

Nazwa Opis
Prompt(PromptBuilder)

Tworzy nowe wystąpienie Prompt klasy na podstawie PromptBuilder obiektu.

Prompt(String)

Tworzy nowe wystąpienie Prompt klasy i określa tekst, który ma być wypowiadany.

Prompt(String, SynthesisTextFormat)

Tworzy nowe wystąpienie Prompt klasy i określa tekst, który ma być mówiony i czy jego format to zwykły tekst, czy język znaczników.

Prompt(PromptBuilder)

Źródło:
Prompt.cs
Źródło:
Prompt.cs
Źródło:
Prompt.cs
Źródło:
Prompt.cs

Tworzy nowe wystąpienie Prompt klasy na podstawie PromptBuilder obiektu.

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

Zawartość, która ma być wypowiadana.

Dotyczy

Prompt(String)

Źródło:
Prompt.cs
Źródło:
Prompt.cs
Źródło:
Prompt.cs
Źródło:
Prompt.cs

Tworzy nowe wystąpienie Prompt klasy i określa tekst, który ma być wypowiadany.

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

Tekst, który ma być wypowiadany.

Przykłady

Poniższy przykład tworzy Prompt obiekt na podstawie ciągu i przekazuje obiekt jako argument do Speak metody .

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

Dotyczy

Prompt(String, SynthesisTextFormat)

Źródło:
Prompt.cs
Źródło:
Prompt.cs
Źródło:
Prompt.cs
Źródło:
Prompt.cs

Tworzy nowe wystąpienie Prompt klasy i określa tekst, który ma być mówiony i czy jego format to zwykły tekst, czy język znaczników.

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

Tekst, który ma być wypowiadany.

media
SynthesisTextFormat

Wartość określająca format tekstu.

Przykłady

Poniższy przykład tworzy ciąg zawierający adiustację SSML, tworzy Prompt obiekt na podstawie ciągu i mówi o wierszu polecenia.

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

Uwagi

Zawartość parametru textToSpeak musi zawierać element i musi być zgodna z językiem speakznaczników syntezy mowy (SSML) w wersji 1.0. Aby uzyskać więcej informacji, zobacz Speech Synthesis Markup Language Reference (Dokumentacja języka znaczników syntezy mowy).

Dotyczy