我可以创建一个磁贴来更改我的默认音频设备吗?

cor*_*n01 4 windows-8 live-tiles

我想在扬声器和耳机之间轻松切换。这可能吗?

ron*_*chn 7

有多种方法可以切换默认音频设备。但是,由于没有为此发布的 API,这些技术主要涉及尝试发送密钥之类的 hack ,这不是很健壮。

API 保持关闭和未记录,以避免硬件不兼容,这样制造商就不会像浏览器上的默认主页一样争夺它。然而,有人设法在 Windows 7 的命令行上切换音频设备,并且在评论中 WarNov 已经“在 Windows 8 中对其进行了测试。完美运行”

请记住,它使用的是未公开的 API,因此可能会在 Windows 的未来版本中中断。

正如 Jerry 已经提到的,您可以使用 tile创建快捷方式,只需让它调用 C++ 代码即可。如果你想在 .NET 中使用它,你也可以使用 wrapper

该代码也作为AudioEndPointController发布在 GitHub 上,并附有关于如何使用它的易于理解的文档:

> EndPointController.exe --help
Lists active audio end-point playback devices or sets default audio end-point
playback device.

USAGE
  EndPointController.exe [-a] [-f format_str]  Lists audio end-point playback
                                               devices that are enabled.
  EndPointController.exe device_index          Sets the default playback device
                                               with the given index.

OPTIONS
  -a             Display all devices, rather than just active devices.
  -f format_str  Outputs the details of each device using the given format
                 string. If this parameter is ommitted the format string
                 defaults to: "Audio Device %d: %ws"

                 Parameters that are passed to the 'printf' function are
                 ordered as follows:
                   - Device index (int)
                   - Device friendly name (wstring)
                   - Device state (int)
                   - Device default? (1 for true 0 for false as int)
                   - Device description (wstring)
                   - Device interface friendly name (wstring)
                   - Device ID (wstring)''
Run Code Online (Sandbox Code Playgroud)

它还包装有PlaybackDevice [音频输出开关]