Prompt Costruttori
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Crea una nuova istanza della Prompt classe .
Overload
| Nome | Descrizione |
|---|---|
| Prompt(PromptBuilder) |
Crea una nuova istanza della Prompt classe da un PromptBuilder oggetto . |
| Prompt(String) |
Crea una nuova istanza della Prompt classe e specifica il testo da pronunciare. |
| Prompt(String, SynthesisTextFormat) |
Crea una nuova istanza della Prompt classe e specifica il testo da pronunciare e se il formato è testo normale o linguaggio di markup. |
Prompt(PromptBuilder)
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
Crea una nuova istanza della Prompt classe da un PromptBuilder oggetto .
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)
Parametri
- promptBuilder
- PromptBuilder
Contenuto da pronunciare.
Si applica a
Prompt(String)
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
Crea una nuova istanza della Prompt classe e specifica il testo da pronunciare.
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)
Parametri
- textToSpeak
- String
Testo da pronunciare.
Esempio
Nell'esempio seguente viene creato un Prompt oggetto da una stringa e l'oggetto viene passato come argomento al Speak metodo .
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();
}
}
}
Si applica a
Prompt(String, SynthesisTextFormat)
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
- Origine:
- Prompt.cs
Crea una nuova istanza della Prompt classe e specifica il testo da pronunciare e se il formato è testo normale o linguaggio di markup.
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)
Parametri
- textToSpeak
- String
Testo da pronunciare.
- media
- SynthesisTextFormat
Valore che specifica il formato del testo.
Esempio
Nell'esempio seguente viene compilata una stringa contenente markup SSML, viene creato un Prompt oggetto dalla stringa e viene visualizzata la richiesta.
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();
}
}
}
Commenti
Il contenuto del textToSpeak parametro deve includere un speak elemento e deve essere conforme alla versione 1.0 di Speech Synthesis Markup Language (SSML). Per altre informazioni, vedere Speech Synthesis Markup Language Reference.For more information, see Speech Synthesis Markup Language Reference.