www.pudn.com > audioTest.rar > WaveInterface.cpp
// WaveInterface.cpp: implementation of the CWaveInterface class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "WaveInterface.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif #include#pragma comment(lib,"winmm.lib") //这个务必要加上的 ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// UINT CWaveInterface::GetWaveInCount() { return waveInGetNumDevs(); } //////////////////////// CString CWaveInterface::GetWaveInName(UINT nIndex) { ASSERT(nIndex < GetWaveInCount()); WAVEINCAPS tagCaps;//音频输入设备的相关信息 switch(waveInGetDevCaps(nIndex,&tagCaps,sizeof(tagCaps))) { case MMSYSERR_NOERROR: return tagCaps.szPname;//指定设备的产品名称 break; default: return ""; } } ////////////////////////////////////////////////////////////////////// UINT CWaveInterface::GetWaveOutCount() { return waveOutGetNumDevs(); } ////////////////////////////////////////////////////////////////////// CString CWaveInterface::GetWaveOutName(UINT nIndex) { ASSERT(nIndex < GetWaveOutCount()); WAVEOUTCAPS tagCaps; switch (waveOutGetDevCaps(nIndex, &tagCaps, sizeof(tagCaps))) { case MMSYSERR_NOERROR: return tagCaps.szPname; break; default: return ""; } }