vc6 xp下麦克风加强

bool SetEnhance(bool enhance, DWORD type) 

MIXERLINE line, sub_line; 
ZeroMemory(&line, sizeof(MIXERLINE)); 
ZeroMemory(&sub_line, sizeof(MIXERLINE)); 




HMIXER hMixer = NULL; 
bool result = false; 
int devs = ::mixerGetNumDevs(); 
for(int i=0; i<devs; ++i) 

if (::mixerOpen(&hMixer, i, (DWORD)0, 0, CALLBACK_WINDOW) != MMSYSERR_NOERROR)  

hMixer = NULL; 
continue; 

line.cbStruct = sizeof(MIXERLINE); 
line.dwComponentType = type; 
if(::mixerGetLineInfo((HMIXEROBJ)hMixer,&line, MIXER_GETLINEINFOF_COMPONENTTYPE)!= MMSYSERR_NOERROR) 

::mixerClose(hMixer); 
hMixer = NULL; 
continue; 





if(line.cConnections == 0)  

::mixerClose(hMixer); 
hMixer = NULL; 
continue; 

int connections = line.cConnections; 
for(int j=0; j<connections; ++j) 

sub_line = line; 
sub_line.dwSource= j; 
mixerGetLineInfo((HMIXEROBJ)hMixer, &sub_line, MIXER_GETLINEINFOF_SOURCE); 




MIXERCONTROL mxc; 
MIXERLINECONTROLS mxlc; 
mxlc.cbStruct = sizeof(mxlc); 
mxlc.dwLineID = sub_line.dwLineID; 
mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_ONOFF; 
mxlc.cControls = sub_line.cControls; 
mxlc.cbmxctrl = sizeof(MIXERCONTROL); 
mxlc.pamxctrl = &mxc; 
if (MMSYSERR_NOERROR != ::mixerGetLineControls((HMIXEROBJ)hMixer, &mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE)) 

continue; 



CString strName = mxc.szName; 
strName.MakeUpper(); 
if(-1 != strName.Find(_T("BOOST")) || 
-1 != strName.Find(_T("麦克风加强")) || 
-1 != strName.Find(_T("20DB"))) 

MIXERCONTROLDETAILS_BOOLEAN enh[2]; 
MIXERCONTROLDETAILS mxcd; 
mxcd.cMultipleItems = 0; 
mxcd.dwControlID = mxc.dwControlID; 
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS); 
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN); 
mxcd.paDetails = enh; 
mxcd.cChannels = sub_line.cChannels; 




if(MMSYSERR_NOERROR != mixerGetControlDetails((HMIXEROBJ)hMixer, &mxcd, MIXER_OBJECTF_HMIXER|MIXER_GETCONTROLDETAILSF_VALUE)) 

ASSERT(false); 
break; 

enh[0].fValue = enhance?1:0; 
enh[1].fValue = enhance?1:0; 
if(MMSYSERR_NOERROR != mixerSetControlDetails((HMIXEROBJ)hMixer, &mxcd, MIXER_OBJECTF_HMIXER|MIXER_SETCONTROLDETAILSF_VALUE)) 

ASSERT(false); 
break; 

result = true; 


::mixerClose(hMixer); 
hMixer = NULL; 


return result; 


SetEnhance(true, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS); 

SetEnhance(true, MIXERLINE_COMPONENTTYPE_DST_WAVEIN) ;




http://www.2cto.com/kf/201209/152992.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值