Re: Is Loopback recording possible ?
Dmitry Kostjuchenko <dmitrykos <at> inbox.lv>
2010-05-07 19:07:05 GMT
I would advise to check WDMKS API which will provide the functionality you are looking for, but WDMKS will
be an easy task. You could get more info from MSDN and check the lowest OS version which supports WDMKS.
To my regret I do not have any examples but probably you could find some on MSDN.
Quoting "Rick Zacharias" <rickz65 <at> fastmail.net>:
> Hi Dmitry,
> Thanks for the information. Currently, my App only analyzes audio, it does
>not create or render audio. And, yes, I need to capture audio like VAC does,
>from different sources. As I understand it, Port Audio will capture
>microphone jack input perfectly on it's on, which I'll need once I build the
>'light show' mode of operation, as it will be connected to the output of
>somebody's soundboard. Currently, it only runs in a 'demo' mode, where the
>audio is come from a music player, like Windows Media Player, or WinAmp.
>I've noticed win7 has a stereo mixer, and when a media player is running
>there is a separate volume control for it, so I'm pretty sure there's a way
>to capture just the audio from a media player, which as you point out will
>then not have windows sounds mixed in. That sounds better than capturing the
>output to speakers, but I still want to be able to do that, and allow the
>user the ability to easily switch what source the App. is 'listening' to.
>This seems possible on win7/Vista but is it possible on XP and 2000.
>Currently, I only have to consider win 2000 sp4 and newer MS OS (due to VC++
>runtime restriction, VS2008 sp1), but will eventually need to consider
> Can you point me to any code samples that would be helpful, for the current
>Windows considerations? I'll worry about Unix/Mac latter.
> Thank You very much !
> -----Original Message-----
> From: portaudio-bounces <at> music.columbia.edu
>[mailto:portaudio-bounces <at> music.columbia.edu] On Behalf Of Dmitry
> Sent: Wednesday, May 05, 2010 7:25 AM
> To: Portaudio Mailing List
> Subject: Re: [Portaudio] Is Loopback recording possible ?
> Hello Rick,
> As to WASAPI loopback recording. PortAudio's WASAPI implementation supports
>loopback capturing from an
> input device which is actually a final end-point (a mixer) before the actual
>audio hardware. In Vista it is usually
> named 'Stereo Mix' and you can find such device in your Audio Control Panel.
>But this mixer is a global device and
> thus you will get all Windows sounds captured.
> If you wish to capture samples from some individual rendering WASAPI devices
>then such feature shall be
> implemented, but there are some portability issues which will prevent doing
>it, read the following:
> A pull-mode capture client does not receive any events when a stream is
>initialized with event-driven buffering and
> is loopback-enabled. To work around this, initialize a render stream in
>event-driven mode. Each time the client
> receives an event for the render stream, it must signal the capture client
>to run the capture thread that reads the
> next set of samples from the capture endpoint buffer.
> All sounds good, except the fact, that Windows Vista x64 has a system bug
>which concerns WOW64 process:
> event-driven mode does not work in WOW64 and event handle is never called.
>To overcome this bug PA library
> automatically detects if WOW64 process is running and falls back to a
>working 2-nd method, I name it Polling,
> Microsoft names it Pull mode. So PA's WASAPI always works on all systems. So
>according MSDN for loopback
> capturing event-driven mode must be used which is in fact a problem under
> Does your application produce audio which you later analyze and etc.? Or you
>need to grasp audio from different
> audio sources similarly to what Virtual Audio Cable driver does for a
> Best regards,
> Quoting Rick Zacharias <rickz65 <at> fastmail.net>:
>> Hi Ross,
>> Thanks for the response and the info. , I didn’t know what VAC was. Sounds
>>like that might be my ideal
> solution, and I figured all I really needed is a ‘read only pointer’ to
>the cyclic buffer buried down in the audio driver
> and wrapped as a virtual input device. I started looking into that in some
>MS documentation I found in the WDK but
> collecting all the necessary info to get a good solution for most machines
>seemed like a huge effort. I’ll look into it
> and see what I can find. If you’d like, I can post-attach my sound.cpp
>file so you can see the code for doing
> this ‘trick’ in WMME and WASAPI, and feel free to use it, although it
>needs a lot of ‘sprucing up’ as it’s all in the
> global namespace, and should be wrapped in a class.
>> From what I can find, JACK is a great thing, provided one is on Linux and
>>everything involved is JACK aware.
>> Thanks for the information about OSX loopback, on that I had no clue.
>> … a link for information on WASAPI loopback is at :
>> and is a half decent stating point, follow the links around on the topic,
>>and you’ll eventually come to a few code
> examples using COM+ that are very helpful, not standard C/C++ but … as MS
>DOCs go, these are rather good
>> I’ll let everybody know what I find about a good VAC to use with Port
>> Let me know if and how you’d like my code posted(copy/pasted into email)
>>or attached ?
>> Thanks Again,
>> From:portaudio-bounces <at> music.columbia.edu
>>[mailto:portaudio-bounces <at> music.columbia.edu] On Behalf Of
> Ross Bencina
>> Sent: Tuesday, May 04, 2010 8:44 PM
>> To: Portaudio Mailing List
>> Subject: Re: [Portaudio] Is Loopback recording possible ?
>> Hi Rick
>> As far as I know PortAudio has no explicit support for loopback recording
>>via WMME (not sure about WASAP) --
> I actually didn't know this required any special coding -- do you have any
>links to information you could share?
> Usually I recommend VAC (virtual audio cable drivers) for this.
>> PortAudio supports JACK which is the usual way to do interapplication audio
>>on Linux I think.
>> To the best of my knowledge OSX doesn't have any native loopback capability.
>>On OSX people seem to
> recommend JACK, Audio Hijack or Soundflower which can all provide loopback
>to any standard CoreAudio app
> (and hence to any PortAudio app).
>>> ----- Original Message -----
>>> From: Rick Zacharias
>>> To: portaudio <at> music.columbia.edu
>>> Sent: Wednesday, May 05, 2010 3:42 AM
>>> Subject: [Portaudio] Is Loopback recording possible ?
>>> Hello, and thank you for developing Port-Audio !
>>> I’m writing an application that has many features, one of which is to
>>>‘listen’ to music and respond graphically,
> like a free-standing visualizer. Currently, I have a set of routines that
>use either WMME or WASAPI to do loopback
> recording, as the source of the music is ‘somebody else’s software’
>and could be anything. For now, the
> Application just runs on windows 2000 – win 7, but I’m looking to port
>to Unix/Mac. The current problem is my
> routines don’t always work, meaning on some systems, they never work,
>versus other systems where they always
> work, so I’m looking for something that works on 99.9% of the systems out
>there(windows boxes), but is portable.
> This has led me to Port Audio, which I’ve got working just fine. No
>Errors, No Warnings, on VS 2008 sp1 run on
> win7 pro 32 bit. The sample recordings using low latency from my rather
>meager condenser Microphone are very
> good, the best I’ve ever heard from it ! I’m very impressed with Port
>Audio, but I can not find any way to handle
> loopback recording. I’ve looked throughout the mailing list posting back
>into 2008, so as not to have you folks
> answer the same thing over and over. Am I even looking in the right place
>for this solution ? Would Port-Mixer be
> the right place ?
>>> Thank You Again,
>>> Rick Zacharias
>>> Author of ManyFractals,
>>> Portaudio mailing list
>>> Portaudio <at> music.columbia.edu
> Portaudio mailing list
> Portaudio <at> music.columbia.edu
> Portaudio mailing list
> Portaudio <at> music.columbia.edu
Portaudio mailing list
Portaudio <at> music.columbia.edu