⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgfilter.cpp

📁 可以实现FIR滤波器任意阶数和窗函数下的设计。并且有可以在VC下显示幅频响应曲线和滤波效果。
💻 CPP
字号:
// DlgFilter.cpp : implementation file
//

#include "stdafx.h"
#include "Oscillograph.h"
#include "DlgFilter.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgFilter dialog


CDlgFilter::CDlgFilter(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgFilter::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgFilter)
	m_dblWl = 0.0;
	m_dblWh = 0.0;
	m_nFilterOrder = 0;
	m_dblNoiseA = 0.0;
	m_dblNoiseFreq = 0.0;
	m_dblSamplingFreq = 0.0;
	m_dblSignalA = 0.0;
	m_dblSignalFreq = 0.0;
	m_nFilterType = -1;
	m_nWindowType = -1;
	//}}AFX_DATA_INIT
}


void CDlgFilter::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgFilter)
	DDX_Text(pDX, IDC_EDIT_CUTOFF_WH, m_dblWh);
	DDX_Text(pDX, IDC_EDIT_CUTOFF_WL, m_dblWl);
	DDX_Text(pDX, IDC_EDIT_FILTER_ORDER, m_nFilterOrder);
	DDX_Text(pDX, IDC_EDIT_NOISE_AMPLITUDE, m_dblNoiseA);
	DDX_Text(pDX, IDC_EDIT_NOISE_FREQUENCY, m_dblNoiseFreq);
	DDX_Text(pDX, IDC_EDIT_SAMPLING_FREQUENCY, m_dblSamplingFreq);
	DDX_Text(pDX, IDC_EDIT_SIGNAL_AMPLITUDE, m_dblSignalA);
	DDX_Text(pDX, IDC_EDIT_SIGNAL_FREQUENCY, m_dblSignalFreq);
	DDX_Radio(pDX, IDC_RADIO_FILTER_TYPE, m_nFilterType);
	DDX_Radio(pDX, IDC_RADIO_WINDOW_TYPE, m_nWindowType);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgFilter, CDialog)
	//{{AFX_MSG_MAP(CDlgFilter)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	ON_BN_CLICKED(IDC_RADIO_FILTER_TYPE, OnRadioFilterType)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgFilter message handlers

void CDlgFilter::OnRadioFilterType() 
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_EDIT_CUTOFF_WH)->EnableWindow(false);
}

void CDlgFilter::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_EDIT_CUTOFF_WH)->EnableWindow(false);
}

void CDlgFilter::OnRadio3() 
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_EDIT_CUTOFF_WH)->EnableWindow(true);
}

void CDlgFilter::OnRadio4() 
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_EDIT_CUTOFF_WH)->EnableWindow(true);
}

BOOL CDlgFilter::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	if(m_nFilterType < 2)
		GetDlgItem(IDC_EDIT_CUTOFF_WH)->EnableWindow(false);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -