How to capture audio on c++ UWP app with WASAPI? RRS feed

  • Question

  • I can't seem to find any tutorial on the internet for my question.
    All the simple guide is not suitable for UWP. For Example,
    To use WASAPI there are these steps

    • enumerate devices
    • capture audio
    • play (render) audio back

    But for enumerating a device, The client must call CoCreateInstance. But from my understanding this function is not support in UWP.

    So, I found This, UWP C++ using WASAPI, But I can't find any Enumerate part and this project is very complicate for me.
    It include a lot of other files (DeviceState.h, common.h)

    For me, a beginner for audio programming, this is like the hardest text book in my life.

    My question is how can I capture audio on c++ UWP app with WASAPI?
    If this question is too board, I will change my question to How to enumerate audio device in c++ UWP application?.
    And the reason why I use WASAPI is because I want to access the data stored in the Buffer.

    Friday, November 30, 2018 8:21 AM

All replies

  • Hello order88,

    Actually the following line: https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/WindowsAudioSession/cpp/Scenario1.xaml.cpp#L85 

    Already mentioned how you can enumerate the device, were you trying to find this?

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 3, 2018 8:12 AM