SpeechRecognitionEngine.AudioFormat 属性

定义

获取 SpeechRecognitionEngine 接收的音频格式。

public:
 property System::Speech::AudioFormat::SpeechAudioFormatInfo ^ AudioFormat { System::Speech::AudioFormat::SpeechAudioFormatInfo ^ get(); };
public System.Speech.AudioFormat.SpeechAudioFormatInfo AudioFormat { get; }
member this.AudioFormat : System.Speech.AudioFormat.SpeechAudioFormatInfo
Public ReadOnly Property AudioFormat As SpeechAudioFormatInfo

属性值

音频格式于实例 SpeechRecognitionEngine 输入或 null ,如果输入不配置或设置为无效输入。

示例

下面的示例使用 AudioFormat 获取和显示音频格式数据。

static void DisplayAudioDeviceFormat(Label label, SpeechRecognitionEngine recognitionEngine)   
{  

  if (recognitionEngine != null && label != null)   
  {  
    label.Text = String.Format("Encoding Format:         {0}\n" +  
          "AverageBytesPerSecond    {1}\n" +  
          "BitsPerSample            {2}\n" +  
          "BlockAlign               {3}\n" +  
          "ChannelCount             {4}\n" +  
          "SamplesPerSecond         {5}",  
          recognitionEngine.AudioFormat.EncodingFormat.ToString(),  
          recognitionEngine.AudioFormat.AverageBytesPerSecond,  
          recognitionEngine.AudioFormat.BitsPerSample,  
          recognitionEngine.AudioFormat.BlockAlign,  
          recognitionEngine.AudioFormat.ChannelCount,  
          recognitionEngine.AudioFormat.SamplesPerSecond);  
    }  
  }  
}  

注解

若要配置音频输入,请使用以下方法之一:

适用于

另请参阅