PromptBuilder::AppendTextWithHint Method (String^, SayAs)
.NET Framework (current version)
Appends text to the PromptBuilder object and specifies the content type using a member of the SayAs enumeration.
Assembly: System.Speech (in System.Speech.dll)
Parameters
- textToSpeak
-
Type:
System::String^
A string containing the text to be spoken.
- sayAs
-
Type:
System.Speech.Synthesis::SayAs
The content type of the text.
The content type specified by sayAs can provide guidance to the speech synthesis engine about how to pronounce the contents of textToSpeak.
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 define the data types for some of the added strings. PromptBuilder sayAs = new PromptBuilder(); sayAs.AppendText("Your"); sayAs.AppendTextWithHint("1st", SayAs.NumberOrdinal); sayAs.AppendText("request was for"); sayAs.AppendTextWithHint("1", SayAs.NumberCardinal); sayAs.AppendText("room, on"); sayAs.AppendTextWithHint("10/19/2012,", SayAs.MonthDayYear); sayAs.AppendText("with early arrival at"); sayAs.AppendTextWithHint("12:35pm", SayAs.Time12); // Speak the contents of the SSML prompt. synth.Speak(sayAs); } Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } }
.NET Framework
Available since 3.0
Available since 3.0
Show: