[Sugguestion] add Missing code - Default_Recording device

Discuss the future of the AutoHotkey language
Tobgun1
Posts: 123
Joined: 23 Feb 2023, 07:28

[Sugguestion] add Missing code - Default_Recording device

Post by Tobgun1 » 10 Apr 2023, 08:39

Hello ✌😊

I am new here and sorry if I am bad to understand...

I just googled a lot, and maybe i do not understand it.

If you want to mute or unmute a default audio device you can easily Soundsetmute -1 to toggle the mute of all sound devices.

If i search the same thing for devault RECORDING device i just find a very old threath about a windies vista solution in AHK v1 language.

So for me as a common noob it is both nearly the same,
Like speakers are the one side and microphones the other site.

So I wonder why it is so complicated to have the same function like

Code: Select all

MicSetMute
I asked Mikeyww and he had a nice attempt with multiple powershell lines to scan for default audio device , or default recording device.

I see it might be a big thing. But for me as user of AHK I ask myself sometimes why some.things are more complicated then it should be (dont want to attack someone here cuse I am sure some things might look easie but are a hughe coding work)

So no idea I might day make things easier for common users might be a good thing for AHK

Such as easier steps in gui based remap or "auto clicker things"
Cuse in my case that was how I found AHK.

To remap mouse keyboard and joystick and to make some "nice smooth helping scripts" such as similar as mouse macros


I am very happy instarted AHK because it is my actuall hobby 😁👍 great work! Nice programm!

OliverK
Posts: 28
Joined: 08 Mar 2023, 11:55

Re: [Sugguestion] add Missing code - Default_Recording device

Post by OliverK » 19 Apr 2023, 00:03

Dealing with audio devices is quite a complex topic in Windows... looking in source code of comparable solutions (even official Microsoft ones like "Microsoft Power Toys") shows that there's a lot of stuff which has to be done to enumerate devices, identifying them (and their capabilities) and so on.

I had to deal with this myself and wrote an AHK app to mute devices (especially microphones), converting parts of the AHK V1 VA-library to AHK V2 in the process.

See here, may be it'll give you an idea how to write a function so muting the mic becomes a "one-liner"

At least, with my app/code you can mute the mic if you know it's device name.

See the provided doc file for details.

viewtopic.php?f=82&t=114847

Tobgun1
Posts: 123
Joined: 23 Feb 2023, 07:28

Re: [Sugguestion] add Missing code - Default_Recording device

Post by Tobgun1 » 19 Apr 2023, 01:20

OliverK wrote:
19 Apr 2023, 00:03
Dealing with audio devices is quite a complex topic in Windows... looking in source code of comparable solutions (even official Microsoft ones like "Microsoft Power Toys") shows that there's a lot of stuff which has to be done to enumerate devices, identifying them (and their capabilities) and so on.

I had to deal with this myself and wrote an AHK app to mute devices (especially microphones), converting parts of the AHK V1 VA-library to AHK V2 in the process.

See here, may be it'll give you an idea how to write a function so muting the mic becomes a "one-liner"

At least, with my app/code you can mute the mic if you know it's device name.

See the provided doc file for details.

viewtopic.php?f=82&t=114847
Hey cool you answered me here too 😂👍
I was the one asking in your other threath.

Still crazy for me how audio device can be easie and recording device is a mess 🙈

Well.. if you are kinda skilled I might ask you something...

You can mute by device number or device name.

So if you dont have the right number or name it prompts you an error (like value not assigned or string empty or whatever)

So you got to check your current device and add its name or its number into the mute script

BUT if I unplug the device I get another error
Like "headset" or "device #3" not found / empty string or whatever (again)

So could you write a

Try / catch / finaly version for mute devices 1 to xx

Like a loop going throught all numbers until it mutes em all.

And the same backwards . A loop
On-Site device 1, if 1 not there mute 2 if 3 and 4 muted search for 5 and mute that too 🙈😂

Or how could I write all my devices into a script and let it ignore if one is unplugged?

OliverK
Posts: 28
Joined: 08 Mar 2023, 11:55

Re: [Sugguestion] add Missing code - Default_Recording device

Post by OliverK » 19 Apr 2023, 22:09

Ah, well.. didn't recognize you're the same person from the other thread... :P

>>"Like a loop going throught all numbers until it mutes em all."

Well, if you WANT to realize it in such a kind of "brute-force-way" you could put the SoundSetMute call within a "try" block and let it fail silently if it finds nothing..
But I think this is the wrong subforum to discuss such things.

Tobgun1
Posts: 123
Joined: 23 Feb 2023, 07:28

Re: [Sugguestion] add Missing code - Default_Recording device

Post by Tobgun1 » 19 Apr 2023, 22:12

@OliverK
Well 🤷🏻‍♂️ 10 days no reply except yours. So where is the space to discuss thinks if not on the threath with the right topic? 😀🤷🏻‍♂️

I tried the try block but I do not understand it...

But whatever I throw it away as other stuff I tried with AHK and been too uneccessary complicated. ✌ my opinion

Post Reply

Return to “AutoHotkey Development”