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

Committer:
MikamiUitOpen
Date:
2016-04-17
Revision:
5:4a99dabc9180
Parent:
0:6748e3332e85

File content as of revision 5:4a99dabc9180:

//-----------------------------------------------------------
//  SiaIO class for output (Header)
//  2016/04/17, Copyright (c) 2016 MIKAMI, Naoki
//-----------------------------------------------------------

#ifndef F746_SAI_IO_HPP
#define F746_SAI_IO_HPP

#include "mbed.h"
#include "stm32746g_discovery_audio.h"
#include "BSP_AudioOut_Overwrite.hpp"

namespace Mikami
{
    class SaiIO_O
    {
    public:
        SaiIO_O(int size, int fs);
        ~SaiIO_O();

        void InitCodecOut();
        
        bool IsXferred();
        void Output(int16_t xL, int16_t xR);
        
        void ResetXferred() { xferred_ = false; }
        int32_t GetLength() { return nData_; }
        void Stop()   { BSP_AUDIO_OUT_Stop(CODEC_PDWN_SW); }
        void Pause()  { BSP_AUDIO_OUT_Pause(); }
        void Resume() { BSP_AUDIO_OUT_Resume(); }

        
        // These three member functions are called from
        // callback functions in "BSP_AudioOut_Overwrite.cpp"

        // Called form BSP_AUDIO_OUT_HalfTransfer_CallBack()
        static void FillBuffer1st() { FillBuffer(0); }
        // Called form BSP_AUDIO_OUT_TransferComplete_CallBack()
        static void FillBuffer2nd() { FillBuffer(bufferSize_/2); }
        // Also called form BSP_AUDIO_OUT_Error_CallBack()
        static void ErrorTrap();

    private:
        const int FS_;
        static const uint8_t VOLUME_OUT_ = 90;

        static int32_t nData_;
        static int32_t bufferSize_;

        static int16_t* outBuffer_;
        static int16_t* tmp_;       

        static __IO bool xferred_;
        
        __IO int32_t tmpIndex_;

        static void FillBuffer(uint32_t offset);
    };
}
#endif  // F746_SAI_IO_HPP