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
Diff: MyClasses_Functions/FrquencyResponseDrawer.hpp
- Revision:
- 4:76aa20fb326a
- Child:
- 5:4a99dabc9180
diff -r 492cb0f68526 -r 76aa20fb326a MyClasses_Functions/FrquencyResponseDrawer.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MyClasses_Functions/FrquencyResponseDrawer.hpp Sat Apr 16 13:53:53 2016 +0000 @@ -0,0 +1,90 @@ +//----------------------------------------------------------- +// FrqRespDrawer class Header +// +// 2016/04/16, Copyright (c) 2016 MIKAMI, Naoki +//----------------------------------------------------------- + +#ifndef F746_FRQ_RESP_DRAWER_HPP +#define F746_FRQ_RESP_DRAWER_HPP + +#include "Label.hpp" +#include "IIR_CascadeFrqResp.hpp" + +namespace Mikami +{ + class FrqRespDrawer + { + public: + // Constructor + FrqRespDrawer(uint16_t org, float min, float max, uint16_t dec, + uint16_t orgY, float minDb, float maxDb, uint16_t db10, + float fs, + uint32_t lineColor = 0xFF00B0FF, + uint32_t axisColor = LCD_COLOR_LIGHTGRAY, + uint32_t backColor = GuiBase::ENUM_BACK) + : lcd_(GuiBase::GetLcdPtr()), + ORG_(org), MIN_(min), MAX_(max), DEC_(dec), + ORGY_(orgY), MIN_DB_(minDb), MAX_DB_(maxDb), DB10_(db10), + FS_(fs), + LINE_COLOR_(lineColor), + AXIS_COLOR_(axisColor), + BACK_COLOR_(backColor), + DB1_(db10*0.1f) {} + + // 周波数に対応する x 座標値の取得 + int X(float frq) + { return Round(ORG_ + DEC_*log10f(frq/MIN_)); } + + // x 座標値を周波数に変換 + float PosToFrq(uint16_t x) + { return MIN_*powf(10.0f, (x - ORG_)/(float)DEC_); } + + // 目盛線の描画 + void DrawAxis(); + + // 横軸の目盛値の表示用 + void DrawCharX(uint32_t frq, int offsetY, + const char str[], sFONT &fonts = Font12, + uint32_t textColor = LCD_COLOR_WHITE) + { Label frequency(X(frq), ORGY_+offsetY, str, Label::CENTER); } + + // 縦軸の目盛値の表示 + void DrawNumericY(int offsetX, int offsetY, int count, + uint16_t d_dB, const char fmt[], sFONT &fonts = Font12, + uint32_t textColor = LCD_COLOR_WHITE); + + // 周波数特性のグラフの描画 + void DrawGraph(FrequencyResponse &frqResp); + + // 消去 + void Erase(); + + private: + LCD_DISCO_F746NG *lcd_; + const uint16_t ORG_; // 横軸の目盛の最小値に対応する位置 + const float MIN_; // 横軸の目盛の最小値 + const float MAX_; // 横軸の目盛の最大値 + const uint16_t DEC_; // 周波数の 10 倍に対応する長さ (pixels) + const uint16_t ORGY_; // 縦軸の目盛の最小値に対応する位置 + const float MIN_DB_; // 縦軸の目盛の最小値 [dB] + const float MAX_DB_; // 縦軸の目盛の最大値 [dB] + const uint16_t DB10_; // 10 dB 対応する長さ (pixels) + const float FS_; // 標本化周波数 + const uint32_t LINE_COLOR_; + const uint32_t AXIS_COLOR_; + const uint32_t BACK_COLOR_; + const float DB1_; + + // 丸め + int Round(float x) { return x + 0.5f - (x < 0); } + + // 10 のべき乗かどうかの検査 + bool PowersOf10(float x) + { return fabsf(log10f(x) - Round(log10f(x))) < 0.01f; } + + // disallow copy constructor and assignment operator + FrqRespDrawer(const FrqRespDrawer&); + FrqRespDrawer& operator=(const FrqRespDrawer&); + }; +} +#endif // F746_FRQ_RESP_DRAWER_HPP