How can you change Window's active recording device using C++?

662 Views Asked by At

Specifics on WHY I want to do this to help you understand my dilemma:

I have enjoyed the ability to change my recording device to stereo mix in Skype calls so that the people can hear my audio. This is a useful tool for sharing music/other audio.

I would really like to compile this into a soundboard program, so I can press a button and have the device switch to stereo mix, play a sound, and switch back.

Simple enough, but I cannot find a way to change the recording device using a program.

This question is exactly what I would have wanted answered, but it wasn't. How can I write software to play sound clips routed into the recording device?

Also another thread ( Select recording device in C++ (Windows) ) taught me how to find out how many recording devices I have, but without actually telling me how to change them.

An acceptable answer is that there is no simple way to do this without bypassing security Windows has in place.

1

There are 1 best solutions below

0
On

Applications like Skype bind to specific audio device and use it for recording/playback purposes. For instance, if Skype user selected Stereo Mix to be microphone device under Audio Settings, then would any other application be able to switch that to something else? It is not even Windows security, it's more than this - you would be trying to interfere between the application and API in use.

The more or less clean way to implement this is a virtual device which you fully control and, specifically, you forward data from/to real device there. Similarly to Stereo Mix, imagine a "My Switchable Mic" device which is selected on Skype, and Skype is taking data from. This is already built into Skype and as long as device implementation follows standard implications, Skype will be able to get data from there. From there you are free to do real capture from another audio source, receive from network, mix, synthesize waveform whatsoever. Yes you can switch underlying devices on the fly as well - it is all under your control. This way it is going to work.

Standard API does not let you fool applications and falsify audio devices and data.