1

I'm trying to figure out how to grab the individual audio streams as they appear in the audio mixer to reroute them to an aggregate audio device. I'm specifically looking to keep them as discreet streams for the purposes of the program I'm making (If they're muxed down to a 2-channel mix, that defeats the purposes of what I'm trying to achieve.)

E.X.: (As I've just made this account, I apparently am not able to post images, so here's a link to the image)

windows audio mixer

In this, I'm hoping to grab "System Sounds" and "Stream Client Bootstrapper" as discreet audio streams to route elsewhere, while maintaining their original destination as well (essentially copying the audio going to the original audio device to another simultaneously).

I'm looking to do this in either C# or C++. I've perused the audio APIs that microsoft has published, and while some things look to be close to what I'm trying to do, nothing has hit the nail on the head. I appreciate any help. Thanks.

Luke
  • 11
  • 2
  • 1
    Have you looked to see if NAudio (https://github.com/naudio/NAudio) can accomplish what you want? It can enumerate input streams and select those for routing other places (like over a network). See the sample code they provide. – Ron Beyer Apr 29 '15 at 19:27

1 Answers1

1

The sessions can be enumerated using IAudioSessionManager2::GetSessionEnumerator and friends (sample C++ code is here and there). Standard Windows volume mixer application is using this API as well.

The API however has no access to data streams, you won't have either (you certainly don't have data whether they are downmixed or not). Neither you can reroute streams to another device. Applications are not allowed to interfere that deep. The best you can do is to create your own device, interactively select it as default output device and then accept data from applications playing audio through this device.

Community
  • 1
  • 1
Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • 1
    Thanks both of you for answering. It looks like if access to the individual streams isn't possible then what I was looking to build won't be possible either. It was solely dependent on being able to duplicate the discreet audio sources from apps running on the computer and send them to a virtual output device where they can be mixed (a la a form akin to the windows mixer). My intention was to build a solution to live-streaming games where using voice communication with fellow players is crucial, however preventing the other player's voices from being streamed was desired. – Luke Apr 29 '15 at 19:42
  • This would have also applied to anything else that would have been outputting on the same output device from your computer (Such as netflix in a browser or anything else.) It's technically semi-possible via Virtual Audio Cable, but it's buggy at best and doesn't allow separating based on the app, but rather based on what audio output device you select for the app itself. Not all apps have the ability to select anything other than the default device. – Luke Apr 29 '15 at 19:45