www.pudn.com > hmmPlatform.rar > PlatformView.h
// PlatformView.h : CPlatformView 类的接口
//
#pragma once
#include "afxwin.h"
#include "wavedisplay.h"
#include "WaveConvertor.h"
#include "FileWaveOut.h"
#include "BufferWaveOut.h"
#include "WaveConvertor.h"
#include "SettingDlg.h"
#include "SmallFileWaveOut.h"
#include "LargeFileWaveOut.h"
#include "Speech.h"
#include "SectionDlg.h"
#include "ClusterDlg.h"
#include "AddModelDlg.h"
#include "TrainModelDlg.h"
#include "DemoHMMDlg.h"
//////////////////////////////////////////////////////////////////////////
// 定义显示类型
typedef enum _displayType
{
DisplayWave = 0, // 显示时域波形
DisplayZero, // 显示短时平均过零率
DisplayPower, // 显示短时能量
DisplayVibration, // 显示平均振幅
DisplaySpectrum, // 显示功率谱
DisplayLogSpectrum, // 显示对数功率谱
DisplayCepstrum, // 显示倒谱
DisplayAfterWindow, // 显示加窗后的时域波形
DisplayBeforeWindow // 显示加窗前的时域波形
} DisplayType;
class CPlatformView : public CFormView
{
protected: // 仅从序列化创建
CPlatformView();
DECLARE_DYNCREATE(CPlatformView)
public:
enum{ IDD = IDD_PLATFORM_FORM };
// 属性
public:
CPlatformDoc* GetDocument() const;
// 操作
public:
// 重写
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
virtual void OnInitialUpdate(); // 构造后第一次调用
// 实现
public:
virtual ~CPlatformView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
public:
//////////////////////////////////////////////////////////////////////////
// 更改显示区域大小
afx_msg void OnSize(UINT nType, int cx, int cy);
public:
afx_msg void OnFileOpen();
afx_msg void OnBnClickedControlLoad();
private:
// 波形显示区域
CWaveDisplay m_ctlDisplay;
// 按帧播放文件
CSmallFileWaveOut m_fileWaveOut;
// 显示方式类型
DisplayType m_displayType;
// 显示参数设定窗口
CSettingDlg m_dlgSetting;
// 端点检测显示窗口
CSectionDlg m_dlgSection;
// VQ显示窗口
CClusterDlg m_dlgCluster;
// 当前正在分析的文件路径
CString m_strWaveFile;
private:
// 每帧所包含样本数
UINT m_nFrameSize;
// 当前正在播放的帧编号
UINT m_nCurrentFrame;
// 总帧数
UINT m_nTotalFrames;
public:
afx_msg void OnDisplayOption();
afx_msg void OnBnClickedControlPrevious();
afx_msg void OnBnClickedControlNext();
afx_msg void OnBnClickedControlStop();
afx_msg void OnBnClickedControlPlay();
afx_msg void OnDisplayWave();
afx_msg void OnDisplayZero();
afx_msg void OnDisplayPower();
afx_msg void OnDisplayVibration();
afx_msg void OnUpdateDisplayWave(CCmdUI *pCmdUI);
afx_msg void OnUpdateDisplayZero(CCmdUI *pCmdUI);
afx_msg void OnUpdateDisplayPower(CCmdUI *pCmdUI);
afx_msg void OnUpdateDisplayVibration(CCmdUI *pCmdUI);
private:
//////////////////////////////////////////////////////////////////////////
// 是否允许使用wav控制功能
void EnableControl(BOOL bEnabled = TRUE);
//////////////////////////////////////////////////////////////////////////
// 按帧查看是否可用
void EnableFrameControl(
BOOL bPre = TRUE, // 上一帧
BOOL bNext = TRUE // 下一帧
);
//////////////////////////////////////////////////////////////////////////
// 显示指定帧或全部裸音频数据的相应波形
void UpdateDisplay(
BOOL bDisplayByFrame = FALSE, // 是否按帧显示
unsigned int nFromFrame = 0, // 起始帧
unsigned int nToFrame = 0 // 结束帧
);
//////////////////////////////////////////////////////////////////////////
// 更新帧数信息
void UpdateFrameControl(
BOOL bReset = FALSE // 是否重新计算帧数
);
public:
afx_msg void OnDisplayZoomin();
afx_msg void OnDisplayZoomout();
afx_msg void OnDisplaySpectrum();
afx_msg void OnUpdateDisplaySpectrum(CCmdUI *pCmdUI);
afx_msg void OnDisplayLogspectrum();
afx_msg void OnUpdateDisplayLogspectrum(CCmdUI *pCmdUI);
afx_msg void OnDisplayCepstrum();
afx_msg void OnUpdateDisplayCepstrum(CCmdUI *pCmdUI);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg void OnBnClickedControlDisplaywaveAll();
private:
// 显示波形的相关信息
CString m_strResult;
public:
// 显示波形的相应信息
void UpdateResult(double* pData, unsigned int nCount, DisplayType disType);
afx_msg void OnSectionEnd();
afx_msg void OnSectionSy();
// 显示VQ结果
afx_msg void OnVqKmeans();
// 添加HMM模型
afx_msg void OnHmmAddmodel();
afx_msg void OnHmmTrainmodel();
afx_msg void OnHmmDemo();
afx_msg void OnDisplayAfterwindow();
afx_msg void OnUpdateDisplayBeforewindow(CCmdUI *pCmdUI);
afx_msg void OnUpdateDisplayAfterwindow(CCmdUI *pCmdUI);
afx_msg void OnDisplayBeforewindow();
};
#ifndef _DEBUG // PlatformView.cpp 的调试版本
inline CPlatformDoc* CPlatformView::GetDocument() const
{ return reinterpret_cast(m_pDocument); }
#endif