PhonemeReachedEventArgs PhonemeReachedEventArgs PhonemeReachedEventArgs PhonemeReachedEventArgs Class

定義

PhonemeReached 事件傳回資料。Returns data from the PhonemeReached event.

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事件傳回的資訊寫入文字方塊。The following example is part of a Windows Forms application that writes the information returned by the PhonemeReached event to a text box. 音素是國際拼音字母 (.ipa)中的字元。The phonemes are characters from the International Phonetic Alphabet (IPA).

注意

所傳回PhonemeReachedEventArgs的第一個和最後一個字元是開頭和結尾字元, 它們會括住, 但不代表構成單字或片語的音素。The first and last characters returned by PhonemeReachedEventArgs are opening and closing characters that enclose but do not represent phonemes that constitute a word or phrase. 這個範例會傳回五個字元, 但只會音素中間三個字元, 代表 "主題" 這個字: 一個用於 "th" 音效, 一個用於 "e" 音效, 另一個用於 "m" 音效。This example returns five characters, but only the middle three characters are phonemes that represent the word "theme": one for the "th" sound, one for the "e" sound, and one for the "m" sound .

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));  
    }  
  }  
}  

備註

音素是撰寫語言的基本元件。A phoneme is a basic component of written language. 如需音素的詳細資訊, PhonemeReached請參閱。For more information about phonemes, see PhonemeReached.

屬性

AudioPosition AudioPosition AudioPosition AudioPosition

取得音素的音訊位置。Gets the audio position of the phoneme.

Cancelled Cancelled Cancelled Cancelled

取得值,指出非同步作業是否已取消。Gets a value indicating whether an asynchronous operation has been canceled.

(Inherited from AsyncCompletedEventArgs)
Duration Duration Duration Duration

取得音素的持續期間。Gets the duration of the phoneme.

Emphasis Emphasis Emphasis Emphasis

取得音素的強調。Gets the emphasis of the phoneme.

Error Error Error Error

取得值,指出非同步作業期間是否發生錯誤。Gets a value indicating which error occurred during an asynchronous operation.

(Inherited from AsyncCompletedEventArgs)
NextPhoneme NextPhoneme NextPhoneme NextPhoneme

取得與 PhonemeReached 事件有關之音素後面的音素。Gets the phoneme following the phoneme associated with the PhonemeReached event.

Phoneme Phoneme Phoneme Phoneme

PhonemeReached 事件相關聯的音素。The phoneme associated with the PhonemeReached event.

Prompt Prompt Prompt Prompt

取得與事件相關聯的提示。Gets the prompt associated with the event.

(Inherited from PromptEventArgs)
UserState UserState UserState UserState

取得非同步工作的唯一識別項。Gets the unique identifier for the asynchronous task.

(Inherited from AsyncCompletedEventArgs)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary()

如果非同步作業失敗,引發使用者提供的例外狀況。Raises a user-supplied exception if an asynchronous operation failed.

(Inherited from AsyncCompletedEventArgs)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於