![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Output the audio signal (*.bin) with filtering by IIR filter in the SD card using onboard CODEC. For *.wav file, F746_SD_WavPlayer and F746_SD_GraphicEqualiser are published on mbed. SD カードのオーディオ信号 (*.bin) を遮断周波数可変の IIR フィルタを通して,ボードに搭載されているCODEC で出力する.*.wav 形式のファイル用には,F746_SD_WavPlayer と F746_SD_GraphicEqualiser を mbed で公開している.
Dependencies: BSP_DISCO_F746NG_patch_fixed F746_GUI LCD_DISCO_F746NG SDFileSystem_Warning_Fixed TS_DISCO_F746NG mbed
MyClasses_Functions/sai_io_o.hpp@0:6748e3332e85, 2016-04-08 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Fri Apr 08 13:11:53 2016 +0000
- Revision:
- 0:6748e3332e85
- Child:
- 5:4a99dabc9180
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:6748e3332e85 | 1 | //----------------------------------------------------------- |
MikamiUitOpen | 0:6748e3332e85 | 2 | // SiaIO class for output (Header) |
MikamiUitOpen | 0:6748e3332e85 | 3 | // 2016/02/16, Copyright (c) 2016 MIKAMI, Naoki |
MikamiUitOpen | 0:6748e3332e85 | 4 | //----------------------------------------------------------- |
MikamiUitOpen | 0:6748e3332e85 | 5 | |
MikamiUitOpen | 0:6748e3332e85 | 6 | #ifndef F746_SAI_IO_HPP |
MikamiUitOpen | 0:6748e3332e85 | 7 | #define F746_SAI_IO_HPP |
MikamiUitOpen | 0:6748e3332e85 | 8 | |
MikamiUitOpen | 0:6748e3332e85 | 9 | #include "mbed.h" |
MikamiUitOpen | 0:6748e3332e85 | 10 | #include "stm32746g_discovery_audio.h" |
MikamiUitOpen | 0:6748e3332e85 | 11 | #include "BSP_AudioOut_Overwrite.hpp" |
MikamiUitOpen | 0:6748e3332e85 | 12 | |
MikamiUitOpen | 0:6748e3332e85 | 13 | namespace Mikami |
MikamiUitOpen | 0:6748e3332e85 | 14 | { |
MikamiUitOpen | 0:6748e3332e85 | 15 | class SaiIO_O |
MikamiUitOpen | 0:6748e3332e85 | 16 | { |
MikamiUitOpen | 0:6748e3332e85 | 17 | public: |
MikamiUitOpen | 0:6748e3332e85 | 18 | SaiIO_O(int size, int fs); |
MikamiUitOpen | 0:6748e3332e85 | 19 | |
MikamiUitOpen | 0:6748e3332e85 | 20 | void InitCodecOut(); |
MikamiUitOpen | 0:6748e3332e85 | 21 | |
MikamiUitOpen | 0:6748e3332e85 | 22 | bool IsXferred(); |
MikamiUitOpen | 0:6748e3332e85 | 23 | void Output(int16_t xL, int16_t xR); |
MikamiUitOpen | 0:6748e3332e85 | 24 | |
MikamiUitOpen | 0:6748e3332e85 | 25 | void ResetXferred() { xferred_ = false; } |
MikamiUitOpen | 0:6748e3332e85 | 26 | int32_t GetLength() { return nData_; } |
MikamiUitOpen | 0:6748e3332e85 | 27 | void Stop() { BSP_AUDIO_OUT_Stop(CODEC_PDWN_SW); } |
MikamiUitOpen | 0:6748e3332e85 | 28 | void Pause() { BSP_AUDIO_OUT_Pause(); } |
MikamiUitOpen | 0:6748e3332e85 | 29 | void Resume() { BSP_AUDIO_OUT_Resume(); } |
MikamiUitOpen | 0:6748e3332e85 | 30 | |
MikamiUitOpen | 0:6748e3332e85 | 31 | |
MikamiUitOpen | 0:6748e3332e85 | 32 | // These three member functions are called from |
MikamiUitOpen | 0:6748e3332e85 | 33 | // callback functions in "BSP_AudioOut_Overwrite.cpp" |
MikamiUitOpen | 0:6748e3332e85 | 34 | |
MikamiUitOpen | 0:6748e3332e85 | 35 | // Called form BSP_AUDIO_OUT_HalfTransfer_CallBack() |
MikamiUitOpen | 0:6748e3332e85 | 36 | static void FillBuffer1st() { FillBuffer(0); } |
MikamiUitOpen | 0:6748e3332e85 | 37 | // Called form BSP_AUDIO_OUT_TransferComplete_CallBack() |
MikamiUitOpen | 0:6748e3332e85 | 38 | static void FillBuffer2nd() { FillBuffer(bufferSize_/2); } |
MikamiUitOpen | 0:6748e3332e85 | 39 | // Also called form BSP_AUDIO_OUT_Error_CallBack() |
MikamiUitOpen | 0:6748e3332e85 | 40 | static void ErrorTrap(); |
MikamiUitOpen | 0:6748e3332e85 | 41 | |
MikamiUitOpen | 0:6748e3332e85 | 42 | private: |
MikamiUitOpen | 0:6748e3332e85 | 43 | const int FS_; |
MikamiUitOpen | 0:6748e3332e85 | 44 | static const uint8_t VOLUME_OUT_ = 90; |
MikamiUitOpen | 0:6748e3332e85 | 45 | |
MikamiUitOpen | 0:6748e3332e85 | 46 | static int32_t nData_; |
MikamiUitOpen | 0:6748e3332e85 | 47 | static int32_t bufferSize_; |
MikamiUitOpen | 0:6748e3332e85 | 48 | |
MikamiUitOpen | 0:6748e3332e85 | 49 | static int16_t* outBuffer_; |
MikamiUitOpen | 0:6748e3332e85 | 50 | static int16_t* tmp_; |
MikamiUitOpen | 0:6748e3332e85 | 51 | |
MikamiUitOpen | 0:6748e3332e85 | 52 | static __IO bool xferred_; |
MikamiUitOpen | 0:6748e3332e85 | 53 | |
MikamiUitOpen | 0:6748e3332e85 | 54 | __IO int32_t tmpIndex_; |
MikamiUitOpen | 0:6748e3332e85 | 55 | |
MikamiUitOpen | 0:6748e3332e85 | 56 | static void FillBuffer(uint32_t offset); |
MikamiUitOpen | 0:6748e3332e85 | 57 | }; |
MikamiUitOpen | 0:6748e3332e85 | 58 | } |
MikamiUitOpen | 0:6748e3332e85 | 59 | #endif // F746_SAI_IO_HPP |