PromptBuilder::AppendText Method (String^)
.NET Framework (current version)
Specifies text to append to the PromptBuilder object.
Assembly: System.Speech (in System.Speech.dll)
Parameters
- textToSpeak
-
Type:
System::String^
A string containing the text to be spoken.
To append text that is formatted as SSML markup language, use AppendSsmlMarkup.
The example that follows creates a PromptBuilder object and appends a text string using the AppendText method.
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 PromptBuilder object and append a text string. PromptBuilder speakText = new PromptBuilder(); speakText.AppendText("Say the name of the song you want to hear"); // Speak the contents of the prompt. synth.Speak(speakText); } Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } }
.NET Framework
Available since 3.0
Available since 3.0
Show: