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 5:4a99dabc9180, committed 2016-04-17
- Comitter:
- MikamiUitOpen
- Date:
- Sun Apr 17 08:44:43 2016 +0000
- Parent:
- 4:76aa20fb326a
- Commit message:
- 6
Changed in this revision
diff -r 76aa20fb326a -r 4a99dabc9180 MyClasses_Functions/DesignerDrawer.cpp --- a/MyClasses_Functions/DesignerDrawer.cpp Sat Apr 16 13:53:53 2016 +0000 +++ b/MyClasses_Functions/DesignerDrawer.cpp Sun Apr 17 08:44:43 2016 +0000 @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // IIR フィルタを双一次 z 変換で設計し,その周波数特性を描画するためのクラス // -// 2016/04/16, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/17, Copyright (c) 2016 MIKAMI, Naoki //------------------------------------------------------------------------------ #include "DesignerDrawer.hpp" @@ -29,7 +29,7 @@ fC_ = fc; // 最初に与える遮断周波数 designObj_->Execute(fC_, lpHp, coefs_, g0_); - frqResp.SetParams(ORDER_, g0_, ck_); + frqResp_.SetParams(ORDER_, g0_, ck_); // 周波数特性の描画 lblFrq_ = new NumericLabel<int>(110, 30); @@ -67,10 +67,10 @@ designObj_->Execute(newFc, lpHp, coefs_, g0_); GetCoefficients(ck, g0); - frqResp.SetParams(ORDER_, g0_, ck_); + frqResp_.SetParams(ORDER_, g0_, ck_); drawerObj_->Erase(); - drawerObj_->DrawAxis(); // 目盛線の描画 - drawerObj_->DrawGraph(frqResp); // 周波数特性のグラフのカーブを描画する + drawerObj_->DrawAxis(); // 目盛線の描画 + drawerObj_->DrawGraph(frqResp_); // 周波数特性のグラフのカーブを描画する if (tch) // カーソルの移動 { @@ -97,9 +97,9 @@ void DesignerDrawer::DrawResponse() { lblFrq_->Draw("Cutoff frequency = %4d Hz", fC_); - DrawAxisNum(); // 目盛値の描画 - drawerObj_->DrawAxis(); // 目盛線の描画 - drawerObj_->DrawGraph(frqResp); // 周波数特性のカーブの描画 + DrawAxisNum(); // 目盛値の描画 + drawerObj_->DrawAxis(); // 目盛線の描画 + drawerObj_->DrawGraph(frqResp_); // 周波数特性のカーブの描画 cursorX_ = drawerObj_->X(fC_); lcd_->SetTextColor(CURSOR_COLOR_); @@ -126,7 +126,7 @@ return ((int)(f/100.0f + 0.5f))*100; } - // 周波数特性の目盛線の描画 + // 周波数特性の目盛値の描画 void DesignerDrawer::DrawAxisNum() { const int16_t OFS = 6; @@ -142,3 +142,4 @@ Label l_dB(X0_-24, Y0_-DB10_*6-20, "[dB]"); } } +
diff -r 76aa20fb326a -r 4a99dabc9180 MyClasses_Functions/DesignerDrawer.hpp --- a/MyClasses_Functions/DesignerDrawer.hpp Sat Apr 16 13:53:53 2016 +0000 +++ b/MyClasses_Functions/DesignerDrawer.hpp Sun Apr 17 08:44:43 2016 +0000 @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // IIR フィルタを双一次 z 変換で設計し,その周波数特性を描画するためのクラス -- Header // -// 2016/04/16, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/17, Copyright (c) 2016 MIKAMI, Naoki //------------------------------------------------------------------------------ #ifndef F746_DISIGNER_AND_DRAWER_HPP @@ -10,7 +10,6 @@ #include "NumericLabel.hpp" #include "TouchPanelDetectorX.hpp" #include "FrquencyResponseDrawer.hpp" -#include "Biquad.hpp" #include "BilinearDesignLH.hpp" #include "IIR_CascadeFrqResp.hpp" @@ -49,7 +48,7 @@ const uint16_t LOWER_F_, HIGHER_F_; const uint32_t CURSOR_COLOR_, CURSOR_TOUCHED_COLOR_; - IIR_CascadeFrqResp frqResp; // IIR フィルタの周波数応答に対応するオブジェクト + IIR_CascadeFrqResp frqResp_; // IIR フィルタの周波数応答に対応するオブジェクト BilinearDesign::Coefs *coefs_; // 設計された係数 Biquad::Coefs *ck_; float g0_; // 設計された係数(利得定数) @@ -68,9 +67,8 @@ // 周波数を 10, 20, 50, 100 Hz の倍数にする int Frq10(float f); - // 周波数特性の目盛線と目盛値の描画 + // 周波数特性の目盛値の描画 void DrawAxisNum(); }; } #endif // F746_DISIGNER_AND_DRAWER_HPP -
diff -r 76aa20fb326a -r 4a99dabc9180 MyClasses_Functions/FileSelector.hpp --- a/MyClasses_Functions/FileSelector.hpp Sat Apr 16 13:53:53 2016 +0000 +++ b/MyClasses_Functions/FileSelector.hpp Sun Apr 17 08:44:43 2016 +0000 @@ -31,6 +31,16 @@ lcd_(GuiBase::GetLcdPtr()), sdReader_(reader), prev_(-1) {} + ~FileSelector() + { + for (int n=0; n<fileCount_; n++) + delete fileNameLabels_[n]; + delete[] fileNameLabels_; + delete[] rect_; + delete[] nonString_; + delete[] sortedFileNames_; + delete[] fileNames_; + } bool CreateTable() { DIR* dp = opendir("/sd"); @@ -65,7 +75,7 @@ if (fileCount_ == 0) return false; - nonString_ = new string[fileCount_]; + nonString_ = new string[fileCount_]; for (int n=0; n<fileCount_; n++) nonString_[n] = ""; rect_ = new ButtonGroup(X_, Y_, W_H_, W_H_, fileCount_, nonString_, 0, V_L_-W_H_, 1,
diff -r 76aa20fb326a -r 4a99dabc9180 MyClasses_Functions/FrquencyResponseDrawer.cpp --- a/MyClasses_Functions/FrquencyResponseDrawer.cpp Sat Apr 16 13:53:53 2016 +0000 +++ b/MyClasses_Functions/FrquencyResponseDrawer.cpp Sun Apr 17 08:44:43 2016 +0000 @@ -1,11 +1,11 @@ //----------------------------------------------------------- +// 周波数が対数スケールの周波数特性を描画するクラス // FrqRespDrawer class // -// 2016/04/16, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/17, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #include "FrquencyResponseDrawer.hpp" -#include "NumericLabel.hpp" namespace Mikami { @@ -48,14 +48,14 @@ 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_, + NumericLabel<int> num(x0, y0-n*d_dB*DB1_, fmt, (int)(MIN_DB_+d_dB*n)); } // 周波数特性のグラフの描画 - void FrqRespDrawer::DrawGraph(FrequencyResponse &frqResp) + void FrqRespDrawer::DrawGraph(FrequencyResponse &frqResp, uint32_t color) { - lcd_->SetTextColor(LINE_COLOR_); + lcd_->SetTextColor(color); uint16_t width = X(MAX_) - X(MIN_); uint16_t x1 = 0; uint16_t y1 = 0; @@ -86,3 +86,4 @@ lcd_->FillRect(ORG_, ORGY_- height, X(MAX_)-X(MIN_)+1, height+1); } } +
diff -r 76aa20fb326a -r 4a99dabc9180 MyClasses_Functions/FrquencyResponseDrawer.hpp --- a/MyClasses_Functions/FrquencyResponseDrawer.hpp Sat Apr 16 13:53:53 2016 +0000 +++ b/MyClasses_Functions/FrquencyResponseDrawer.hpp Sun Apr 17 08:44:43 2016 +0000 @@ -1,14 +1,15 @@ //----------------------------------------------------------- +// 周波数が対数スケールの周波数特性を描画するクラス // FrqRespDrawer class Header // -// 2016/04/16, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/17, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #ifndef F746_FRQ_RESP_DRAWER_HPP #define F746_FRQ_RESP_DRAWER_HPP -#include "Label.hpp" -#include "IIR_CascadeFrqResp.hpp" +#include "NumericLabel.hpp" +#include "FrequancyResponseBase.hpp" namespace Mikami { @@ -54,7 +55,9 @@ uint32_t textColor = LCD_COLOR_WHITE); // 周波数特性のグラフの描画 - void DrawGraph(FrequencyResponse &frqResp); + void DrawGraph(FrequencyResponse &frqResp, uint32_t color); + void DrawGraph(FrequencyResponse &frqResp) + { DrawGraph(frqResp, LINE_COLOR_);} // 消去 void Erase(); @@ -74,7 +77,7 @@ const uint32_t AXIS_COLOR_; const uint32_t BACK_COLOR_; const float DB1_; - + // 丸め int Round(float x) { return x + 0.5f - (x < 0); }
diff -r 76aa20fb326a -r 4a99dabc9180 MyClasses_Functions/sai_io_o.cpp --- a/MyClasses_Functions/sai_io_o.cpp Sat Apr 16 13:53:53 2016 +0000 +++ b/MyClasses_Functions/sai_io_o.cpp Sun Apr 17 08:44:43 2016 +0000 @@ -15,6 +15,11 @@ tmp_ = new int16_t[size*2]; xferred_ = false; } + SaiIO_O::~SaiIO_O() + { + delete[] tmp_; + delete[] outBuffer_; + } void SaiIO_O::InitCodecOut() { @@ -75,3 +80,4 @@ __IO bool SaiIO_O::xferred_; } +
diff -r 76aa20fb326a -r 4a99dabc9180 MyClasses_Functions/sai_io_o.hpp --- a/MyClasses_Functions/sai_io_o.hpp Sat Apr 16 13:53:53 2016 +0000 +++ b/MyClasses_Functions/sai_io_o.hpp Sun Apr 17 08:44:43 2016 +0000 @@ -1,6 +1,6 @@ //----------------------------------------------------------- // SiaIO class for output (Header) -// 2016/02/16, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/17, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #ifndef F746_SAI_IO_HPP @@ -16,6 +16,7 @@ { public: SaiIO_O(int size, int fs); + ~SaiIO_O(); void InitCodecOut();
diff -r 76aa20fb326a -r 4a99dabc9180 main.cpp --- a/main.cpp Sat Apr 16 13:53:53 2016 +0000 +++ b/main.cpp Sun Apr 17 08:44:43 2016 +0000 @@ -7,7 +7,7 @@ // 拡張子: "*.bin", "*.BIN" // IIR フィルタ ---- 低域通過および高域通過フィルタ // -// 2016/04/16, Copyright (c) 2016 MIKAMI, Naoki +// 2016/04/17, Copyright (c) 2016 MIKAMI, Naoki //-------------------------------------------------------------- #include "MyFunctions.hpp" @@ -167,3 +167,4 @@ sdReader.Close(); // SD のファイルのクローズ } } +