利用NirSoft的SoundVolumeView一键切换录入设备,即可实现播放电脑内音频,示例代码:
Numpad1::
IniRead, innerDevice, myIni.ini, volDevice, innerDevice;写一个ini文件方便根据自身设备情况修改设备名称
IniRead, outerDevice, myIni.ini, volDevice, outerDevice
Run, SoundVolumeView.exe /SetDefault %innerDevice% 1
Run, SoundVolumeView.exe /Disable %outerDevice%
Send {LAlt down};游戏内的按下说话键
SoundPlay %A_ScriptDir%/sound/1.mp3, 1
Send {LAlt up}
Run, SoundVolumeView.exe /Enable %outerDevice%
Run, SoundVolumeView.exe /SetDefault %outerDevice% 1
return
Ini部分
[volDevice]
innerDevice = "立体声混音"
outerDevice = "麦克风阵列"
好文章必须收藏