다음을 통해 공유


SpeakProgressEventArgs.Text 속성

정의

이벤트가 발생했을 때 방금 말한 텍스트입니다.

public:
 property System::String ^ Text { System::String ^ get(); };
public string Text { get; }
member this.Text : string
Public ReadOnly Property Text As String

속성 값

이벤트가 발생했을 때 방금 말한 텍스트를 반환합니다.

예제

다음 예제에서는 이벤트가 숫자를 포함하는 문자열에 CharacterPosition 대한 속성 및 Text 보고서를 보고하는 방법을 SpeakProgress 보여 줍니다.

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 . 그러나 Text 세 단어 각각에 대한 속성은 동일합니다. 프롬프트의 텍스트 "4003"입니다.

적용 대상