SpeechEventInfo.Param2 속성

정의

현재 인스턴스가 요청에 사용되는 이벤트를 생성하기 위해 Speech 플랫폼에 전달될 개체를 참조하는 인스턴스(param2생성자)SpeechEventInfo를 가져오고 설정합니다System.IntPtr.

public:
 property IntPtr Param2 { IntPtr get(); };
public IntPtr Param2 { get; }
member this.Param2 : nativeint
Public ReadOnly Property Param2 As IntPtr

속성 값

IntPtr

nativeint

System.IntPtr 현재 인스턴스 SpeechEventInfo 에서 지정한 이벤트가 생성될 때 Speech 플랫폼에 전달할 개체를 참조하는 값을 반환합니다.

예제

아래 예제는 상속되는 TtsEngineSsml사용자 지정 음성 합성 구현의 일부이며 TextFragment, SpeechEventInfoFragmentState, 및TtsEventId

의 구현 Speak

  1. 인스턴스 배열 TextFragment 을 수신하고 기본 합성 엔진의 TextFragment 메서드에 전달할 Speak 새 인스턴스 배열을 만듭니다.

  2. 각 인스턴스의 TtsEngineAction 속성에서 반환 State 된 속성 FragmentState 에서 Action 찾은 열거형 값이 Speak있는 TextFragment 경우 구현

    • 미국주의를 번역할 텍스트에서 영국주의로 번역합니다.

    • EventInterest 구현에 제공된 인터페이스의 ITtsEngineSite 속성이 이벤트 유형을 SpeechEventInfo 지원하는 WordBoundary 경우 인스턴스를 사용하여 신시사이저 진행률 측정기를 구동하는 이벤트를 만듭니다.

      포함 Param2 에 대한 SpeechEventInfo매개 변수는 메서드를 통해 LogSpeechEvent 생성된 이벤트를 기록하는 데 사용됩니다.

  3. 그런 다음 수정된 TextFragment 배열을 사용하여 음성 렌더링 엔진을 호출합니다.

private const int WordBoundaryFlag = 1 << (int)TtsEventId.WordBoundary;
private readonly char[] spaces = new char[] { ' ', '\t', '\r', '\n' };
internal struct UsVsUk
{
  internal string UK;
  internal string US;
}

override public void Speak (TextFragment [] frags, IntPtr wfx, ITtsEngineSite site)
{
  TextFragment [] newFrags=new TextFragment[frags.Length];

  for (int i=0;i<frags.Length;i++){
    newFrags[i].State=frags[i].State;
    //truncate
    newFrags[i].TextToSpeak = frags[i].TextToSpeak.Substring(frags[i].TextOffset,
                               frags[i].TextLength);
    newFrags[i].TextLength = newFrags[i].TextToSpeak.Length;
    newFrags[i].TextOffset = 0;
    if (newFrags[i].State.Action == TtsEngineAction.Speak) {
      //Us to UK conversion
      foreach (UsVsUk term in TransList) {
      newFrags[i].TextToSpeak.Replace(term.US, term.UK);
      }
      //Generate progress meter events if supported
      if ((site.EventInterest & WordBoundaryFlag) != 0) {
      string[] subs = newFrags[i].TextToSpeak.Split(spaces);

      foreach (string s in subs) {
        int offset = newFrags[i].TextOffset;
        SpeechEventInfo spEvent = new SpeechEventInfo((Int16)TtsEventId.WordBoundary,
                (Int16)EventParameterType.Undefined,
                 s.Length, new IntPtr(offset));
         LogSpeechEvent(spEvent.EventId,
                        spEvent.ParameterType,
                        spEvent.Param1,
                        spEvent.Param2);
        offset += s.Length;
        if (s.Trim().Length > 0) {
          SpeechEventInfo[] events = new SpeechEventInfo[1];
          events[0] = spEvent;
          site.AddEvents(events, 1);
        }
      }
      }
    }
  }

  _baseSynthesize.Speak(newFrags, wfx, site);

}

설명

속성 참조에 대한 System.IntPtr 요구 사항은 인스턴스의 값 및 ParameterType 속성 SpeechEventInfoEventId 따라 고유하게 결정됩니다.Param2SpeechEventInfo

사용 Param2방법에 대한 자세한 내용은 설명서를 EventId참조하세요.

적용 대상