Is there a way to specifically control the "System Sounds" channel as seen in the attached pic?
The mixer only seems to respond to component type of Master or Wave but using those effects all three channels. Other component types have no effect on this mixer. When I try to use a component type not listed in the manual, such as "System Sounds", it gets an error and won't run the script.
I would like to be able to mute this channel while my script is running and unmute when it exits. Any ideas? Thanks
"System Sounds" in Win 10 mixer. Topic is solved
Re: "System Sounds" in Win 10 mixer. Topic is solved
Sure, use Lexikos' VA.ahk library (v2.3):
Docs: https://ahkscript.github.io/VistaAudio/
Download v2.3: https://autohotkey.com/board/topic/21984-vista-audio-control-functions/ (dropbox link works)
Example by Geekdude: //autohotkey.com/board/topic/21984-vista-audio-control-functions/?p=608538 (also possible to mute specific programs with this, afaik)
Push Ctrl+m to toggle system sounds' mute state.
Third-party software alternative: http://www.nirsoft.net/utils/nircmd.html (command line)
Docs: https://ahkscript.github.io/VistaAudio/
Download v2.3: https://autohotkey.com/board/topic/21984-vista-audio-control-functions/ (dropbox link works)
Example by Geekdude: //autohotkey.com/board/topic/21984-vista-audio-control-functions/?p=608538 (also possible to mute specific programs with this, afaik)
Push Ctrl+m to toggle system sounds' mute state.
Code: Select all
#Include VA.ahk
; Get "System Sounds" (PID 0)
if !(Volume := GetVolumeObject(""))
{
MsgBox, There was a problem retrieving the application volume interface
ExitApp
}
OnExit, ExitSub
return
ExitSub:
ObjRelease(Volume)
ExitApp
return
^m::
VA_ISimpleAudioVolume_GetMute(Volume, Mute)
VA_ISimpleAudioVolume_SetMute(Volume, !Mute)
return
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)
}
Re: "System Sounds" in Win 10 mixer.
This works great. Thank You.
Re: "System Sounds" in Win 10 mixer.
Can Lexikos' VA library control any of the applications that appear?
For example, right now in my Volume mixer I have:
• Device (TV_MONITOR)
• Applications - System sounds
• Applications - Last.fm Desktop scrobbler
• Applications - Razer 3 Synapse
• Applications - Spotify
• Applications - Windows Media Player
• Applications - Autohotkey Unicode 64-bit
If I wanted to control the sound level of Spotify independently, how would that work?
For example, right now in my Volume mixer I have:
• Device (TV_MONITOR)
• Applications - System sounds
• Applications - Last.fm Desktop scrobbler
• Applications - Razer 3 Synapse
• Applications - Spotify
• Applications - Windows Media Player
• Applications - Autohotkey Unicode 64-bit
If I wanted to control the sound level of Spotify independently, how would that work?
____________________________________
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey