XP下,麦克风加强
[cpp]bool CMicrophoneEnhance::SetEnhance(bool enhance, DWORD type)
{
<span style="white-space:pre"> </span>MIXERLINE line, sub_line;
<span style="white-space:pre"> </span>ZeroMemory(&line, sizeof(MIXERLINE));
<span style="white-space:pre"> </span>ZeroMemory(&sub_line, sizeof(MIXERLINE));
<span style="white-space:pre"> </span>HMIXER hMixer = NULL;
<span style="white-space:pre"> </span>bool result = false;
<span style="white-space:pre"> </span>int devs = ::mixerGetNumDevs();
<span style="white-space:pre"> </span>for(int i=0; i<devs; ++i)
<span style="white-space:pre"> </span>{<span style="white-space:pre"> </span>//
<span style="white-space:pre"> </span>if (::mixerOpen(&hMixer, i, (DWORD)0, 0, CALLBACK_WINDOW) != MMSYSERR_NOERROR)
<span style="white-space:pre"> </span>{
<span style="white-space:pre"> </span>hMixer = NULL;
<span style="white-space:pre"> </span>continue;
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>line.cbStruct<span style="white-space:pre"> </span>= sizeof(MIXERLINE);
<span style="white-space:pre"> </span>line.dwComponentType = type;
<span style="white-space:pre"> </span>if(::mixerGetLineInfo((HMIXEROBJ)hMixer,&line, MIXER_GETLINEINFOF_COMPONENTTYPE)!= MMSYSERR_NOERROR)
<span style="white-space:pre"> </span>{
<span style="white-space:pre"> </span>::mixerClose(hMixer);
<span style="white-space:pre"> </span>hMixer = NULL;
<span style="white-space:pre"> </span>continue;
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>if(line.cConnections == 0)
<span style="white-space:pre"> </span>{
<span style="white-space:pre"> </span>::mixerClose(hMixer);
<span style="white-space:pre"> </span>hMixer = NULL;
<span style="white-space:pre"> </span>continue;
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>int connections = line.cConnections;
<span style="white-space:pre"> </span>for(int j=0; j<connections; ++j)
<span style="white-space:pre"> </span>{
<span style="white-space:pre"> </span>sub_line<span style="white-space:pre"> </span>= line;
<span style="white-space:pre"> </span>sub_line.dwSource<span style="white-space:pre"> </span>= j;
<span style="white-space:pre"> </span>mixerGetLineInfo((HMIXEROBJ)hMixer, &sub_line, MIXER_GETLINEINFOF_SOURCE);
<span style="white-space:pre"> </span>MIXERCONTROL<span style="white-space:pre"> </span>mxc;
<span style="white-space:pre"> </span>MIXERLINECONTROLS<span style="white-space:pre"> </span>mxlc;
<span style="white-space:pre"> </span>mxlc.cbStruct = sizeof(mxlc);
<span style="white-space:pre"> </span>mxlc.dwLineID = sub_line.dwLineID;
<span style="white-space:pre"> </span>mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_ONOFF;
<span style="white-space:pre"> </span>mxlc.cControls = sub_line.cControls;
<span style="white-space:pre"> </span>mxlc.cbmxctrl = sizeof(MIXERCONTROL);
<span style="white-space:pre"> </span>mxlc.pamxctrl = &mxc;
<span style="white-space:pre"> </span>if (MMSYSERR_NOERROR != ::mixerGetLineControls((HMIXEROBJ)hMixer, &mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE))
<span style="white-space:pre"> </span>{
<span style="white-space:pre"> </span>continue;
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>
<span style="white-space:pre"> </span>CString strName = mxc.szName;
<span style="white-space:pre"> </span>strName.MakeUpper();
<span style="white-space:pre"> </span>if(-1 != strName.Find(_T("BOOST")) ||
<span style="white-space:pre"> </span>-1 != strName.Find(_T("麦克风加强")) ||
<span style="white-space:pre"> </span>-1 != strName.Find(_T("20DB")))
<span style="white-space:pre"> </span>{
补充:软件开发 , C++ ,