當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Arduino ArduinoSound - AudioInI2S.channels()用法及代碼示例

說明

查詢I2S輸入的通道數

用法

AudioInI2S.channels();

返回

I2S 接口的當前通道數。這總是返回 2,因為 I2S 配置為立體聲

示例


  // setup the I2S audio input for 44.1 kHz with 32-bits per sample
  if (!AudioInI2S.begin(44100, 32)) {
    Serial.println("Failed to initialize I2S input!");
    while (1); // do nothing
  }

  Serial.print(“sample rate = “);
  Serial.println(AudioInI2S.sampleRate()); // prints out the sample rate used in begin(...)
  Serial.print(“bit per sample = “);
  Serial.println(AudioInI2S.bitsPerSample()); // prints out the bits per sample rate used  in begin(...)
  Serial.print(“channels = “);
  Serial.println(AudioInI2S.channels()); // prints out 2, I2S always has 2 channels

相關用法


注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 ArduinoSound - AudioInI2S.channels()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。