PhonemeReachedEventArgs 類別

定義

PhonemeReached 事件傳回資料。

public ref class PhonemeReachedEventArgs : System::Speech::Synthesis::PromptEventArgs
public class PhonemeReachedEventArgs : System.Speech.Synthesis.PromptEventArgs
type PhonemeReachedEventArgs = class
    inherit PromptEventArgs
Public Class PhonemeReachedEventArgs
Inherits PromptEventArgs
繼承

範例

下列範例是Windows Forms應用程式的一部分,會將事件傳 PhonemeReached 回的資訊寫入文字方塊。 電話是 來自國際語音字母 (IPA) 的字元。

注意

所傳 PhonemeReachedEventArgs 回的第一個和最後一個字元是開頭和結尾字元,這些字元會括住,但不代表構成單字或片語的 phonemes。 本範例會傳回五個字元,但只有中間的三個字元是代表 「theme」 一字的 phonemes:一個用於 「th」 音效、一個用於 「e」 音效,另一個代表 「m」 音效。

using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Linq;  
using System.Text;  
using System.Windows.Forms;  
using System.Speech.Synthesis;  

namespace PhonemeReached  
{  
  public partial class Form1 : Form  
  {  

    public Form1()  
    {  
      InitializeComponent();  
      textBox1.Text = "";  
    }  

    public void button1_Click(object sender, EventArgs e)  
    {  
      // Initialize a new instance of the SpeechSynthesizer.  
      SpeechSynthesizer synth = new SpeechSynthesizer();  

      // Configure the audio output.   
      synth.SetOutputToDefaultAudioDevice();  

      // Register for the PhonemeReached event.  
      synth.PhonemeReached += new EventHandler<PhonemeReachedEventArgs>(synth_PhonemeReached);  

      // Speak the contents of a string.  
      synth.Speak("Theme");  
    }  

    // Write information about each phoneme as it is reached.  
    private void synth_PhonemeReached(object sender, PhonemeReachedEventArgs e)  
    {textBox1.AppendText(string.Format(  

        "  Phoneme reached summary:" + Environment.NewLine +  
        "    Phoneme:                 {0}" + Environment.NewLine +    
        "    Audio Position:         {1} mSec" + Environment.NewLine +  
        "    Duration:                  {2} mSec" + Environment.NewLine +  
        "    Emphasis:                {3}" + Environment.NewLine +  
        "    Next Phoneme:         {4}" + Environment.NewLine + Environment.NewLine,   
        e.Phoneme,  
        e.AudioPosition,  
        e.Duration,  
        e.Emphasis,  
        e.NextPhoneme));  
    }  
  }  
}  

備註

phoneme 是撰寫語言的基本元件。 如需電話訊息的詳細資訊,請參閱 PhonemeReached

屬性

AudioPosition

取得音素的音訊位置。

Cancelled

取得值,指出非同步作業是否已取消。

(繼承來源 AsyncCompletedEventArgs)
Duration

取得音素的持續期間。

Emphasis

取得音素的強調。

Error

取得值,指出非同步作業期間是否發生錯誤。

(繼承來源 AsyncCompletedEventArgs)
NextPhoneme

取得與 PhonemeReached 事件有關之音素後面的音素。

Phoneme

PhonemeReached 事件相關聯的音素。

Prompt

取得與事件相關聯的提示。

(繼承來源 PromptEventArgs)
UserState

取得非同步工作的唯一識別項。

(繼承來源 AsyncCompletedEventArgs)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
RaiseExceptionIfNecessary()

如果非同步作業失敗,引發使用者提供的例外狀況。

(繼承來源 AsyncCompletedEventArgs)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於