Change default audio device on Windows 7

前端 未结 2 1671
無奈伤痛
無奈伤痛 2020-12-28 16:10

I want to be able to change the default audio output device on Windows 7 programatically using C# (and probably some underlying Win32 API calls, as well). I\'ve already done

相关标签:
2条回答
  • 2020-12-28 16:29

    Just in case anyone stumbles across this thread in the future... here's some C++ code that'll do it by calling some undocumented Win32 APIs. This can be compiled into an EXE and then called silently from a .NET application, so you could build a .NET program around this code.

    http://web.archive.org/web/20190317012739/http://www.daveamenta.com/2011-05/programmatically-or-command-line-change-the-default-sound-playback-device-in-windows-7/

    0 讨论(0)
  • 2020-12-28 16:38

    A little up-to-date answer, which is compatible with Windows 10.

    This program is able to do it in a beautiful manner (hotkey to switch between pre-selected devices) and is written on C# : SoundSwitch on GitHub

    Some reverse engineering should get you there (for my use this program was just perfect as it is).

    It makes use of that library (same author) which is in C++ : AudioEndpointLibrary on GitHub

    So if you know C++ (which I don't enough), you might go further in the analysis of how it works. Or just use the library like SoundSwitch does.

    0 讨论(0)
提交回复
热议问题