丌的BSP其實內建很多小的測試程式,可以拿來加以運用.
在/opt/vc/src/hello_pi路徑下有許多程式可以編譯來測試喔!
買回來後一直沒有去測試音效是否正常!!!!現在來測試看看,順便記錄一下!

pi@JasonLinPi /opt/vc/src/hello_pi/libs/ilclient $ make
執行先編譯出lib.
pi@JasonLinPi /opt/vc/src/hello_pi/hello_audio $ make
編譯出執行測試程式.

如何執行?
看一下 audio.c 檔案...
int main (int argc, char **argv)
{
   // 0=headphones, 1=hdmi
   int audio_dest = 0;
   // audio sample rate in Hz
   int samplerate = 48000;
   // numnber of audio channels
   int channels = 2;
   // number of bits per sample
   int bitdepth = 16;
   bcm_host_init();

   if (argc > 1)
      audio_dest = atoi(argv[1]);
   if (argc > 2)
      channels = atoi(argv[2]);
   if (argc > 3)
      samplerate = atoi(argv[3]);

   printf("Outputting audio to %s\n", audio_dest==0 ? "analogue":"hdmi");

   play_api_test(samplerate, bitdepth, channels, audio_dest);
   return 0;
}

./hello_audio.bin --> default 透過 analogue 輸出
./hello_audio.bn 1 ---> 會透過 hdmi 輸出

我是使用HDMI輸出到電視..當然測試看看 ./hello_audio.bn 1
結果會發出一類似警報聲的難聽聲音....難道不能換一下嗎...待續..