How can I programatically change the default audio device on a vista / win 7 system? Using C# or a Win API call?
+8
A:
The WinMM API should provide the functionality that you request.
You would use the DRVM_MAPPER_PREFERRED_SET message, which is sent with waveOutMessage() function.
Documentation: http://msdn.microsoft.com/en-us/library/aa909789.aspx
However, if you are trying to send the waveform sound out yourself, you should look at the WinMM.Net library.
John Gietzen
2009-10-12 15:18:22
All I need to do is change the sound device on Windows, so that all audio routes through that device. Essentially I have a lot of sound devices on my system, and I want to replace the default sys tray app, so that I don't need to right click , open the device manager each time I need to switch a device. Will this API do this?
JL
2009-10-12 15:28:02
Yes, You can set the default audio playback device in XP with the DRVM_MAPPER_PREFERRED_SET message, which is sent with waveOutMessage(). This doesn't work in Vista. I am researching.
John Gietzen
2009-10-12 16:04:54
Thanks, I think this last link will work, it should port to win 7 hopefully!
JL
2009-10-12 16:19:00
Love that last link! It's been driving nuts in Win7 having to launch the Playback devices dialog every time I want to switch from headphones to speakers, and vice-versa. Much easier now. Thanks!
Ecyrb
2010-01-04 21:12:17
A:
Ecyrb: It sounds like you were able to change the default audio device in Win7 using winmm.net? I have built the Winmm.net project from the link in Win7, but I cannot find a method that will change the default system device? Can you please point me in the right direction?
Trevor Meyer
2010-06-06 21:02:12