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

Revision:
4:76aa20fb326a
Child:
5:4a99dabc9180
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MyClasses_Functions/FrquencyResponseDrawer.cpp	Sat Apr 16 13:53:53 2016 +0000
@@ -0,0 +1,88 @@
+//-----------------------------------------------------------
+//  FrqRespDrawer class
+//
+//  2016/04/16, Copyright (c) 2016 MIKAMI, Naoki
+//-----------------------------------------------------------
+
+#include "FrquencyResponseDrawer.hpp"
+#include "NumericLabel.hpp"
+
+namespace Mikami
+{
+    // 目盛線の描画
+    void FrqRespDrawer::DrawAxis()
+    {
+        uint16_t height = DB1_*(MAX_DB_ - MIN_DB_);
+        int logMin = (int)floorf(log10f(MIN_));
+        int loop = (int)floorf(log10f(MAX_)) - logMin;
+
+        lcd_->SetTextColor(AXIS_COLOR_);
+        uint16_t y0 = ORGY_ - height;
+        lcd_->DrawVLine(X(MIN_), y0, height);   // 最小値に対応する線
+
+        float du = powf(10.0, logMin);          // 座標値の増分
+        float u1 = (floorf(MIN_/du) + 1.0f)*du; // 最小値に対応する線の次の座標値
+
+        for (int n=0; n<=loop; n++)
+        {
+            float uMax = (10.0f*du < MAX_) ? 10.0f*du : MAX_;
+            for (float u=u1; u<uMax*0.99f; u+=du)
+                lcd_->DrawVLine(X(u), y0, height);
+
+            du = uMax;          // 値の増分を 10 倍する
+            u1 = du;            // 次の for ループ の最初の値
+        }
+
+        lcd_->DrawVLine(X(MAX_), y0, height);   // 最大値に対応する線
+        
+        uint16_t width = X(MAX_) - X(MIN_);
+        for (int n=0; n<= (MAX_DB_ - MIN_DB_)/10; n++)
+            lcd_->DrawHLine(X(MIN_), ORGY_-DB10_*n, width);
+    }
+
+    // 縦軸の数値の表示
+    void FrqRespDrawer::DrawNumericY(int offsetX, int offsetY, int count,
+                                     uint16_t d_dB, const char fmt[], sFONT &fonts,
+                                     uint32_t textColor)
+    {
+        uint16_t x0 = ORG_ + offsetX;
+        uint16_t y0 = ORGY_ + offsetY;
+        for (int n=0; n<count; n++)
+            new NumericLabel<int>(x0, y0-n*d_dB*DB1_,
+                                  fmt, (int)(MIN_DB_+d_dB*n));
+    }
+
+    // 周波数特性のグラフの描画
+    void FrqRespDrawer::DrawGraph(FrequencyResponse &frqResp)
+    {
+        lcd_->SetTextColor(LINE_COLOR_);
+        uint16_t width = X(MAX_) - X(MIN_);   
+        uint16_t x1 = 0;
+        uint16_t y1 = 0;
+        float pi2FsM = -6.283185f/FS_;  // -2*PI*Ts
+        for (int n=0; n<=width; n++)
+        {
+            float frq = PosToFrq(n+ORG_);
+            uint16_t x2 = X(frq);
+            float absHz = frqResp.AbsH_z(exp(Complex(0, pi2FsM*frq)));
+            float dB = (absHz > 0.001f) ? 20.0f*log10f(absHz) : MIN_DB_;
+            uint16_t y2 = ORGY_ - Round((dB - MIN_DB_)*DB1_);
+            if (y2 > ORGY_) y2 = ORGY_;
+
+            if (n != 0) lcd_->DrawLine(x1, y1, x2, y2);
+
+            x1 = x2;
+            y1 = y2;
+        }
+        lcd_->SetTextColor(AXIS_COLOR_);
+        lcd_->DrawHLine(X(MIN_), ORGY_, width);
+    }
+
+    // 消去
+    void FrqRespDrawer::Erase()
+    {
+        lcd_->SetTextColor(BACK_COLOR_);
+        uint16_t height = DB1_*(MAX_DB_ - MIN_DB_);
+        lcd_->FillRect(ORG_, ORGY_- height, X(MAX_)-X(MIN_)+1, height+1);
+    }
+}