问题描述
我需要在Windows 8 Metro风格的应用程序中执行低级音频捕获.
I need to perform low-level audio capture in my Windows 8 Metro-style app.
我想我需要使用IAudioClient接口,但是如何获取该接口?
I guess I need to use the IAudioClient interface, but how to get that interface?
Microsoft说:客户端通过使用IMMDevice接口中描述的一种技术,获得对音频终结点设备的IAudioClient接口的引用."
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
但是Metro风格的应用程序不支持IMMDevice界面.
but IMMDevice interface is not supported for Metro-style apps.
如何获得IAudioClient接口?
How does one get an IAudioClient interface ?
推荐答案
我从MSDN论坛上得到了答案:
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 );
这个ActivateAudioInterface()对我来说是神秘的-MSDN Library中根本没有对其的引用;搜索的唯一命中是在论坛中...
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...
这篇关于Metro应用中的音频捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!