Prompt Konstruktor
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Membuat instans Prompt baru kelas.
Overload
| Nama | Deskripsi |
|---|---|
| Prompt(PromptBuilder) |
Membuat instans Prompt baru kelas dari PromptBuilder objek. |
| Prompt(String) |
Membuat instans Prompt baru kelas dan menentukan teks yang akan diucapkan. |
| Prompt(String, SynthesisTextFormat) |
Membuat instans Prompt baru kelas dan menentukan teks yang akan diucapkan dan apakah formatnya adalah teks biasa atau bahasa markup. |
Prompt(PromptBuilder)
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
Membuat instans Prompt baru kelas dari PromptBuilder objek.
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)
Parameter
- promptBuilder
- PromptBuilder
Konten yang akan diucapkan.
Berlaku untuk
Prompt(String)
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
Membuat instans Prompt baru kelas dan menentukan teks yang akan diucapkan.
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)
Parameter
- textToSpeak
- String
Teks yang akan diucapkan.
Contoh
Contoh berikut membuat Prompt objek dari string dan meneruskan objek sebagai argumen ke Speak metode .
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();
}
}
}
Berlaku untuk
Prompt(String, SynthesisTextFormat)
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
- Sumber:
- Prompt.cs
Membuat instans Prompt baru kelas dan menentukan teks yang akan diucapkan dan apakah formatnya adalah teks biasa atau bahasa 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)
Parameter
- textToSpeak
- String
Teks yang akan diucapkan.
- media
- SynthesisTextFormat
Nilai yang menentukan format teks.
Contoh
Contoh berikut membangun string yang berisi markup SSML, membuat Prompt objek dari string, dan mengucapkan perintah.
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();
}
}
}
Keterangan
Konten textToSpeak parameter harus menyertakan speak elemen dan harus sesuai dengan Speech Synthesis Markup Language (SSML) Versi 1.0.