Individually select audio streams

Phaqui

New Member
Requesting functionality to individually select which program(s) to stream audio from. Useful when streaming a game, and you only want to stream the audio from the game and your microphone, while listening to the game sounds and some music from a media player in your headset.

I browsed around on the MSDN, and as far as I could tell, the audio engine runs in a "protected process", and only outputs the mix to a device. This device is what you currently get the "desktop audio" from, which naturally works just fine. However, I couldn't figure out a way to individually get audio from certain programs from the audio engine. Is this even possible?
 

Warchamp7

Forum Admin
Usually for things like this, you'll need to use something like Virtual Audio Cables. You would send the game audio and whatever else you wanted to stream onto a Virtual Cable and set your stream audio to that. Then you'd set up an echo of that virtual cable to your speakers so you can hear it.

They're really useful for doing fancy things like this :)
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
I unfortunately don't see a way of doing it at the moment. There's probably some undocumented way or something, because when you use the windows sound level adjustment app (SndVol.exe) it shows you the active sound levels playing for each app, so it seems that there may be a way, but I don't have any information on it.

Someone could hypothetically disassemble SndVol.exe to find out what APIs is calls to monitor individual app sound levels like it does, though I'm not advocating anything.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
AHEM, I mean.. er, nothing to see here, move along. So I was looking around.. the MSDN, yea. And I found some audio functions that appear to be more low level than the standard windows MMDevice API or something. They are actually documented, but I've never actually heard about them that much. These functions usually begin with waveIn*, waveOut*, mmio*. I think somehow using these functions, it can be achieved. You can actually query the current output apps just like sound volume does with the waveOut* functions.

I really want to experiment with it because I'm actually super interested now, but I'm really busy getting file writing and stuff in. When I get more free time I'll look deeper into it.
 

R1CH

Forum Admin
Developer
Pretty sure this is all contained within the AudioDg.exe process which is a protected process. I looked into this a while ago but didn't see a way to be able to capture a single app. Hooking all the audio calls seems like the only realistic option, but that in itself is far from a good solution.
 

Phaqui

New Member
As I haven't ever used the Windows API directly, I feel like I lack the experience to solve this problem, if it is at all possible using reasonable techniques (i.e. I wouldn't consider either of the "disassembling SndVol.exe"-, or "hooking all audio calls"-methods to be "reasonable" ;)). Besides, the university projects are unfortunately priority #1 for me at the moment.

As far as I can tell, the Sndvol.exe-program is a "user level"-program (for lack of a better term) which uses the API to get the volume and mute-status of every stream on a device. It has no way of grabbing the actual data output by those individual streams.

To dig just a slightly bit deeper, I suspect Sndvol.exe makes use of the IAudioSessionEnumerator to get a list of all audio sessions on a device. It can then get information about each individual session through the IAudioSessionControl interface. You can see that there are no "grab the raw data from this session"-method in there.

If I'm not missing something (and I probably am), it seems this can be fairly difficult to solve. I appreciate the effort so far, and once I have some more spare time, I may dig deeper into this myself.
 

Feign

New Member
I have almost no technical knowledge of these sorts of programs so forgive my ignorance. However, i've been watching streams for many years now and stream myself. I understand you want multiple audio outputs as a streamer but i think it would be a MUCH better scenario if the viewers could select which audio channels to listen to, rather than the streamer.

If OBS could collaborate with the likes of twitch.tv to create a function whereby viewers of all (or just partnership) streams, could toggle which audio channels they would like to listen to from a choice of multiple, i think that would be brilliant. For example, as someone who watches a lot of SC2 / LoL streams, i could toggle on/off the 1.Game sound 2. Microphone of the streamer and 3. Music he/she's listening to.

It may well be a pie in the sky idea with tonnes of obstacles i can't foresee with my limited technical knowledge but i thought it was worth saying.
 
Top