#SingleInstance Force 
	; 指定 SoundVolumeView 的路径
	global SoundVolumeViewPath, devices, currentIndex, command
	SoundVolumeViewPath := "D:\ahk1.0\Lib\soundvolumeview-x64\SoundVolumeView.exe"
	
	devices := ["耳机", "音箱", "手机"]        ; 这些名称应与 SoundVolumeView 中匹配
	currentIndex := 0  ; 当前设备的索引

appskey & F1::
	currentIndex := (currentIndex + 1) > devices.MaxIndex() ? 1 : currentIndex + 1  ; 循环切换      	
	command := SoundVolumeViewPath . " /SetDefault """ . devices[currentIndex] . """ ""Render"""   ; 拼接命令
   /* 
{
    	loop, 1
        	SoundBeep, 400, 10
; 400 声音频率, 可以为表达式. 它是介于 37-32767 之间的数字. 省略则频率为523
; -------------------10 声音的持续时间, 单位为毫秒. 如果省略, 则持续时间为 150     
        	; 显示当前设备名称
        	Text := "⭕    " . devices[currentIndex] . "   ⭕"
        	btt(Text, 600, 10, ,"Style7")
        	sleep, 500
        	btt()
}    
*/
    	loop, 1
        	SoundBeep, 12000, 50
; 400 声音频率, 可以为表达式. 它是介于 37-32767 之间的数字. 省略则频率为523
; -------------------10 声音的持续时间, 单位为毫秒. 如果省略, 则持续时间为 150    
	Text := "🔴 " . devices[currentIndex] . " 🟡 " . devices[currentIndex] . " 🟢 " . devices[currentIndex] . " 🔵"
   	TrayTip     %Text% , 🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁
    	SetTimer, HideTrayTip, 1000                  ;等待1秒关闭通知

HideTrayTip() 
	{
    	TrayTip 
  	}

Run, %command%                              ; ----------------------执行命令
return

;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ     切换音频设备     ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 1-28

SoundVolumeView.exe下载地址

https://www.nirsoft.net/utils/sound_volume_view.html

Realtek高清晰度音频驱动程序下载地址

https://www.intel.cn/content/www/cn/zh/download/19455/realtek-high-definition-audio-driver-for-windows-10-64-bit-for-intel-nuc-kits-mini-pcs-nuc6cay.html

转载请注明出处