Enhance the microphone in XP

Source: Internet
Author: User

[Cpp]
Bool CMicrophoneEnhance: SetEnhance (bool enhance, DWORD type)
{
<Span style = "white-space: pre"> </span> MIXERLINE, 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 ("microphone enhancement") |
<Span style = "white-space: pre"> </span>-1! = StrName. Find (_ T ("20DB ")))
<Span style = "white-space: pre"> </span> {
<Span style = "white-space: pre"> </span> MIXERCONTROLDETAILS_BOOLEAN enh [2];
<Span style = "white-space: pre"> </span> MIXERCONTROLDETAILS <span style = "white-space: pre"> </span> mxcd;
<Span style = "white-space: pre"> </span> mxcd. cMultipleItems = 0;
<Span style = "white-space: pre"> </span> mxcd. dwControlID <span style = "white-space: pre"> </span> = mxc. dwControlID;
<Span style = "white-space: pre"> </span> mxcd. cbStruct <span style = "white-space: pre"> </span> = sizeof (MIXERCONTROLDETAILS );
<Span style = "white-space: pre"> </span> mxcd. cbDetails <span style = "white-space: pre"> </span> = sizeof (MIXERCONTROLDETAILS_BOOLEAN );
<Span style = "white-space: pre"> </span> mxcd. paDetails <span style = "white-space: pre"> </span> = enh;
<Span style = "white-space: pre"> </span> mxcd. cChannels <span style = "white-space: pre"> </span> = sub_line.cChannels;
 
 
<Span style = "white-space: pre"> </span> if (MMSYSERR_NOERROR! = MixerGetControlDetails (HMIXEROBJ) hMixer, & mxcd, MIXER_OBJECTF_HMIXER | MIXER_GETCONTROLDETAILSF_VALUE ))
<Span style = "white-space: pre"> </span> {
<Span style = "white-space: pre"> </span> ASSERT (false );
<Span style = "white-space: pre"> </span> break;
<Span style = "white-space: pre"> </span>}
<Span style = "white-space: pre"> </span> enh [0]. fValue = enhance? 1:0;
<Span style = "white-space: pre"> </span> enh [1]. fValue = enhance? 1:0;
<Span style = "white-space: pre"> </span> if (MMSYSERR_NOERROR! = MixerSetControlDetails (HMIXEROBJ) hMixer, & mxcd, MIXER_OBJECTF_HMIXER | MIXER_SETCONTROLDETAILSF_VALUE ))
<Span style = "white-space: pre"> </span> {
<Span style = "white-space: pre"> </span> ASSERT (false );
<Span style = "white-space: pre"> </span> break;
<Span style = "white-space: pre"> </span>}
<Span style = "white-space: pre"> </span> result = true;
<Span style = "white-space: pre"> </span>}
<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>}
 
 
<Span style = "white-space: pre"> </span> return result;
}
[Cpp]
CMicrophoneEnhance microphoneEnhance;
[Cpp] view plaincopy
MicrophoneEnhance. SetEnhance (true, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS );
[Cpp]
MicrophoneEnhance. SetEnhance (true, MIXERLINE_COMPONENTTYPE_DST_WAVEIN)
[Cpp]
 
Currently, you can only use the enumeration method to open all "microphone enhancement" mixlines. If you have a better method, please note!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.