Prompt Construtores
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Cria uma nova instância da Prompt classe.
Sobrecargas
| Nome | Descrição |
|---|---|
| Prompt(PromptBuilder) |
Cria uma nova instância da Prompt classe a partir de um PromptBuilder objeto. |
| Prompt(String) |
Cria uma nova instância da Prompt classe e especifica o texto a falar. |
| Prompt(String, SynthesisTextFormat) |
Cria uma nova instância da Prompt classe e especifica o texto a ser falado e se o seu formato é texto simples ou linguagem de marcação. |
Prompt(PromptBuilder)
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
Cria uma nova instância da Prompt classe a partir de um 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
O conteúdo para ser dito.
Aplica-se a
Prompt(String)
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
Cria uma nova instância da Prompt classe e especifica o texto a falar.
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
O texto para ser dito.
Exemplos
O exemplo seguinte cria um Prompt objeto a partir de uma cadeia e passa o objeto como argumento ao 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();
}
}
}
Aplica-se a
Prompt(String, SynthesisTextFormat)
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
- Origem:
- Prompt.cs
Cria uma nova instância da Prompt classe e especifica o texto a ser falado e se o seu formato é texto simples ou linguagem de marcação.
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
O texto para ser dito.
- media
- SynthesisTextFormat
Um valor que especifica o formato do texto.
Exemplos
O exemplo seguinte constrói uma string que contém marcação SSML, cria um Prompt objeto a partir da string e fala o prompt.
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();
}
}
}
Observações
O conteúdo do textToSpeak parâmetro deve incluir um speak elemento e deve estar em conformidade com a Speech Synthesis Markup Language (SSML) Versão 1.0. Para mais informações, consulte Reference de Linguagem de Marcação de Síntese de Voz.