不韋 呂 / F746_MySoundMachine

Dependencies:   F746_GUI F746_SAI_IO FrequencyResponseDrawer SD_PlayerSkeleton UIT_FFT_Real

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BtwthDesignerDrawer.hpp Source File

BtwthDesignerDrawer.hpp

00001 //------------------------------------------------------------------------------
00002 //  IIR フィルタを双1次 z 変換で設計し,その周波数特性を描画するためのクラス -- Header
00003 //      使うフィルタ:Butterworth 特性の LPF と HPF
00004 //  
00005 //  2017/03/16, Copyright (c) 2017 MIKAMI, Naoki
00006 //------------------------------------------------------------------------------
00007 
00008 #ifndef F746_BTWTH_DISIGNER_AND_DRAWER_HPP
00009 #define F746_BTWTH_DISIGNER_AND_DRAWER_HPP
00010 
00011 #include "NumericLabel.hpp"
00012 #include "TouchPanelDetectorX.hpp"
00013 #include "FrquencyResponseDrawer.hpp"
00014 #include "BilinearDesignLH.hpp"
00015 #include "IIR_CascadeFrqResp.hpp"
00016 
00017 namespace Mikami
00018 {
00019     class BtwthDesignerDrawer
00020     {
00021     public:
00022         // Constructor
00023         BtwthDesignerDrawer(uint16_t x0, uint16_t y0,
00024                             float db1, int fs, int order,
00025                             float fc, uint16_t fL, uint16_t fH,
00026                             BilinearDesign::Type lpHp);
00027 
00028         virtual ~BtwthDesignerDrawer() {};
00029 
00030         // フィルタの再設計と周波数特性の再描画
00031         bool ReDesignAndDraw(Biquad::Coefs ck[], float &g0,
00032                              BilinearDesign::Type lpHp);
00033         
00034         // 周波数特性の描画
00035         void DrawResponse();
00036 
00037         void GetCoefficients(Biquad::Coefs ck[], float &g0);
00038         
00039         uint16_t GetOrder() { return ORDER_; }
00040 
00041     private:
00042         LCD_DISCO_F746NG &lcd_;
00043 
00044         const uint16_t X0_, Y0_;
00045         const uint16_t ORDER_;
00046         const uint16_t CURSOR_Y0_, CURSOR_LENGTH_;
00047         const uint16_t MIN_F_, MAX_F_;
00048         const uint32_t CURSOR_COLOR_, CURSOR_TOUCHED_COLOR_;
00049 
00050         IIR_CascadeFrqResp frqResp_;    // IIR フィルタの周波数応答に対応するオブジェクト
00051         Array<BilinearDesign::Coefs> coefs_;    // 設計された係数
00052         Array<Biquad::Coefs> &ck_;
00053         float g0_;                      // 設計された係数(利得定数)
00054         
00055         int fC_;    // 遮断周波数
00056 
00057         uint16_t cursorX_, oldCursorX_;
00058         bool cursorRedraw_;
00059         BilinearDesign::Type lp_;
00060         
00061         FrqRespDrawer drawerObj_;
00062         BilinearDesign designObj_;
00063         TouchPanelDetectorX tp_;
00064         NumericLabel<int> lblFrq_; // 遮断周波数表示用
00065         
00066         // 周波数を 10, 20, 50, 100 Hz の倍数にする
00067         int Frq10(float f);
00068     };
00069 }
00070 #endif  // F746_BTWTH_DISIGNER_AND_DRAWER_HPP