gpt4 book ai didi

windows - 如何在 Windows 7 中控制麦克风升压?

转载 作者:可可西里 更新时间:2023-11-01 10:27:55 25 4
gpt4 key购买 nike

我正在尝试使用 C/C++ 应用程序中的 MIXER API 来控制 Windows 7 中的麦克风增强(音量/(非)静音),但我没有获得相同的控件。可以使用 WASAPI 完成吗?有人可以推荐任何其他 API 来控制 Windows 7 中的麦克风增强吗?

这就是我到目前为止所写的...

const IID IID_IDeviceTopology = __uuidof(IDeviceTopology);
const IID IID_IPart = __uuidof(IPart);
const IID IID_IAudioAutoGainControl = __uuidof(IAudioAutoGainControl);

HRESULT hr = S_OK;
CoInitialize(NULL);

IMMDeviceEnumerator *deviceEnumerator = NULL;
hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IMMDeviceEnumerator), (LPVOID *)&deviceEnumerator);

IMMDevice *pEndptDev = NULL;

hr = deviceEnumerator->GetDefaultAudioEndpoint(eCapture, eConsole, &pEndptDev);
deviceEnumerator->Release();
deviceEnumerator = NULL;


IDeviceTopology *pDevTopoEndpt = NULL;
IConnector *pConnEndpt = NULL;
IConnector *pConnHWDev = NULL;
IPart *pPartConn = NULL;
IAudioAutoGainControl *pAGC = NULL;
IControlInterface *pControl = NULL;
UINT pCount = 0;
LPCGUID pIID = ;

// Get the endpoint device's IDeviceTopology interface.
hr = pEndptDev->Activate(IID_IDeviceTopology, CLSCTX_ALL, NULL, (void**)&pDevTopoEndpt);

// The device topology for an endpoint device always
// contains just one connector (connector number 0).
hr = pDevTopoEndpt->GetConnector(0, &pConnEndpt);

// Use the connector in the endpoint device to get the
// connector in the adapter device.
hr = pConnEndpt->GetConnectedTo(&pConnHWDev);

// Query the connector in the adapter device for
// its IPart interface.
hr = pConnHWDev->QueryInterface(IID_IPart, (void**)&pPartConn);

// Use the connector's IPart interface to get the
// IDeviceTopology interface for the adapter device.
hr = pPartConn->Activate(CLSCTX_ALL, IID_IAudioAutoGainControl, (void**)&pAGC);
hr = pPartConn->GetControlInterfaceCount(&pCount);
hr = pPartConn->GetControlInterface(pCount - 1, &pControl);
hr = pControl->GetIID((GUID *)pIID);

//BOOL bEnabled = false;
hr = pAGC->SetEnabled(true, pIID);

最佳答案

关于windows - 如何在 Windows 7 中控制麦克风升压?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8905599/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com