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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sai_io_o.hpp Source File

sai_io_o.hpp

00001 //-----------------------------------------------------------
00002 //  SiaIO class for output (Header)
00003 //  2016/04/17, Copyright (c) 2016 MIKAMI, Naoki
00004 //-----------------------------------------------------------
00005 
00006 #ifndef F746_SAI_IO_HPP
00007 #define F746_SAI_IO_HPP
00008 
00009 #include "mbed.h"
00010 #include "stm32746g_discovery_audio.h"
00011 #include "BSP_AudioOut_Overwrite.hpp"
00012 
00013 namespace Mikami
00014 {
00015     class SaiIO_O
00016     {
00017     public:
00018         SaiIO_O(int size, int fs);
00019         ~SaiIO_O();
00020 
00021         void InitCodecOut();
00022         
00023         bool IsXferred();
00024         void Output(int16_t xL, int16_t xR);
00025         
00026         void ResetXferred() { xferred_ = false; }
00027         int32_t GetLength() { return nData_; }
00028         void Stop()   { BSP_AUDIO_OUT_Stop(CODEC_PDWN_SW); }
00029         void Pause()  { BSP_AUDIO_OUT_Pause(); }
00030         void Resume() { BSP_AUDIO_OUT_Resume(); }
00031 
00032         
00033         // These three member functions are called from
00034         // callback functions in "BSP_AudioOut_Overwrite.cpp"
00035 
00036         // Called form BSP_AUDIO_OUT_HalfTransfer_CallBack()
00037         static void FillBuffer1st() { FillBuffer(0); }
00038         // Called form BSP_AUDIO_OUT_TransferComplete_CallBack()
00039         static void FillBuffer2nd() { FillBuffer(bufferSize_/2); }
00040         // Also called form BSP_AUDIO_OUT_Error_CallBack()
00041         static void ErrorTrap();
00042 
00043     private:
00044         const int FS_;
00045         static const uint8_t VOLUME_OUT_ = 90;
00046 
00047         static int32_t nData_;
00048         static int32_t bufferSize_;
00049 
00050         static int16_t* outBuffer_;
00051         static int16_t* tmp_;       
00052 
00053         static __IO bool xferred_;
00054         
00055         __IO int32_t tmpIndex_;
00056 
00057         static void FillBuffer(uint32_t offset);
00058     };
00059 }
00060 #endif  // F746_SAI_IO_HPP