[wdmaudiodev] Re: Capturing complete audio stream. Virtual audio device needed?

  • From: Andreas Schmidl <andreas.schmidl@xxxxxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Wed, 15 Sep 2010 19:28:08 +0200

 Hello Matthew!

Thank you very much, for you help! I think WASAPI loopback recording is a very good idea, getting the audio stream, with minimal latency and without needing a kernel mode driver.

I checked the WASAPI and loopback recording. It looks like a very good interface for capturing the post-mix audio stream. I also checked you samples, but I get the following error, after a short period of time (1 -2 sec): IAudioCaptureClient::GetBuffer set flags to 0x00000001 on pass 718 after 343680 frames
The thread terminated early - something bad happened
Thread HRESULT is 0x8000ffff

Maybe a compatibility problem with Windows 7 Prof x64. But this problem isn't important yet.

Because of the mentioned problem above, I can't check the following scenario: Is it possible to mute the audio output of the render endpoint, which I'm capturing. I want to avoid the situation hearing the sound twice. (Local speaker and the speaker getting the audio stream over network). Because of that, the local audio output must be muted, when loopback recording is in progress.

Once more, thanks your help!

Best regards,

Andreas



On Windows Vista and later, you can use WASAPI loopback recording to get the post-mix stream in PCM format. See, for example:

http://blogs.msdn.com/b/matthew_van_eerde/archive/2008/12/16/sample-wasapi-loopback-capture-record-what-you-hear.aspx

Executive summary:

Get an IAudioClient on the default /render/ endpoint.

Pass the AUDCLNT_STREAMFLAGS_LOOPBACK flag to the IAudioClient::Initialize.

You can now get an IAudio/Capture/Client off of the IAudioClient.

*From:* wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] *On Behalf Of *Andreas Schmidl
*Sent:* Tuesday, September 14, 2010 10:44 AM
*To:* wdmaudiodev@xxxxxxxxxxxxx
*Subject:* [wdmaudiodev] Capturing complete audio stream. Virtual audio device needed?

Hello!

Currently I'm developing an embedded device, which receives an audio stream over ethernet, decode the stream (if necessary) and forward it to the audio output. The audio stream is produced by a Windows PC. I need the "merged" stream of all applications in PCM format. Since one week I'm looking for a possibility to capture this stream and write the data from kernel space back to user space. I installed the WDK and checked the MSVAD (simple) example. The MSVAD example seems like a good solution for capturing the audio stream and transfer the data to user space. With the help of a nt service I want to transfer the data from the buffer over ethernet to the embedded device.

Ok, in theory it looks like a good solution ;-) But in my opinion its really difficult to realize this idea. I never developed a kernel mode driver before. I'm developing software in C/C++ for embedded devices. In the last days I installed all the things, which are needed for kernel mode driver developing (target machine with Windows 7 x86, WDK, Windows Symbols...) I started trying kernel mode debugging via com port and did my first steps with WinDbg.

Before investigating (much) more time in the development of a virtual audio device driver, I want to check if there are other (simpler) solutions to capture the audio stream. I found two already developed virtual audio device drivers. The first one is called "Virtual Audio Cable" and the second one is developed by e2esoft. I checked both, but I'm unsure if they can do the job.

I don't know how to capture the audio stream from Virtual Audio Cable and control the driver with the help of my user space application. Are there any standardized interfaces /functions provided by Windows to capture the stream?

Besides the two drivers I don't know if there are any other options capturing the audio stream. Maybe a third party framework, a "Windows sound framework" or functions of the Win32 API? But it's necessary to capture the whole "mixed" audio stream from all running sound applications. (A VLC Plugin to capture the sound of a Video isn't the solution).

I hope you can help me, to find a good solution to capture the audio stream.

Thank you for your help!

Best regards,

Andreas


Other related posts: