p-rivero / DiscordAudioStream

Windows utility for streaming (with audio!) in Discord. Easily share the the audio of entire screen, or even use OBS for streaming!
GNU General Public License v3.0
180 stars 7 forks source link

Stream fails to start when VB-Audio Virtual Cable is set as audio source #13

Closed DeltaDizzy closed 1 year ago

DeltaDizzy commented 1 year ago

Video capture is set to the OBS Windowed Projector, and when I set the audio source to VB-Audio Virtual Cable and attempt to start the stream, it throws an exception and the stream does not start. DiscordAudioStream_stack_trace.txt DiscordAudioStream_log.txt

p-rivero commented 1 year ago

TLDR: The usage instructions say that you need an unused audio device. The device you are trying to capture is being used.


The error code 0x8889000A is AUDCLNT_E_DEVICE_IN_USE, which means that this audio device is already being used by another program, so it can't be captured by DiscordAudioStream. This makes sense, because you are trying to open VB-Audio Virtual Cable INPUT, which is a virtual audio device that is being read constantly (to copy all its sounds to the VB-Audio Virtual Cable OUTPUT virtual mic).

So, your current setup would look something like this:

1 (Notice how several apps can listen to the same microphone, but in general 2 apps cannot capture the same audio device)

There are 2 possible solutions:

1. Consider if you really need VB-Audio Virtual Cable: Depending on your use case, you may be able to replace VB-Audio Virtual Cable with DiscordAudioStream, since both work similarly. The only difference is that VB-Audio Virtual Cable creates a virtual microphone to output the audio, while DiscordAudioStream outputs the audio directly as program sounds.

This means that outputting the audio to your speakers/headphones is much easier (just change the output device in Windows volume mixer), but you cannot trick other apps into thinking that this audio is coming from a microphone. For instance, if you are using Discord, you would need to click "Share your screen" and select the DiscordAudioStream window (as explained in the usage instructions).

2

2. Use with VB-Audio Virtual Cable: If you really need to use it, there's a way to make this work. However, keep in mind that you are stacking several layers of processing, so you might notice some delay from the time you see an action on screen until you hear the corresponding audio.

3

DeltaDizzy commented 1 year ago

Hi and thanks, but this I suppose feeds into a secondary issue that necessitated this setup. The audio is coming into the computer via a capture card (which does create its own audio input visible in the windows mixer), but the card's audio source does not appear for selection in the DiscordAudioStream input dropdown. If it was, the cable would indeed be unnecessary.

p-rivero commented 1 year ago

I see. I'm not very familiar with capture cards, could you attach a screenshot of the windows volume mixer so I get a better idea?

DeltaDizzy commented 1 year ago

The input list or something else too? image

p-rivero commented 1 year ago

Ok, now this makes more sense. It doesn't appear in the input dropdown because DiscordAudioStream only looks for audio output devices, since that's what made sense for my original use case. I didn't anticipate someone using an audio capture card.

I have added the option to also record audio from microphones and capture cards. You can download the latest pre-release and tell me if it works for you.

It's disabled by default, because in most cases capturing a microphone is probably not what the user wants. You have to open the settings and go to the Debug tab. Select the "Show audio input devices" checkbox, then your capture card should appear in the audio capture dropdown.

Edit: Now that I think of it, this feature also allows using DiscordAudioStream together with VB-Audio Virtual cable without needing an unused audio device. Just capture the "Cable OUTPUT" virtual microphone. Of course, in your particular case you shouldn't need to do this, since you can capture the audio card directly.

DeltaDizzy commented 1 year ago

That prerelease fixed it, thanks a bunch!