Share via


BookmarkReachedEventArgs 클래스

정의

BookmarkReached 이벤트에서 데이터를 반환합니다.

public ref class BookmarkReachedEventArgs : System::Speech::Synthesis::PromptEventArgs
public class BookmarkReachedEventArgs : System.Speech.Synthesis.PromptEventArgs
type BookmarkReachedEventArgs = class
    inherit PromptEventArgs
Public Class BookmarkReachedEventArgs
Inherits PromptEventArgs
상속

예제

다음 예제에서는 두 개의 책갈피를 포함하는 프롬프트를 만들고 재생을 위해 출력을 WAV 파일로 보냅니다. 이벤트 처리기는 BookmarkReached 이벤트가 콘솔에 발생할 때 책갈피의 이름과 해당 위치를 오디오 스트림에 씁니다.

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.SetOutputToWaveFile(@"C:\test\weather.wav");  

        // Create a SoundPlayer instance to play the output audio file.  
        System.Media.SoundPlayer m_SoundPlayer =  
          new System.Media.SoundPlayer(@"C:\test\weather.wav");  

        // Build a prompt and append bookmarks.  
        PromptBuilder builder = new PromptBuilder(  
          new System.Globalization.CultureInfo("en-US"));  
        builder.AppendText(  
          "The weather forecast for today is partly cloudy with some sun breaks.");  
        builder.AppendBookmark("Daytime forecast");  
        builder.AppendText(  
          "Tonight's weather will be cloudy with a 30% chance of showers.");  
        builder.AppendBookmark("Nighttime forecast");  

        // Add a handler for the BookmarkReached event.  
        synth.BookmarkReached +=  
          new EventHandler<BookmarkReachedEventArgs>(synth_BookmarkReached);  

        // Speak the prompt and play back the output file.  
        synth.Speak(builder);  
        m_SoundPlayer.Play();  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  

    // Write the name and position of the bookmark to the console.  
    static void synth_BookmarkReached(object sender, BookmarkReachedEventArgs e)  
    {  
      Console.WriteLine("Bookmark ({0}) reached at: {1} ",  
        e.Bookmark, e.AudioPosition);  
    }  
  }  
}  

설명

인스턴스의 BookmarkReachedEventArgs 때 생성 되는 SpeechSynthesizer 발생 시키는 개체를 BookmarkReached 이벤트입니다. 는 SpeechSynthesizer , , SpeakAsyncSpeakSsml또는 SpeakSsmlAsync 메서드를 처리하는 동안 책갈피가 Speak발견되면 이벤트를 발생 BookmarkReached 합니다. 이벤트를 트리거한 책갈피의 이름과 위치를 가져오려면 이벤트 처리기의 및 AudioPosition 속성에 액세스 Bookmark 합니다.

속성

AudioPosition

책갈피가 도착한 타임 오프셋을 가져옵니다.

Bookmark

도달한 책갈피의 이름을 가져옵니다.

Cancelled

비동기 작업이 취소되었는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 AsyncCompletedEventArgs)
Error

비동기 작업 중 발생한 오류를 나타내는 값을 가져옵니다.

(다음에서 상속됨 AsyncCompletedEventArgs)
Prompt

이벤트와 관련된 프롬프트를 가져옵니다.

(다음에서 상속됨 PromptEventArgs)
UserState

비동기 작업의 고유 식별자를 가져옵니다.

(다음에서 상속됨 AsyncCompletedEventArgs)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
RaiseExceptionIfNecessary()

비동기 작업에 실패한 경우 사용자가 제공한 예외를 발생시킵니다.

(다음에서 상속됨 AsyncCompletedEventArgs)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보