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