RecognizerInfo.SupportedAudioFormats 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 SpeechRecognizer 或 SpeechRecognitionEngine 实例支持的音频格式。
public:
property System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::AudioFormat::SpeechAudioFormatInfo ^> ^ SupportedAudioFormats { System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::AudioFormat::SpeechAudioFormatInfo ^> ^ get(); };
public System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.AudioFormat.SpeechAudioFormatInfo> SupportedAudioFormats { get; }
member this.SupportedAudioFormats : System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.AudioFormat.SpeechAudioFormatInfo>
Public ReadOnly Property SupportedAudioFormats As ReadOnlyCollection(Of SpeechAudioFormatInfo)
属性值
返回给定 SpeechRecognizer 或 SpeechRecognitionEngine 实例支持的音频格式列表。
示例
以下示例实现按钮单击,该按钮显示实例中的所有 RecognizerInfo 信息。 该示例使用 SupportedAudioFormats 属性获取识别引擎配置支持的编码格式,然后在 中 MessageBox显示它。
private void recognizerInfoButton_Click(object sender, EventArgs e)
{
RecognizerInfo info = _recognizer.RecognizerInfo;
string AudioFormats = "";
foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats)
{
AudioFormats += String.Format(" {0}\n", fmt.EncodingFormat.ToString());
}
string AdditionalInfo = "";
foreach (string key in info.AdditionalInfo.Keys)
{
AdditionalInfo += String.Format(" {0}: {1}\n", key, info.AdditionalInfo[key]);
}
MessageBox.Show(String.Format(
"Name: {0 }\n" +
"Description: {1} \n" +
"SupportedAudioFormats:\n" +
"{2} " +
"Culture: {3} \n" +
"AdditionalInfo: \n" +
" {4}\n",
info.Name.ToString(),
info.Description.ToString(),
AudioFormats,
info.Culture.ToString(),
AdditionalInfo));
}