PhonemeReachedEventArgs 类
定义
从 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 窗体应用程序的一部分,该应用程序将事件返回的信息写入 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 |
获取音素的音频位置。Gets the audio position of the phoneme. |
| Cancelled |
获取一个值,该值指示异步操作是否已被取消。Gets a value indicating whether an asynchronous operation has been canceled. (继承自 AsyncCompletedEventArgs) |
| Duration |
获取音素的持续时间。Gets the duration of the phoneme. |
| Emphasis |
获取音素的强调。Gets the emphasis of the phoneme. |
| Error |
获取一个值,该值指示异步操作期间发生的错误。Gets a value indicating which error occurred during an asynchronous operation. (继承自 AsyncCompletedEventArgs) |
| NextPhoneme |
获取 PhonemeReached 事件所关联音素随后的音素。Gets the phoneme following the phoneme associated with the PhonemeReached event. |
| Phoneme |
PhonemeReached 事件所关联的音素。The phoneme associated with the PhonemeReached event. |
| Prompt |
获取与事件关联的提示。Gets the prompt associated with the event. (继承自 PromptEventArgs) |
| UserState |
获取异步任务的唯一标识符。Gets the unique identifier for the asynchronous task. (继承自 AsyncCompletedEventArgs) |
方法
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| RaiseExceptionIfNecessary() |
如果异步操作失败,则引发用户提供的异常。Raises a user-supplied exception if an asynchronous operation failed. (继承自 AsyncCompletedEventArgs) |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |