audio capture in metro apps

不打扰是莪最后的温柔 提交于 2019-12-07 08:47:36

问题


I need to perform low-level audio capture in my Windows 8 Metro-style app.

I guess I need to use the IAudioClient interface, but how to get that interface?

Microsoft says "A client obtains a reference to an IAudioClient interface for an audio endpoint device by using one of the techniques described in IMMDevice Interface.."

http://msdn.microsoft.com/en-us/library/windows/desktop/dd370865(v=vs.85).aspx

but IMMDevice interface is not supported for Metro-style apps.

How does one get an IAudioClient interface ?


回答1:


I got an answer from the MSDN forums:

Platform::String^ id = Windows::Media::Devices::MediaDevice::GetDefaultAudioCaptureId(Windows::Media::Devices::AudioDeviceRole::Console );
Microsoft::WRL::ComPtr<IAudioClient> pAudioClient = NULL;
ActivateAudioInterface( id->Data(), __uuidof( IAudioClient ), (void**)&pAudioClient );

This ActivateAudioInterface() is mysterious to me—there are no references to it at all in the MSDN Library; the only hits on searches for it are in the forums...




回答2:


Actually, you should use ActivateAudioInterfaceAsync instead of ActivateAudioInterface. See http://msdn.microsoft.com/en-us/library/windows/desktop/jj128298(v=vs.85).aspx



来源:https://stackoverflow.com/questions/9880569/audio-capture-in-metro-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!