diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..e9af56b --- /dev/null +++ b/Readme.md @@ -0,0 +1,25 @@ +# HyperAudio + +HyperAudio is an AutoHotkey (AHK) script to toogle two Audio Output Devices for Windows 10. + +## Installation + +Run AHK Script or compile it yourself or download precompiled release. + +## Usage + +First run will create a hyperaudio.ini file. +Edit Names of Audio Output Devices. Extract Names from Windows Sound Settings. + +Example +``` +**Headset** (Realtek High Definiton Audio) + +## Contributing +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. + +Please make sure to update tests as appropriate. + +## License +[GNU GPL v3](https://choosealicense.com/licenses/gpl-3.0/) + diff --git a/hyperaudio.ahk b/hyperaudio.ahk index 830053b..bedbf83 100644 --- a/hyperaudio.ahk +++ b/hyperaudio.ahk @@ -2,12 +2,38 @@ #Persistent ; Keep the script running until the user exits it. Menu, Tray, Tip , Default Audio Device Changer Menu, Tray, NoStandard -Menu, Tray, Add, Exit, MenuExit ; Creates a new menu item. +Menu, Tray, Add, Info, InfoMenu +Menu, Tray, Add, Exit, MenuExit +<<<<<<< HEAD:hyperaudio.ahk device1:="Headset" device2:="Lautsprecher" ; http://www.daveamenta.com/2011-05/programmatically-or-command-line-change-the-default-sound-playback-device-in-windows-7/ +======= +versionnumber := "1.1" +device1 := "Headset" +device2 := "Lautsprecher" + +if not A_IsAdmin +{ + msgbox, 48,Administrator Rights Warning, Please run as Admin. + sleep, 250 + exitapp +} + + +installed_in=%A_ScriptDir% +IfExist, %installed_in%\hyperaudio.ini +{ + iniread, device1, %installed_in%\hyperaudio.ini, Devices, Output1, %device1% + iniread, device2, %installed_in%\hyperaudio.ini, Devices, Output2, %device2% +} else { + iniwrite, %device1%, %installed_in%\hyperaudio.ini, Devices, Output1 + iniwrite, %device2%, %installed_in%\hyperaudio.ini, Devices, Output2 +} + +>>>>>>> e698301... Gui Added. Admin Warning added. Config file added:HyperAudio.ahk Devices := {} IMMDeviceEnumerator := ComObjCreate("{BCDE0395-E52F-467C-8E3D-C4579291692E}", "{A95664D2-9614-4F35-A746-DE8DB63617E6}") @@ -52,11 +78,11 @@ $!WheelUp::Send {Volume_Up 5} $!WheelDown::Send {Volume_Down 5} currentDevice:=false ^F12:: - currentDevice:=!currentDevice - if currentDevice - SetDefaultEndpoint( GetDeviceID(Devices, device1) ) - else - SetDefaultEndpoint( GetDeviceID(Devices, device2) ) +currentDevice:=!currentDevice +if currentDevice + SetDefaultEndpoint( GetDeviceID(Devices, device1) ) +else + SetDefaultEndpoint( GetDeviceID(Devices, device2) ) return SetDefaultEndpoint(DeviceID) @@ -69,12 +95,41 @@ SetDefaultEndpoint(DeviceID) GetDeviceID(Devices, Name) { For DeviceName, DeviceID in Devices - If (InStr(DeviceName, Name)) - Return DeviceID + If (InStr(DeviceName, Name)) + Return DeviceID } MenuExit: -{ -ExitApp -} -return + { + ExitApp + } + return + +InfoMenu: + { + Gui, 2:+AlwaysOnTop +Caption +MinimizeBox +ToolWindow ; +SysMenu + + Gui, 2:Font, s20, Impact + Gui, 2:Add, Text, x15 y20 w280 r1 , HyperAudio, 2021 + + Gui, 2:Font, s8, Lucida Sans Unicode + Gui, 2:Add, Button, x255 y190 w50 h30 gInfoclose vInfoclose, OK + Gui, 2:Add, Text, x15 y60 w200 +Left, Alt+WheelUp:`nAlt+WheelDown: + Gui, 2:Add, Text, x105 y60 w200 +Left, Increase Volume +5`nDecrease Volume +5 + + + Gui, 2:Add, Text, x15 y100 w200 +Left, Ctrl+F12 + Gui, 2:Add, Text, x105 y100 w200 +Left, Toggle Audio Output Device`n(Configure Device Names in ini File) + + Gui, 2:Add, Text, x15 y150 w200 +Left, Version: %versionnumber% + Gui, 2:Add, Text, x15 y175 w200 +Left, Shimao-Blackrock + + Gui, 2:Show, h235 w320, HyperAudio + } + return + +Infoclose: + { + Gui, 2:Destroy + } + return diff --git a/hyperaudio.exe b/hyperaudio.exe index d7d5da7..f18c0f3 100644 Binary files a/hyperaudio.exe and b/hyperaudio.exe differ