Can AHK change audio device settings...?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Coldblackice
Posts: 20
Joined: 13 Nov 2013, 14:39

Can AHK change audio device settings...?

03 Dec 2013, 23:41

Does AHK have the ability to change audio device settings in Windows? (Windows 7 Ultimate x64)

Specifically, I'm trying to automate the ability to change "Speaker Configuration" and "Default Format" in the Windows Sound control panel (because Windows keeps resetting my speakers to Stereo-2.1 and format to 16bit/44k).
User avatar
tank
Posts: 2822
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Irving TX
Contact:

Re: Can AHK change audio device settings...?

05 Dec 2013, 11:27

seems the registry is different for each audio device so i cant offer a generic answer. but if you can isolate the registry entries and correct values you can use

Code: Select all

RegWrite, ValueType, RootKey, SubKey , ValueName, Value
to edit the setting.
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
Check Out WebWriter
Thanks Tank :thumbup:
bidomo
Posts: 3
Joined: 08 Nov 2013, 09:17
Facebook: [email protected]

Re: Can AHK change audio device settings...?

21 Apr 2014, 20:31

I'm facing the same problem, i want to be able to switch between my Headset and my Speakers, setting the headset as default...

So far, only way to do is either manually, or devcon, don't know if nircmd setting the default audio device will work the same as enabling disabling it.

Manually, is a pain in the arse
Devcon can only disable the hardware completely, not only the output
nircmd, don't really know how it behaves

we should probably be able to sent command line parameters to mmsys.cpl so we can disable the 1st device, so the speakers may can play the sound, and re-enable to get audio on the headset, as turning it off doesn't help at all, only unplugging or disabling the output / hardware does the trick...

If anyone has any insight on the matter, help will be appreciated...
User avatar
Coldblackice
Posts: 20
Joined: 13 Nov 2013, 14:39

Re: Can AHK change audio device settings...?

21 Apr 2014, 21:42

The problem, so far as I'm dealing with, is that "new" devices are created when certain monitor types are turned off/on (i.e., HDMI + DisplayPort). So I'm unable to do much with the registry, short of some type of "relative" adjustments rather than absolute -- e.g., "Lock the first subkey from ever changing" (assuming the "new" monitors' keys are always piled on from the same direction).

Thus, I think the way to do it might be through a quasi-"manual" activation, where AHK is essentially navigating through the Audio Settings dialogs -- but ideally able to do so without the GUI interface being used. Anyone know if this is doable via command line? That'd be fantastic if audio devices could be configured/switched/adjusted via commandprompt!
bidomo
Posts: 3
Joined: 08 Nov 2013, 09:17
Facebook: [email protected]

Re: Can AHK change audio device settings...?

22 Apr 2014, 11:14

Coldblackice wrote: Thus, I think the way to do it might be through a quasi-"manual" activation, where AHK is essentially navigating through the Audio Settings dialogs -- but ideally able to do so without the GUI interface being used. Anyone know if this is doable via command line? That'd be fantastic if audio devices could be configured/switched/adjusted via commandprompt!
That's what i was thinking, back in the Win98 days, there was a lot of knowledge about dll calls to execute commands (like a shutdown, volume up, and stuff like that), it occurs to me, maybe there's a way to do something similar with control panel applets.

I tried to capture windows messages, but there's no way to lock into this applets (cannot find parrent window or something like that).
dsdsds12
Posts: 7
Joined: 20 Apr 2014, 03:20

Re: Can AHK change audio device settings...?

22 Apr 2014, 13:32

nircmd definitely works, I can vouch for for that, like I said here (I don't know how people missed my post) and when I use devcon it asks for reboot so it's not an option. like said in my post even nircmd method isn't fully foolproof :( it just changes the default audio device if anyone wants I can post a full procedure :)
bidomo
Posts: 3
Joined: 08 Nov 2013, 09:17
Facebook: [email protected]

Re: Can AHK change audio device settings...?

22 Apr 2014, 17:16

dsdsds12 wrote:nircmd definitely works, I can vouch for for that, like I said here (I don't know how people missed my post) and when I use devcon it asks for reboot so it's not an option. like said in my post even nircmd method isn't fully foolproof :( it just changes the default audio device if anyone wants I can post a full procedure :)
I noticed nircmd, problem is, last time i tried, you had to restart your programs for the audio to be effectively channeled through the correct device, disabling my headset in the Soun / Playback Properties does not, only if the program requeres exclusive access, like a videogame...

I will try again.
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Can AHK change audio device settings...?

23 Apr 2014, 19:49

In particular, this post.
dsdsds12
Posts: 7
Joined: 20 Apr 2014, 03:20

Re: Can AHK change audio device settings...?

24 Apr 2014, 05:51

each and every one of those programs, scripts etc will only allow us to switch default audio device but, what we want is to disable one of those device like a said in my previous post. I've been googling for weeks now, I justcouldn't understand why isn't there is a script for something as simple as this :(
au.jpg
User avatar
tank
Posts: 2822
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Irving TX
Contact:

Re: Can AHK change audio device settings...?

24 Apr 2014, 08:28

http://go4answers.webhost4life.com/Exam ... 25844.aspx
answer 4 is correct for the registry but it seems you have to be admin and might need to start and stop some service
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
Check Out WebWriter
Thanks Tank :thumbup:
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Can AHK change audio device settings...?

24 Apr 2014, 19:33

Try this. I'm not sure if it will work. I can't try because I'm on my mobile.

(Chaz is my name on the other forum.)

Edit: Nope, doesn't work.
dsdsds12
Posts: 7
Joined: 20 Apr 2014, 03:20

Re: Can AHK change audio device settings...?

26 Apr 2014, 12:19

@tank so there is no way via AHK
@timeFlies any attempt to disable a device via device manager requires a reboot :(
User avatar
tank
Posts: 2822
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Irving TX
Contact:

Re: Can AHK change audio device settings...?

27 Apr 2014, 21:59

That isnt what i said at all but if your unable to explore the suggestion it may be just as true
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
Check Out WebWriter
Thanks Tank :thumbup:
User avatar
Coldblackice
Posts: 20
Joined: 13 Nov 2013, 14:39

Re: Can AHK change audio device settings...?

28 Apr 2014, 00:58

What about changing a device's number of channels/speakers? The links posted so far have been helpful, but I still have yet to find anything pointing to how to accomplish this. Any ideas?

Return to “Ask For Help”

Who is online

Users browsing this forum: densch, flyingDman, Google [Bot], Odlanir and 62 guests