revised version of F746_SD_GraphicEqualizer
Dependencies: BSP_DISCO_F746NG F746_GUI F746_SAI_IO FrequencyResponseDrawer LCD_DISCO_F746NG SDFileSystem_Warning_Fixed TS_DISCO_F746NG mbed
Fork of F746_SD_GraphicEqualizer by
Diff: MyClasses_Functions/DesignerDrawer.cpp
- Revision:
- 2:2a5c93bf729a
- Parent:
- 0:e953eb392151
- Child:
- 6:599229a1b06a
diff -r a5837720e14a -r 2a5c93bf729a MyClasses_Functions/DesignerDrawer.cpp --- a/MyClasses_Functions/DesignerDrawer.cpp Wed Apr 27 14:24:45 2016 +0000 +++ b/MyClasses_Functions/DesignerDrawer.cpp Sun May 01 02:44:30 2016 +0000 @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // イコライザ用フィルタのパラメータを設定し,その周波数特性を描画するためのクラス // -// 2016/04/27, Copyright (c) 2016 MIKAMI, Naoki +// 2016/05/01, Copyright (c) 2016 MIKAMI, Naoki //------------------------------------------------------------------------------ #include "DesignerDrawer.hpp" @@ -10,12 +10,12 @@ { // Constructor DesignerDrawer::DesignerDrawer(uint16_t x0, uint16_t y0, - int stages, float f0, int fs, uint16_t db1) + int stages, float f0, int fs, float db1) : lcd_(GuiBase::GetLcdPtr()), ts_(GuiBase::GetTsPtr()), - X0_(x0), Y0_(y0), STAGES_(stages), DB1_(db1), Q_VAL_(1.5f) + X0_(x0), Y0_(y0), STAGES_(stages), Q_VAL_(1.0f) { drawerObj_ = new FrqRespDrawer(x0, 50.0f, 20000.0f, 142, - y0, -12, 12, db1, 3, fs); + y0, -18, 18, db1, 6, fs); calculator_ = new GrEqParamsCalculator(fs); f0_ = new float[STAGES_]; @@ -23,7 +23,8 @@ f0_[n] = f0*powf(2, n); ck_ = new BiquadGrEq::Coefs[STAGES_]; - Flatten(); + for (int n=0; n<STAGES_; n++) + ck_[n] = calculator_->Execute(f0_[n], 0, Q_VAL_); frqResp_ = new GrEqualizerFrqResp(STAGES_); frqResp_->SetParams(ck_); @@ -60,22 +61,4 @@ drawerObj_->DrawAxis(); // 目盛線の描画 drawerObj_->DrawGraph(frqResp_); // 周波数特性のグラフのカーブを描画する } - - // 周波数特性をフラットにし,その周波数特性を再描画 - void DesignerDrawer::DesignAndRedraw() - { - Flatten(); - frqResp_->SetParams(ck_); - drawerObj_->Erase(); - drawerObj_->DrawAxis(); // 目盛線の描画 - drawerObj_->DrawGraph(frqResp_); // 周波数特性のグラフのカーブを描画する - } - - // イコライザ用フィルタの周波数特性をフラットにする - void DesignerDrawer::Flatten() - { - for (int n=0; n<STAGES_; n++) - ck_[n] = calculator_->Execute(f0_[n], 0, Q_VAL_); - } } -