共用方式為


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 輸入則為 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);  
    }  
  }  
}  

備註

若要設定音訊輸入,請使用下列其中一種方法:

適用於

另請參閱