naudio / NAudio

Audio and MIDI library for .NET
MIT License
5.47k stars 1.09k forks source link

Rerouting application output to selected device #322

Open lentrodev opened 6 years ago

lentrodev commented 6 years ago

Hi. I would like to reroute output of some applications to selected device. For example the output from game to headphones, output from browser to loudspeakers, etc. How I can realize that idea, and this possible with this library or not?

markheath commented 6 years ago

No, I'm afraid that's not possible with NAudio. You'd need a virtual audio driver to be able to do that.

anmiles commented 4 years ago

@markheath Isn't is possible in Windows 10? They added an interface to assign application to audio devices in Settings. I'd love to be able to do this programmatically using NAudio. Isn't there a way to re-assign Session to another EndPoint?

markheath commented 4 years ago

It's not something I'm aware of, but it is of course quite possible that there are new WASAPI interfaces that support this. If there are, then perhaps we could create interop wrappers for them.

jwallet commented 4 years ago

maybe he wants something like audiorouter but available as a nugget package. it would be neat to have an app router like this in NAudio

markheath commented 4 years ago

Looks a really interesting project - I've not seen it before. Maybe that could be done in C# - would need to dive into the implementation in more detail

jwallet commented 2 years ago

it works, I did use the solution from SoundDeck, SoundDeck also uses nAudio.

commit: https://github.com/jwallet/spy-spotify/commit/6d428a62025ae41ef6ebbe1a671544dc2cf948aa note: MainAudioSession.cs - it's where I added the functionnality "AudioRouter" to perform audio routing

So, it's possible to reroute other app audio session to another audio device