First publishment of Shimabara Audio Codec Controller library. Including code for ADAU1361 and UMB-ADAU1361A. Working pretty fine. Checked with LPCXpresso 4337 and Unzen_lpc4337
Dependents: unzen_sample_LPC4088_quickstart unzen_sample_lpcxpresso_4337_callbacks unzen_sample_nucleo_f746 unzen_delay_sample_nucleo_f746 ... more
shimabaraは、mbedからオーディオ・コーデックのハードウェアを操作するクラス・ライブラリです。このライブラリは雲仙オーディオ・フレームワークと共に使うことを想定して開発しましたが、独立して使うことも可能です。
使い方
shimabaraは BaseAudioCodec, ADAU1361, UMB_ADAU1361Aの三つのクラスを定義しています。いずれのクラスも名前空間simabaraに属しています。実際のアプリケーションで使用するのはshimabara::UMB_ADAU1361Aだけで、このクラスはアクアシグナルのUMB-ADAU1361-Aに対応しています。ヘッダーファイルは umb_adau1361a.hです。
shimabara::UMB_ADAU1361Aのコンストラクタは三つの引数を受け取ります。
- Fs はサンプル周波数です。これはenum Fs_type型の引数で、やはり名前空間shimabaraに属しています。
- controller はADAU1361Aが接続されているI2Cポートに対応するI2Cオブジェクトを与えます。shimabaraはこのポートを通してCODECと通信します。
- Addrには、コーデックのI2Cアドレスを与えます。現時点ではこの引数は0x38固定です。
コンストラクタでオブジェクトを初期化したら、start()メソッドを呼んでください。これでshimabaraはコーデックと通信し、I2Sモードでの動作が始まります。
参考リンク
- 『雲仙』 オーディオ・フレームワーク
- skeleton_unzen_nucleo_f746 Nucleo F746ZGおよびUI基板を使う場合のスケルトンプログラム。F746を使う方はここから読み始めると良いでしょう。
baseaudiocodec.cpp@1:ea6d442bd68a, 2016-05-08 (annotated)
- Committer:
- shorie
- Date:
- Sun May 08 09:52:42 2016 +0000
- Revision:
- 1:ea6d442bd68a
- Child:
- 2:fba0b8afebf0
Refactored naming conventions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shorie | 1:ea6d442bd68a | 1 | /** |
shorie | 1:ea6d442bd68a | 2 | * \file BaseAudioCodec.cpp |
shorie | 1:ea6d442bd68a | 3 | * \brief implementation of class adau1361. See BaseAudioCodec1.h as class definition. |
shorie | 1:ea6d442bd68a | 4 | */ |
shorie | 1:ea6d442bd68a | 5 | #include "baseaudiocodec.h" |
shorie | 1:ea6d442bd68a | 6 | |
shorie | 1:ea6d442bd68a | 7 | namespace audiocodec |
shorie | 1:ea6d442bd68a | 8 | { |
shorie | 1:ea6d442bd68a | 9 | |
shorie | 1:ea6d442bd68a | 10 | BaseAudioCodec::BaseAudioCodec( I2C * controler, Fs_Type Fs, unsigned int Addr ) |
shorie | 1:ea6d442bd68a | 11 | { |
shorie | 1:ea6d442bd68a | 12 | i2c = controler; |
shorie | 1:ea6d442bd68a | 13 | fs = Fs; |
shorie | 1:ea6d442bd68a | 14 | addr = Addr<<1; // Justify to right to use mbed library |
shorie | 1:ea6d442bd68a | 15 | } |
shorie | 1:ea6d442bd68a | 16 | |
shorie | 1:ea6d442bd68a | 17 | void BaseAudioCodec::set_line_input_gain(float left_gain, float right_gain, bool mute) |
shorie | 1:ea6d442bd68a | 18 | { |
shorie | 1:ea6d442bd68a | 19 | } |
shorie | 1:ea6d442bd68a | 20 | |
shorie | 1:ea6d442bd68a | 21 | void BaseAudioCodec::set_aux_input_gain(float left_gain, float right_gain, bool mute) |
shorie | 1:ea6d442bd68a | 22 | { |
shorie | 1:ea6d442bd68a | 23 | } |
shorie | 1:ea6d442bd68a | 24 | |
shorie | 1:ea6d442bd68a | 25 | void BaseAudioCodec::set_mic_input_gain(float left_gain, float right_gain, bool mute) |
shorie | 1:ea6d442bd68a | 26 | { |
shorie | 1:ea6d442bd68a | 27 | } |
shorie | 1:ea6d442bd68a | 28 | |
shorie | 1:ea6d442bd68a | 29 | void BaseAudioCodec::set_line_output_gain(float left_gain, float right_gain, bool mute) |
shorie | 1:ea6d442bd68a | 30 | { |
shorie | 1:ea6d442bd68a | 31 | } |
shorie | 1:ea6d442bd68a | 32 | |
shorie | 1:ea6d442bd68a | 33 | void BaseAudioCodec::set_hp_output_gain(float left_gain, float right_gain, bool mute) |
shorie | 1:ea6d442bd68a | 34 | { |
shorie | 1:ea6d442bd68a | 35 | } |
shorie | 1:ea6d442bd68a | 36 | |
shorie | 1:ea6d442bd68a | 37 | |
shorie | 1:ea6d442bd68a | 38 | |
shorie | 1:ea6d442bd68a | 39 | } |