classrecordtestdlg.cpp

来自「一个在PXA-270下的WinCE录音程序」· C++ 代码 · 共 93 行

CPP
93
字号
// ClassRecordTestDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ClassRecordTest.h"
#include "ClassRecordTestDlg.h"


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

/////////////////////////////////////////////////////////////////////////////
// CClassRecordTestDlg dialog

CClassRecordTestDlg::CClassRecordTestDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CClassRecordTestDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CClassRecordTestDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CClassRecordTestDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CClassRecordTestDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CClassRecordTestDlg, CDialog)
	//{{AFX_MSG_MAP(CClassRecordTestDlg)
	ON_BN_CLICKED(IDC_BTN_RECORD, OnBtnRecord)
	ON_BN_CLICKED(IDC_BTN_STOP, OnBtnStop)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CClassRecordTestDlg message handlers

BOOL CClassRecordTestDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen

	// TODO: Add extra initialization here
	m_pPlayer = CSoundBase::GetInstance();
	return TRUE;  // return TRUE  unless you set the focus to a control
}



void CClassRecordTestDlg::OnBtnRecord() 
{
	// TODO: Add your control notification handler code here
	WAVEFORMAT_SETTING waveFormat;
	waveFormat.bits = BITS_16;
	waveFormat.channel = CHANNEL_SINGLE;
	waveFormat.samples = SAMPLES_22050;
	if(m_pPlayer->Record(TEXT("waveTest.wav"),&waveFormat) == FALSE)
	{
		::MessageBox(NULL,TEXT("FAILED"),TEXT(""),MB_OK);
	}
}

void CClassRecordTestDlg::OnBtnStop() 
{
	// TODO: Add your control notification handler code here
	m_pPlayer->StopAll();
	
}

void CClassRecordTestDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	if(m_pPlayer->Play(TEXT("buzhide.wav")) == FALSE)
	{
		::MessageBox(NULL,TEXT("FAILE"),TEXT(""),MB_OK);
	}
}

⌨️ 快捷键说明

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