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 不韋 呂

MyClasses_Functions/DesignerDrawer.hpp

Committer:
MikamiUitOpen
Date:
2016-04-27
Revision:
0:e953eb392151
Child:
2:2a5c93bf729a

File content as of revision 0:e953eb392151:

//------------------------------------------------------------------------------
//  イコライザ用フィルタのパラメータを設定し,その周波数特性を描画するためのクラス -- Header
//  
//  2016/04/27, Copyright (c) 2016 MIKAMI, Naoki
//------------------------------------------------------------------------------

#ifndef F746_DISIGNER_AND_DRAWER_HPP
#define F746_DISIGNER_AND_DRAWER_HPP

#include "NumericLabel.hpp"
#include "FrquencyResponseDrawer.hpp"
#include "GrEqParamsCalculator.hpp"
#include "GrEqualizerFrqResp.hpp"

namespace Mikami
{
    class DesignerDrawer
    {
    public:
        // Constructor
        DesignerDrawer(uint16_t x0, uint16_t y0,
                       int stages, float f0, int fs, uint16_t db1);

        ~DesignerDrawer();

        // 周波数特性の描画
        void DrawResponse();

        // 特定のバンドのイコライザ用フィルタのパラメータの設定と周波数特性の再描画
        void DesignAndRedraw(float gainDb, int n);
        
        // 周波数特性をフラットにし,その周波数特性を再描画
        void DesignAndRedraw();

        // イコライザ用フィルタの周波数特性をフラットにする
        void Flatten();

        void GetCoefficients(BiquadGrEq::Coefs ck[])
        {   for (int n=0; n<STAGES_; n++) ck[n] = ck_[n]; }
        
        BiquadGrEq::Coefs GetCoefficient(int n) { return ck_[n]; }

        uint16_t GetX0()
        {   return drawerObj_->X(f0_[0]); }
        
        uint16_t GetSpaceX()
        {   return (uint16_t)(drawerObj_->X(f0_[1])
                            - drawerObj_->X(f0_[0])); }

        int GetStages() { return STAGES_; }

    private:
        LCD_DISCO_F746NG *lcd_;
        TS_DISCO_F746NG *ts_;

        const uint16_t X0_, Y0_;
        const int STAGES_;
        const uint16_t DB1_;
        const float Q_VAL_;

        float *f0_;
        GrEqParamsCalculator *calculator_;
        GrEqualizerFrqResp *frqResp_;   // フィルタの周波数応答に対応するオブジェクト
        BiquadGrEq::Coefs *ck_;         // フィルタの係数        
        FrqRespDrawer *drawerObj_;
    };
}
#endif  // F746_DISIGNER_AND_DRAWER_HPP