Search code examples
audio-recordingmicrosoft-metrowasapi

audio capture in metro apps


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 ?


Solution

  • 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...