Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: unzen_sample_LPC4088_quickstart unzen_sample_lpcxpresso_4337_callbacks unzen_sample_nucleo_f746 unzen_delay_sample_nucleo_f746 ... more
baseaudiocodec.h@5:bbbf6cd235d4, 2017-01-26 (annotated)
- Committer:
- shorie
- Date:
- Thu Jan 26 00:07:02 2017 +0000
- Revision:
- 5:bbbf6cd235d4
- Parent:
- 3:c0f834049ee2
- Child:
- 7:6d921f8c38d6
Doxygen comment updated
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| shorie | 5:bbbf6cd235d4 | 1 | /** |
| shorie | 5:bbbf6cd235d4 | 2 | * \file baseaudiocodec.h |
| shorie | 2:fba0b8afebf0 | 3 | * \brief header file for an abstract audio codec class |
| shorie | 1:ea6d442bd68a | 4 | * \arthur SeiichiHorie |
| shorie | 1:ea6d442bd68a | 5 | * \date 6/Apr/2016 |
| shorie | 1:ea6d442bd68a | 6 | */ |
| shorie | 1:ea6d442bd68a | 7 | |
| shorie | 1:ea6d442bd68a | 8 | #ifndef _BaseAudioCodec_h_ |
| shorie | 1:ea6d442bd68a | 9 | #define _BaseAudioCodec_h_ |
| shorie | 1:ea6d442bd68a | 10 | |
| shorie | 1:ea6d442bd68a | 11 | #include "mbed.h" |
| shorie | 1:ea6d442bd68a | 12 | /** |
| shorie | 1:ea6d442bd68a | 13 | \brief audio framework name space. |
| shorie | 1:ea6d442bd68a | 14 | */ |
| shorie | 2:fba0b8afebf0 | 15 | namespace shimabara |
| shorie | 1:ea6d442bd68a | 16 | { |
| shorie | 1:ea6d442bd68a | 17 | |
| shorie | 1:ea6d442bd68a | 18 | |
| shorie | 5:bbbf6cd235d4 | 19 | /** |
| shorie | 5:bbbf6cd235d4 | 20 | * \brief Sampling Frequency of the umb_adau1361 |
| shorie | 5:bbbf6cd235d4 | 21 | */ |
| shorie | 1:ea6d442bd68a | 22 | enum Fs_Type |
| shorie | 1:ea6d442bd68a | 23 | { |
| shorie | 5:bbbf6cd235d4 | 24 | Fs_32, ///< 32kHz |
| shorie | 5:bbbf6cd235d4 | 25 | Fs_441, ///< 44.1kHz |
| shorie | 5:bbbf6cd235d4 | 26 | Fs_48, ///< 48kHz |
| shorie | 5:bbbf6cd235d4 | 27 | Fs_96 ///< 96kHz |
| shorie | 1:ea6d442bd68a | 28 | } ; |
| shorie | 1:ea6d442bd68a | 29 | |
| shorie | 1:ea6d442bd68a | 30 | |
| shorie | 1:ea6d442bd68a | 31 | /** |
| shorie | 1:ea6d442bd68a | 32 | * \brief abstract audio codec controller. |
| shorie | 1:ea6d442bd68a | 33 | * \details |
| shorie | 1:ea6d442bd68a | 34 | * This class is template for all codec classes |
| shorie | 1:ea6d442bd68a | 35 | */ |
| shorie | 1:ea6d442bd68a | 36 | class BaseAudioCodec |
| shorie | 1:ea6d442bd68a | 37 | { |
| shorie | 1:ea6d442bd68a | 38 | public: |
| shorie | 1:ea6d442bd68a | 39 | /** |
| shorie | 1:ea6d442bd68a | 40 | * \brief constructor. |
| shorie | 1:ea6d442bd68a | 41 | * \param Fs Sampling frequency. |
| shorie | 1:ea6d442bd68a | 42 | * \param Addr I2C device address. value range is from 0 to 127 |
| shorie | 1:ea6d442bd68a | 43 | * \details |
| shorie | 1:ea6d442bd68a | 44 | * initialize the internal variables. |
| shorie | 1:ea6d442bd68a | 45 | */ |
| shorie | 2:fba0b8afebf0 | 46 | BaseAudioCodec( Fs_Type Fs ); |
| shorie | 1:ea6d442bd68a | 47 | |
| shorie | 1:ea6d442bd68a | 48 | /** |
| shorie | 1:ea6d442bd68a | 49 | * \brief Actual initializer. |
| shorie | 1:ea6d442bd68a | 50 | * \details |
| shorie | 1:ea6d442bd68a | 51 | * Initialize the codec itself and start the conversion process. |
| shorie | 1:ea6d442bd68a | 52 | * and configure for given parameter. |
| shorie | 1:ea6d442bd68a | 53 | * |
| shorie | 1:ea6d442bd68a | 54 | * Finally, set the input gain to 0dB. |
| shorie | 1:ea6d442bd68a | 55 | */ |
| shorie | 1:ea6d442bd68a | 56 | virtual void start(void)=0; |
| shorie | 1:ea6d442bd68a | 57 | |
| shorie | 1:ea6d442bd68a | 58 | /** |
| shorie | 1:ea6d442bd68a | 59 | * \brief Set the line input gain and enable the relevant mixer. |
| shorie | 1:ea6d442bd68a | 60 | * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 61 | * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 62 | * \param mute set true to mute |
| shorie | 1:ea6d442bd68a | 63 | */ |
| shorie | 1:ea6d442bd68a | 64 | virtual void set_line_input_gain(float left_gain, float right_gain, bool mute=false); |
| shorie | 1:ea6d442bd68a | 65 | /** |
| shorie | 1:ea6d442bd68a | 66 | * \brief Set the aux input gain and enable the relevant mixer. |
| shorie | 1:ea6d442bd68a | 67 | * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 68 | * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 69 | * \param mute set true to mute |
| shorie | 1:ea6d442bd68a | 70 | */ |
| shorie | 1:ea6d442bd68a | 71 | virtual void set_aux_input_gain(float left_gain, float right_gain, bool mute=false); |
| shorie | 1:ea6d442bd68a | 72 | /** |
| shorie | 1:ea6d442bd68a | 73 | * \brief Set the mic input gain and enable the relevant mixer. |
| shorie | 1:ea6d442bd68a | 74 | * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 75 | * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 76 | * \param mute set true to mute |
| shorie | 1:ea6d442bd68a | 77 | */ |
| shorie | 1:ea6d442bd68a | 78 | virtual void set_mic_input_gain(float left_gain, float right_gain, bool mute=false); |
| shorie | 1:ea6d442bd68a | 79 | /** |
| shorie | 1:ea6d442bd68a | 80 | * \brief Set the line output gain and enable the relevant mixer. |
| shorie | 1:ea6d442bd68a | 81 | * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 82 | * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 83 | * \param mute set true to mute |
| shorie | 1:ea6d442bd68a | 84 | */ |
| shorie | 1:ea6d442bd68a | 85 | virtual void set_line_output_gain(float left_gain, float right_gain, bool mute=false); |
| shorie | 1:ea6d442bd68a | 86 | /** |
| shorie | 1:ea6d442bd68a | 87 | * \brief Set the headphone output gain and enable the relevant mixer. |
| shorie | 1:ea6d442bd68a | 88 | * \param left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 89 | * \param right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. |
| shorie | 1:ea6d442bd68a | 90 | * \param mute set true to mute |
| shorie | 1:ea6d442bd68a | 91 | */ |
| shorie | 1:ea6d442bd68a | 92 | virtual void set_hp_output_gain(float left_gain, float right_gain, bool mute=false); |
| shorie | 1:ea6d442bd68a | 93 | protected: |
| shorie | 1:ea6d442bd68a | 94 | unsigned int addr; |
| shorie | 1:ea6d442bd68a | 95 | Fs_Type fs; |
| shorie | 1:ea6d442bd68a | 96 | }; |
| shorie | 1:ea6d442bd68a | 97 | |
| shorie | 1:ea6d442bd68a | 98 | |
| shorie | 1:ea6d442bd68a | 99 | } |
| shorie | 1:ea6d442bd68a | 100 | |
| shorie | 1:ea6d442bd68a | 101 | #endif |