Prompt Constructores

Definición

Crea una nueva instancia de la Prompt clase .

Sobrecargas

Nombre Description
Prompt(PromptBuilder)

Crea una nueva instancia de la Prompt clase a partir de un PromptBuilder objeto .

Prompt(String)

Crea una nueva instancia de la Prompt clase y especifica el texto que se va a hablar.

Prompt(String, SynthesisTextFormat)

Crea una nueva instancia de la Prompt clase y especifica el texto que se va a hablar y si su formato es texto sin formato o lenguaje de marcado.

Prompt(PromptBuilder)

Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs

Crea una nueva instancia de la Prompt clase a partir de un PromptBuilder objeto .

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)

Parámetros

promptBuilder
PromptBuilder

Contenido que se va a hablar.

Se aplica a

Prompt(String)

Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs

Crea una nueva instancia de la Prompt clase y especifica el texto que se va a hablar.

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)

Parámetros

textToSpeak
String

Texto que se va a decir.

Ejemplos

En el ejemplo siguiente se crea un Prompt objeto a partir de una cadena y se pasa el objeto como argumento al Speak método .

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

Se aplica a

Prompt(String, SynthesisTextFormat)

Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs

Crea una nueva instancia de la Prompt clase y especifica el texto que se va a hablar y si su formato es texto sin formato o lenguaje de marcado.

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)

Parámetros

textToSpeak
String

Texto que se va a decir.

media
SynthesisTextFormat

Valor que especifica el formato del texto.

Ejemplos

En el ejemplo siguiente se compila una cadena que contiene el marcado SSML, se crea un Prompt objeto a partir de la cadena y se habla el símbolo del sistema.

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

Comentarios

El contenido del textToSpeak parámetro debe incluir un speak elemento y debe ajustarse a la versión 1.0 del lenguaje de marcado de síntesis de voz (SSML).

Se aplica a