hmmio m_hmmio; // mm i/o handle for the wave
mmckinfo m_ck; // multimedia riff chunk
mmckinfo m_ckriff; // use in opening a wave file
dword m_dwsize; // the size of the wave file
mmioinfo m_mmioinfoout;
dword m_dwflags;
bool m_bisreadingfrommemory;
byte* m_pbdata;
byte* m_pbdatacur;
ulong m_uldatasize;
char* m_presourcebuffer;
protected:
hresult readmmio();
hresult writemmio( waveformatex *pwfxdest );
public:
cwavefile();
~cwavefile();
hresult open( lpctstr strfilename, waveformatex* pwfx, dword dwflags );
hresult openfrommemory( byte* pbdata, ulong uldatasize,
waveformatex* pwfx, dword dwflags );
hresult close();
hresult read( byte* pbuffer, dword dwsizetoread, dword* pdwsizeread );
hresult write( uint nsizetowrite, byte* pbdata, uint* pnsizewrote );
dword getsize();
hresult resetfile();
waveformatex* getformat() { return m_pwfx; };
};
我们有了这两个强有力的类的支持就可以开始我们的编程工作了….
1.用vc6++建立一个mfc基于对话框的工程:micdemo;
2.添加我们的两个类csoundin,cwavefile;

3.当我们点击开始(start)按钮的时候我们就要开始录音了…
void cmicdemodlg::onstart()
{
// todo: add your control notification handler code here
m_btnstart.enablewindow(false);
if(thesoundcapture().__initmic())
{
m_filepath.setwindowtext(_t("yangchen.wav."));
thesoundcapture().__createoutputwavefile(_t("yangchen.wav"));
if(!thesoundcapture().__openmic())
{
::messagebox(this->m_hwnd,
_t("can not open microphone!"),
_t("error"),mb_ok|mb_iconerror);
return;
}
}
m_btnstop.enablewindow(true);