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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers baseaudiocodec.h Source File

baseaudiocodec.h

00001 /**
00002 * \ file baseaudiocodec.h
00003 * \brief header file for an abstract audio codec class
00004 * \arthur SeiichiHorie
00005 * \date 6/Apr/2016
00006 */
00007 
00008 #ifndef _BaseAudioCodec_h_
00009 #define _BaseAudioCodec_h_
00010 
00011 #include "mbed.h"
00012 /**
00013  \brief audio framework name space. 
00014 */
00015 namespace shimabara 
00016 {
00017 
00018 
00019         /**
00020          * \brief Sampling Frequency of the umb_adau1361
00021          */
00022     enum Fs_Type 
00023     {
00024         Fs_32,  ///< 32kHz
00025         Fs_441, ///< 44.1kHz
00026         Fs_48,  ///< 48kHz
00027         Fs_96   ///< 96kHz
00028     } ;
00029 
00030 
00031 /**
00032 * \brief abstract audio codec controller.
00033 * \details
00034 *   This class is template for all codec classes
00035 */
00036     class BaseAudioCodec
00037     {
00038     public:
00039             /**
00040             * \brief constructor.
00041             * \param Fs Sampling frequency.
00042             * \param Addr I2C device address. value range is from 0 to 127
00043             * \details
00044             *   initialize the internal variables.
00045             */
00046         BaseAudioCodec( Fs_Type Fs );
00047         
00048             /**
00049             * \brief Actual initializer. 
00050             * \details
00051             *   Initialize the codec itself and start the conversion process.
00052             *   and configure for given parameter. 
00053             *
00054             *   Finally, set the input gain to 0dB.
00055             */
00056         virtual void start(void)=0;
00057         
00058             /**
00059             * \brief Set the line input gain and enable the relevant mixer.
00060             * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00061             * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00062             * \param mute set true to mute
00063             */
00064         virtual void set_line_input_gain(float left_gain, float right_gain, bool mute=false);
00065             /**
00066             * \brief Set the aux input gain and enable the relevant mixer.
00067             * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00068             * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00069             * \param mute set true to mute
00070             */
00071         virtual void set_aux_input_gain(float left_gain, float right_gain, bool mute=false);
00072             /**
00073             * \brief Set the mic input gain and enable the relevant mixer.
00074             * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00075             * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00076             * \param mute set true to mute
00077             */
00078         virtual void set_mic_input_gain(float left_gain, float right_gain, bool mute=false);
00079             /**
00080             * \brief Set the line output gain and enable the relevant mixer.
00081             * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00082             * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00083             * \param mute set true to mute
00084             */
00085         virtual void set_line_output_gain(float left_gain, float right_gain, bool mute=false);
00086             /**
00087             * \brief Set the headphone output gain and enable the relevant mixer.
00088             * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00089             * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated.
00090             * \param mute set true to mute
00091             */
00092         virtual void set_hp_output_gain(float left_gain, float right_gain, bool mute=false);
00093     protected:
00094         unsigned int addr;
00095         Fs_Type fs;
00096     };
00097 
00098 
00099 }
00100 
00101 #endif