SpeakProgressEventArgs.Text プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
イベントが発生したときに読み上げられたテキスト。
public:
property System::String ^ Text { System::String ^ get(); };
public string Text { get; }
member this.Text : string
Public ReadOnly Property Text As String
プロパティ値
イベントが発生したときに読み上げられたテキストを返します。
例
次の例は、 SpeakProgress イベントが数値を含む文字列の CharacterPosition プロパティと Text プロパティを報告する方法を示しています。
using System;
using System.Xml;
using System.IO;
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 an XML Reader from the file, create a PromptBuilder and
// append the XmlReader.
PromptBuilder builder = new PromptBuilder();
builder.AppendText("4003");
// Add a handler for the SpeakProgress event.
synth.SpeakProgress +=
new EventHandler<SpeakProgressEventArgs>(synth_SpeakProgress);
// Speak the prompt and play back the output file.
synth.Speak(builder);
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
// Write each word and its character position to the console.
static void synth_SpeakProgress(object sender, SpeakProgressEventArgs e)
{
Console.WriteLine("Speak progress - Character position: {0} Text: {1}",
e.CharacterPosition, e.Text);
}
}
}
注釈
SpeechSynthesizerは、数値の読み上げ方法に対応する単語に数値を正規化します。 たとえば、シンセサイザーは「4003」という数字を「4,003」と読み上げます。 各話し言葉に対して SpeakProgress イベントが発生します。 ただし、3 つの単語のそれぞれに対する Text プロパティは同じです。 プロンプトからのテキスト "4003" です。