📄 yangdlg.cpp
字号:
// yangDlg.cpp : implementation file
//
#include "stdafx.h"
#include "yang.h"
#include "yangDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CYangDlg dialog
CYangDlg::CYangDlg(CWnd* pParent /*=NULL*/)
: CDialog(CYangDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CYangDlg)
// 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 CYangDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CYangDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CYangDlg, CDialog)
//{{AFX_MSG_MAP(CYangDlg)
ON_BN_CLICKED(IDC_BTN_RECORD, OnBtnRecord)
ON_BN_CLICKED(IDC_BTN_PLAY, OnBtnPlay)
ON_BN_CLICKED(IDC_BTN_STOP, OnBtnStop)
ON_BN_CLICKED(IDC_BTN_STOPPLAY, OnBtnStopplay)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CYangDlg message handlers
BOOL CYangDlg::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
pSoundPlayer->CSoundBase::GetInstance(); //获取player实例
return TRUE; // return TRUE unless you set the focus to a control
}
void CYangDlg::OnBtnRecord()
{
//TODO: Add your control notification handler code here
WAVEFORMAT_SETTING waveFormat;
waveFormat.channel = CHANNEL_SINGLE;
waveFormat.samples = SAMPLES_22050;
waveFormat.bits = BITS_16;
pSoundPlayer->Record(TEXT("record\first.wav"),&waveFormat);
//pSoundPlayer->Record(TEXT("record\first.wav"));
}
void CYangDlg::OnBtnPlay()
{
// TODO: Add your control notification handler code here
pSoundPlayer->Play(TEXT("record\first.wav"));
}
void CYangDlg::OnBtnStop()
{
// TODO: Add your control notification handler code here
pSoundPlayer->StopRecording();
}
void CYangDlg::OnBtnStopplay()
{
// TODO: Add your control notification handler code here
pSoundPlayer->StopPlaying();
}
void CYangDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
pSoundPlayer->~CSoundBase();
CDialog::OnClose();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -