Which is the executable (if any) for "System Sounds"? (Win10) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
eqv
Posts: 72
Joined: 18 Sep 2018, 22:17

Which is the executable (if any) for "System Sounds"? (Win10)

09 Oct 2021, 17:10

Hello everyone. I'm not sure if it's right to post it in "Ask for Help", if I'm wrong I would appreciate it if some told me.

Using this Autohotkey script, I'm able to set volume to decimal point:
viewtopic.php?f=5&t=46654&p=210766

It uses the executables as input (for example "hl2.exe" for the game Half Life 2).

So I would be very grateful if someone could point out which one should be for "System Sounds" (as seen in the attached image).

Thanks in advance
Attachments
Reddit - SystemSounds.jpg
Reddit - SystemSounds.jpg (16.06 KiB) Viewed 370 times
Last edited by eqv on 09 Oct 2021, 20:27, edited 2 times in total.
eqv
Posts: 72
Joined: 18 Sep 2018, 22:17

Re: Which is the executable (if any) for "System Sounds"? (Win10)

09 Oct 2021, 20:26

mikeyww wrote:
09 Oct 2021, 19:53
Perhaps a solution here (I did not try it): viewtopic.php?p=260932#p260932
Awesome!! It works!! (although, I have no idea why :lol: ).

If someone wants the final code, here it's ("fLevel" is the volume, a number from 0 to 1):

Code: Select all

#Include %A_ScriptDir%\VA.ahk
if !(Volume := GetVolumeObject(""))  {
MsgBox, There was a problem retrieving the application volume interface
ExitApp
}

fLevel:=0.01
VA_ISimpleAudioVolume_SetMasterVolume(Volume, fLevel)
;;  Msgbox % VA_ISimpleAudioVolume_GetMasterVolume(Volume, fLevel)
;;  Msgbox % fLevel

ObjRelease(Volume)
Msgbox % "done!"
ExitApp
To the original code by "lexicos", you must add the one from "gregster":

Code: Select all

GetVolumeObject(Param)
{
static IID_IASM2 := "{77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F}"
, IID_IASC2 := "{bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}"
, IID_ISAV := "{87CE5498-68D6-44E5-9215-6DA47EF883D8}"

; Turn empty into integer
if !Param
Param := 0

; Get PID from process name
if Param is not Integer
{
Process, Exist, %Param%
Param := ErrorLevel
}

; GetDefaultAudioEndpoint
DAE := VA_GetDevice()

; activate the session manager
VA_IMMDevice_Activate(DAE, IID_IASM2, 0, 0, IASM2)

; enumerate sessions for on this device
VA_IAudioSessionManager2_GetSessionEnumerator(IASM2, IASE)
VA_IAudioSessionEnumerator_GetCount(IASE, Count)

; search for an audio session with the required name
Loop, % Count
{
; Get the IAudioSessionControl object
VA_IAudioSessionEnumerator_GetSession(IASE, A_Index-1, IASC)

; Query the IAudioSessionControl for an IAudioSessionControl2 object
IASC2 := ComObjQuery(IASC, IID_IASC2)
ObjRelease(IASC)

; Get the session's process ID
VA_IAudioSessionControl2_GetProcessID(IASC2, SPID)

; If the process name is the one we are looking for
if (SPID == Param)
{
; Query for the ISimpleAudioVolume
ISAV := ComObjQuery(IASC2, IID_ISAV)

ObjRelease(IASC2)
break
}
ObjRelease(IASC2)
}
ObjRelease(IASE)
ObjRelease(IASM2)
ObjRelease(DAE)
return ISAV
}

;
; ISimpleAudioVolume : {87CE5498-68D6-44E5-9215-6DA47EF883D8}
;
VA_ISimpleAudioVolume_SetMasterVolume(this, ByRef fLevel, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "float", fLevel, "ptr", VA_GUID(GuidEventContext))
}
VA_ISimpleAudioVolume_GetMasterVolume(this, ByRef fLevel) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "float*", fLevel)
}
VA_ISimpleAudioVolume_SetMute(this, ByRef Muted, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "int", Muted, "ptr", VA_GUID(GuidEventContext))
}
VA_ISimpleAudioVolume_GetMute(this, ByRef Muted) {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "int*", Muted)
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], peter_ahk and 342 guests