<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Определение подключения/отключения наушников]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=12635</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12635&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Определение подключения/отключения наушников».]]></description>
		<lastBuildDate>Mon, 24 Apr 2017 21:48:17 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115285#p115285</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>the availability and names of subunits depends on your audio drivers (and possibly system language).</p></blockquote></div><p><a href="https://autohotkey.com/board/topic/149410-soundget-cant-find-microphone-componenttype-in-latest-version-112206/">https://autohotkey.com/board/topic/1494 … on-112206/</a></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 24 Apr 2017 21:48:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115285#p115285</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115284#p115284</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Если  у вас звук всегда идет через спикер, то как вы хотите</p></blockquote></div><p><strong>Malcev</strong>, в моем случае, реальность не пересекается с писаниной в скрипте Sound Card.<br />Звук, разумеется, идет в зависимости от подключения наушников.<br />Причина ошибки полагаю в том, что AutoHotkey не видит подключение моих HEADPHONES.</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Mon, 24 Apr 2017 20:59:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115284#p115284</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115283#p115283</link>
			<description><![CDATA[<p>Если&nbsp; у вас звук всегда идет через спикер, то как вы хотите, чтоб скрипт определял, что вы подключили наушники.<br />У меня на ноутбуке при подключении наушников сразу же звук начинает идти через наушники и соответственно скрипт это определяет.<br /></p><div class="quotebox"><cite>stealzy пишет:</cite><blockquote><p>SoundSet вернул ошибку Mixer Doesn&#039;t Support This Component Type</p></blockquote></div><p>Можно попробовать посмотреть, что выдает A_LastError и потом погуглить в чем может быть причина этой ошибки.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 24 Apr 2017 20:40:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115283#p115283</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115282#p115282</link>
			<description><![CDATA[<p>Ноутбук. Звук всегда идет через Speakers.<br />Я заподозрил что-то, когда параметр HEADPHONES в SoundSet вернул ошибку Mixer Doesn&#039;t Support This Component Type.</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Mon, 24 Apr 2017 19:38:41 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115282#p115282</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115279#p115279</link>
			<description><![CDATA[<p>А вы к звуковой карте подключаете наушники?<br />Скрипт определяет через, что сейчас идет выход звука (в колонке def двумя стрелочками &gt;&gt;).</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 24 Apr 2017 19:28:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115279#p115279</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115277#p115277</link>
			<description><![CDATA[<p>Я правильно понимаю, что у вас в верхнем ListView появляется новое устройство при подключении?<br />У меня ничего, кроме уровня громкости не меняется ни в главном, ни в дочерних списках.</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Mon, 24 Apr 2017 19:18:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115277#p115277</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115276#p115276</link>
			<description><![CDATA[<p>У меня определяет.<br />Из справки:<br /></p><div class="quotebox"><blockquote><p>script for Windows Vista and later which provides more detail (such as display names of devices) can be downloaded from the following forum topic: http://www.autohotkey.com/board/topic/90877-/</p></blockquote></div><p><a href="https://autohotkey.com/docs/commands/SoundSet.htm#Ex">https://autohotkey.com/docs/commands/SoundSet.htm#Ex</a></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 24 Apr 2017 19:14:01 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115276#p115276</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115275#p115275</link>
			<description><![CDATA[<p>И зачем он мне? Разве он определяет поключение наушников?</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Mon, 24 Apr 2017 19:10:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115275#p115275</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115274#p115274</link>
			<description><![CDATA[<p>В смысле?<br />Это Sound Card Analyzer v1.0, который использует библиотеку VA.ahk</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 24 Apr 2017 19:07:59 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115274#p115274</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115273#p115273</link>
			<description><![CDATA[<p>Я видел VA.ahk, зачем это здесь?</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Mon, 24 Apr 2017 19:05:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115273#p115273</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115272#p115272</link>
			<description><![CDATA[<div class="codebox"><pre><code>/*
    Sound Card Analyzer v1.0
    
    Requirements:
        - AutoHotkey v1.1.10+
        - Windows Vista or later
        - VA v2.2  http://www.autohotkey.com/board/topic/21984-/
*/
if A_OSVersion in WIN_2003,WIN_XP,WIN_2000
{
    MsgBox 48,, This script requires Windows Vista or later.
    ExitApp
}

global CLSID_MMDeviceEnumerator := &quot;{BCDE0395-E52F-467C-8E3D-C4579291692E}&quot;
      , IID_IMMDeviceEnumerator := &quot;{A95664D2-9614-4F35-A746-DE8DB63617E6}&quot;

OnMessage(0x100, &quot;OnKeyDown&quot;)
Gui +hwndGuiHwnd
Gui Add, ListView, vDeviceLV gDeviceLV AltSubmit r10 w500, #|Def|Endpoint|Adapter
Gui Add, ListView, vControlLV gControlLV AltSubmit r15 w500, Connector|ComponentType|ControlType|Value
Gui Add, Slider, vSlider gSlider Disabled w440 AltSubmit ToolTip
Gui Add, Checkbox, vToggle gToggle Disabled x+7 w53 h33 +0x1000, Toggle
Gui Font, s9, Courier New
Gui Font, s9, Consolas
Gui Add, Edit, vCommand xm r2 ReadOnly -Wrap -VScroll w500,
(
Select a device to list the components and controls it supports.
Press F5 to refresh the list of devices.
)
PopulateDeviceLV()
Gui Show,, Sound Controls

return

OnKeyDown(wParam)
{
    if A_Gui
    {
        if (wParam = 0x74) ; VK_F5
        {
            PopulateDeviceLV()
            return true
        }
    }
}

DeviceLV:
    Gui ListView, DeviceLV
    if (A_GuiEvent = &quot;I&quot; &amp;&amp; InStr(ErrorLevel, &quot;F&quot;, true))
    {
        LV_GetText(device_num, A_EventInfo, 1)
        PopulateControlLV(device_num)
        GuiControl,, Command, Select a control to show usage.
        GuiControl, Disable, Toggle
        GuiControl, Disable, Slider
    }
return

ControlLV:
    Gui ListView, ControlLV
    if (A_GuiEvent = &quot;I&quot; &amp;&amp; InStr(ErrorLevel, &quot;F&quot;, true))
    {
        control_row := A_EventInfo
        LV_GetText(component_type, A_EventInfo, 2)
        LV_GetText(control_type, A_EventInfo, 3)
        LV_GetText(value, A_EventInfo, 4)
        if InStr(value, &quot; &quot;)
        {
            GuiControl,, Command, This control doesn&#039;t appear to be supported by AutoHotkey.
            GuiControl, Disable, Toggle
            GuiControl, Disable, Slider
            return
        }
        GuiControl,, Command,
        (LTrim
        SoundGet, OutputVar, %component_type%, %control_type%, %device_num%
        SoundSet, NewSetting, %component_type%, %control_type%, %device_num%
        )
        if value is number
        {
            GuiControl, Enable, Slider
            GuiControl, Disable, Toggle
        }
        else
        {
            GuiControl, Enable, Toggle
            GuiControl, Disable, Slider
        }
        GuiControl,, Slider, % value
        GuiControl,, Toggle, % value=&quot;On&quot;
    }
return

Toggle:
Slider:
if (A_GuiControl = &quot;Slider&quot;)
    GuiControlGet value,, Slider
else
    value := -1
SoundSet % value, %component_type%, %control_type%, %device_num%
SoundGet value, %component_type%, %control_type%, %device_num%
LV_Modify(control_row, &quot;Col4&quot;, ErrorLevel ? ErrorLevel : value)
return

GuiEscape:
GuiClose:
ExitApp

PopulateDeviceLV()
{
    Gui ListView, DeviceLV
    LV_Delete()
    enum := ComObjCreate(CLSID_MMDeviceEnumerator, IID_IMMDeviceEnumerator)
    if VA_IMMDeviceEnumerator_EnumAudioEndpoints(enum, 2, 9, devices) &gt;= 0
    {
        VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(enum, 0, 0, device)
        VA_IMMDevice_GetId(device, default_id)
        ObjRelease(device)
        
        VA_IMMDeviceCollection_GetCount(devices, count)
        Loop % count
        {
            if VA_IMMDeviceCollection_Item(devices, A_Index-1, device) &lt; 0
                continue
            VA_IMMDevice_GetId(device, id)
            name := VA_GetDeviceName(device)
            if !RegExMatch(name, &quot;^(.*?) \((.*?)\)$&quot;, m)
                m1 := name, m2 := &quot;&quot;
            LV_Add(&quot;&quot;, A_Index, id == default_id ? &quot;&gt;&gt;&quot; : &quot;&quot;, m1, m2)
            ObjRelease(device)
        }
        ObjRelease(devices)
    }
    ObjRelease(enum)
    Loop 2
        LV_ModifyCol(A_Index+2, &quot;AutoHdr&quot;)
}

PopulateControlLV(device_num)
{
    Gui ListView, ControlLV
    LV_Delete()
    SoundGet value, Master, Volume, %device_num%
    LV_Add(&quot;&quot;, &quot;&quot;, &quot;Master&quot;, &quot;Volume&quot;, ErrorLevel ? ErrorLevel : value)
    SoundGet value, Master, Mute, %device_num%
    LV_Add(&quot;&quot;, &quot;&quot;, &quot;Master&quot;, &quot;Mute&quot;, ErrorLevel ? ErrorLevel : value)
    if !(enum := ComObjCreate(CLSID_MMDeviceEnumerator, IID_IMMDeviceEnumerator))
        return 0
    if (hr := VA_IMMDeviceEnumerator_EnumAudioEndpoints(enum, 2, 9, devices)) &gt;= 0
    {
        hr := VA_IMMDeviceCollection_Item(devices, device_num-1, device)
        ObjRelease(devices)
    }
    ObjRelease(enum)
    if hr &lt; 0  ; Failed to get device.
        return
    ScanDevice(device, device_num)
    ObjRelease(device)
    Loop 4
        LV_ModifyCol(A_Index, &quot;AutoHdr&quot;)
}

ScanDevice(device, device_num)
{
    VA_IMMDevice_Activate(device, &quot;{2A07407E-6497-4A18-9787-32F79BD0D98F}&quot;, 7, 0, deviceTopology)
    VA_IDeviceTopology_GetConnector(deviceTopology, 0, conn)
    ObjRelease(deviceTopology)
    VA_IConnector_GetConnectedTo(conn, conn_to)
    VA_IConnector_GetDataFlow(conn, data_flow)
    ObjRelease(conn)
    if !conn_to
        return
    part := ComObjQuery(conn_to, &quot;{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}&quot;) ; IID_IPart
    ObjRelease(conn_to)
    if !part
        return
    ScanPart(part, {data_flow: data_flow, device_num: device_num}, [])
    ObjRelease(part)
}

ScanPart(root, scan, controls)
{
    if (scan.data_flow = 0)
        hr := VA_IPart_EnumPartsIncoming(root, parts)
    else
        hr := VA_IPart_EnumPartsOutgoing(root, parts)
    if (hr &lt; 0)
        return
    
    VA_IPartsList_GetCount(parts, count)
    if (count &gt; 1)
        controls := []  ; Ignore controls seen by caller.
    this_part_control := Round(controls.MaxIndex()) + 1
    
    Loop % count
    {
        if VA_IPartsList_GetPart(parts, A_Index-1, part) &lt; 0
            continue
        
        VA_IPart_GetPartType(part, type)
        VA_IPart_GetSubType(part, subtype)
        if (type = 0) ; Connector
        {
            VA_IPart_GetName(part, name)
            
            component_type := GetComponentType(subtype)
            instance := Round(scan.found[component_type]) + 1
            scan.found[component_type] := instance
            if (instance &gt; 1)
                component_type .= &quot;:&quot; instance
            
            for i, control_type in controls
            {
                if RegExMatch(control_type, &quot;^\w+&quot;, ctl)
                    SoundGet value, %component_type%, %ctl%, % dn := scan.device_num
                else
                    ErrorLevel := &quot;n/a&quot;
                LV_Add(&quot;&quot;, name, component_type, control_type, ErrorLevel ? ErrorLevel : value)
            }
        }
        else ; Subunit
        {
            GetControls(part, controls)
            
            ScanPart(part, scan, controls)
            
            controls.Remove(this_part_control, controls.MaxIndex())
        }
        
        ObjRelease(part)
    }
}

GetControls(part, controls)
{
    static IID_to_Name := {
    (C Join,
        ; Supported:
        &quot;{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}&quot;: &quot;Volume&quot;
        &quot;{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}&quot;: &quot;Mute&quot;
        ; Unsupported:
        &quot;{85401FD4-6DE4-4b9d-9869-2D6753A82F3C}&quot;: &quot;OnOff (AGC)&quot;
        &quot;{4F03DC02-5E6E-4653-8F72-A030C123D598}&quot;: &quot;0x70010001 (Mux)&quot;
        &quot;{BB515F69-94A7-429e-8B9C-271B3F11A3AB}&quot;: &quot;Demux&quot;
        &quot;{7D8B1437-DD53-4350-9C1B-1EE2890BD938}&quot;: &quot;Loudness&quot;
        &quot;{DD79923C-0599-45e0-B8B6-C8DF7DB6E796}&quot;: &quot;0x10020001 (PeakMeter)&quot;
        &quot;{A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5}&quot;: &quot;Bass&quot;
        &quot;{5E54B6D7-B44B-40D9-9A9E-E691D9CE6EDF}&quot;: &quot;Midrange&quot;
        &quot;{0A717812-694E-4907-B74B-BAFA5CFDCA7B}&quot;: &quot;Treble&quot;
    )}
    VA_IPart_GetControlInterfaceCount(part, count)
    Loop % count
    {
        VA_IPart_GetControlInterface(part, A_Index-1, desc)
        ; Get IID and map it to a name, since GetName() seems to return nothing.
        if VA_IControlInterface_GetIID(desc, iid) &gt;= 0
            controls.Insert(IID_to_Name[iid] ? IID_to_Name[iid] : iid)
        ObjRelease(desc)
    }
}

GetComponentType(guid)
{
    ; KSNODETYPE_* GUID : SoundGet/Set ComponentType
    static TypeMap := {
    (Join,
        &quot;{DFF21BE1-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Microphone&quot;
        &quot;{DFF21BE2-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Microphone&quot;
        &quot;{DFF21FE4-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Wave&quot;
        &quot;{6994AD04-93EF-11D0-A3CC-00A0C9223196}&quot;: &quot;Wave&quot;
        &quot;{DFF21CE1-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Wave&quot;
        &quot;{DFF220E3-F70F-11D0-B917-00A0C9223196}&quot;: &quot;CD&quot;
        &quot;{DFF220F3-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Synth&quot;
        &quot;{DFF21FE3-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Line&quot;
        &quot;{DFF21EE2-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Telephone&quot;
        &quot;{DFF21EE1-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Telephone&quot;
        &quot;{DFF21EE3-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Telephone&quot;
        &quot;{DFF21FE1-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Analog&quot;
        &quot;{DFF21FE5-F70F-11D0-B917-00A0C9223196}&quot;: &quot;Digital&quot;
    )}
    type := TypeMap[guid]
    return type ? type : &quot;N/A&quot;
}


; VA v2.3

;
; MASTER CONTROLS
;

VA_GetMasterVolume(channel=&quot;&quot;, device_desc=&quot;playback&quot;)
{
    if ! aev := VA_GetAudioEndpointVolume(device_desc)
        return
    if channel =
        VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(aev, vol)
    else
        VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(aev, channel-1, vol)
    ObjRelease(aev)
    return Round(vol*100,3)
}

VA_SetMasterVolume(vol, channel=&quot;&quot;, device_desc=&quot;playback&quot;)
{
    vol := vol&gt;100 ? 100 : vol&lt;0 ? 0 : vol
    if ! aev := VA_GetAudioEndpointVolume(device_desc)
        return
    if channel =
        VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(aev, vol/100)
    else
        VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(aev, channel-1, vol/100)
    ObjRelease(aev)
}

VA_GetMasterChannelCount(device_desc=&quot;playback&quot;)
{
    if ! aev := VA_GetAudioEndpointVolume(device_desc)
        return
    VA_IAudioEndpointVolume_GetChannelCount(aev, count)
    ObjRelease(aev)
    return count
}

VA_SetMasterMute(mute, device_desc=&quot;playback&quot;)
{
    if ! aev := VA_GetAudioEndpointVolume(device_desc)
        return
    VA_IAudioEndpointVolume_SetMute(aev, mute)
    ObjRelease(aev)
}

VA_GetMasterMute(device_desc=&quot;playback&quot;)
{
    if ! aev := VA_GetAudioEndpointVolume(device_desc)
        return
    VA_IAudioEndpointVolume_GetMute(aev, mute)
    ObjRelease(aev)
    return mute
}

;
; SUBUNIT CONTROLS
;

VA_GetVolume(subunit_desc=&quot;1&quot;, channel=&quot;&quot;, device_desc=&quot;playback&quot;)
{
    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, &quot;{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}&quot;)
        return
    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
    if channel =
    {
        vol = 0
        
        Loop, %channel_count%
        {
            VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
            VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
            this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
            
            ; &quot;Speakers Properties&quot; reports the highest channel as the volume.
            if (this_vol &gt; vol)
                vol := this_vol
        }
    }
    else if channel between 1 and channel_count
    {
        channel -= 1
        VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
        VA_IPerChannelDbLevel_GetLevel(avl, channel, vol)
        vol := VA_dB2Scalar(vol, min_dB, max_dB)
    }
    ObjRelease(avl)
    return vol
}

VA_SetVolume(vol, subunit_desc=&quot;1&quot;, channel=&quot;&quot;, device_desc=&quot;playback&quot;)
{
    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, &quot;{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}&quot;)
        return
    
    vol := vol&lt;0 ? 0 : vol&gt;100 ? 100 : vol
    
    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
    
    if channel =
    {
        ; Simple method -- resets balance to &quot;center&quot;:
        ;VA_IPerChannelDbLevel_SetLevelUniform(avl, vol)
        
        vol_max = 0
        
        Loop, %channel_count%
        {
            VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
            VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
            this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
            
            channel%A_Index%vol := this_vol
            channel%A_Index%min := min_dB
            channel%A_Index%max := max_dB
            
            ; Scale all channels relative to the loudest channel.
            ; (This is how Vista&#039;s &quot;Speakers Properties&quot; dialog seems to work.)
            if (this_vol &gt; vol_max)
                vol_max := this_vol
        }
        
        Loop, %channel_count%
        {
            this_vol := vol_max ? channel%A_Index%vol / vol_max * vol : vol
            this_vol := VA_Scalar2dB(this_vol/100, channel%A_Index%min, channel%A_Index%max)            
            VA_IPerChannelDbLevel_SetLevel(avl, A_Index-1, this_vol)
        }
    }
    else if channel between 1 and %channel_count%
    {
        channel -= 1
        VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
        VA_IPerChannelDbLevel_SetLevel(avl, channel, VA_Scalar2dB(vol/100, min_dB, max_dB))
    }
    ObjRelease(avl)
}

VA_GetChannelCount(subunit_desc=&quot;1&quot;, device_desc=&quot;playback&quot;)
{
    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, &quot;{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}&quot;)
        return
    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
    ObjRelease(avl)
    return channel_count
}

VA_SetMute(mute, subunit_desc=&quot;1&quot;, device_desc=&quot;playback&quot;)
{
    if ! amute := VA_GetDeviceSubunit(device_desc, subunit_desc, &quot;{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}&quot;)
        return
    VA_IAudioMute_SetMute(amute, mute)
    ObjRelease(amute)
}

VA_GetMute(subunit_desc=&quot;1&quot;, device_desc=&quot;playback&quot;)
{
    if ! amute := VA_GetDeviceSubunit(device_desc, subunit_desc, &quot;{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}&quot;)
        return
    VA_IAudioMute_GetMute(amute, muted)
    ObjRelease(amute)
    return muted
}

;
; AUDIO METERING
;

VA_GetAudioMeter(device_desc=&quot;playback&quot;)
{
    if ! device := VA_GetDevice(device_desc)
        return 0
    VA_IMMDevice_Activate(device, &quot;{C02216F6-8C67-4B5B-9D00-D008E73E0064}&quot;, 7, 0, audioMeter)
    ObjRelease(device)
    return audioMeter
}

VA_GetDevicePeriod(device_desc, ByRef default_period, ByRef minimum_period=&quot;&quot;)
{
    defaultPeriod := minimumPeriod := 0
    if ! device := VA_GetDevice(device_desc)
        return false
    VA_IMMDevice_Activate(device, &quot;{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}&quot;, 7, 0, audioClient)
    ObjRelease(device)
    ; IAudioClient::GetDevicePeriod
    DllCall(NumGet(NumGet(audioClient+0)+9*A_PtrSize), &quot;ptr&quot;,audioClient, &quot;int64*&quot;,default_period, &quot;int64*&quot;,minimum_period)
    ; Convert 100-nanosecond units to milliseconds.
    default_period /= 10000
    minimum_period /= 10000    
    ObjRelease(audioClient)
    return true
}

VA_GetAudioEndpointVolume(device_desc=&quot;playback&quot;)
{
    if ! device := VA_GetDevice(device_desc)
        return 0
    VA_IMMDevice_Activate(device, &quot;{5CDF2C82-841E-4546-9722-0CF74078229A}&quot;, 7, 0, endpointVolume)
    ObjRelease(device)
    return endpointVolume
}

VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid)
{
    if ! device := VA_GetDevice(device_desc)
        return 0
    subunit := VA_FindSubunit(device, subunit_desc, subunit_iid)
    ObjRelease(device)
    return subunit
}

VA_FindSubunit(device, target_desc, target_iid)
{
    if target_desc is integer
        target_index := target_desc
    else
        RegExMatch(target_desc, &quot;(?&lt;_name&gt;.*?)(?::(?&lt;_index&gt;\d+))?$&quot;, target)
    ; v2.01: Since target_name is now a regular expression, default to case-insensitive mode if no options are specified.
    if !RegExMatch(target_name,&quot;^[^\(]+\)&quot;)
        target_name := &quot;i)&quot; target_name
    r := VA_EnumSubunits(device, &quot;VA_FindSubunitCallback&quot;, target_name, target_iid
            , Object(0, target_index ? target_index : 1, 1, 0))
    return r
}

VA_FindSubunitCallback(part, interface, index)
{
    index[1] := index[1] + 1 ; current += 1
    if (index[0] == index[1]) ; target == current ?
    {
        ObjAddRef(interface)
        return interface
    }
}

VA_EnumSubunits(device, callback, target_name=&quot;&quot;, target_iid=&quot;&quot;, callback_param=&quot;&quot;)
{
    VA_IMMDevice_Activate(device, &quot;{2A07407E-6497-4A18-9787-32F79BD0D98F}&quot;, 7, 0, deviceTopology)
    VA_IDeviceTopology_GetConnector(deviceTopology, 0, conn)
    ObjRelease(deviceTopology)
    VA_IConnector_GetConnectedTo(conn, conn_to)
    VA_IConnector_GetDataFlow(conn, data_flow)
    ObjRelease(conn)
    if !conn_to
        return ; blank to indicate error
    part := ComObjQuery(conn_to, &quot;{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}&quot;) ; IID_IPart
    ObjRelease(conn_to)
    if !part
        return
    r := VA_EnumSubunitsEx(part, data_flow, callback, target_name, target_iid, callback_param)
    ObjRelease(part)
    return r ; value returned by callback, or zero.
}

VA_EnumSubunitsEx(part, data_flow, callback, target_name=&quot;&quot;, target_iid=&quot;&quot;, callback_param=&quot;&quot;)
{
    r := 0
    
    VA_IPart_GetPartType(part, type)
   
    if type = 1 ; Subunit
    {
        VA_IPart_GetName(part, name)
        
        ; v2.01: target_name is now a regular expression.
        if RegExMatch(name, target_name)
        {
            if target_iid =
                r := %callback%(part, 0, callback_param)
            else
                if VA_IPart_Activate(part, 7, target_iid, interface) = 0
                {
                    r := %callback%(part, interface, callback_param)
                    ; The callback is responsible for calling ObjAddRef()
                    ; if it intends to keep the interface pointer.
                    ObjRelease(interface)
                }

            if r
                return r ; early termination
        }
    }
    
    if data_flow = 0
        VA_IPart_EnumPartsIncoming(part, parts)
    else
        VA_IPart_EnumPartsOutgoing(part, parts)
    
    VA_IPartsList_GetCount(parts, count)
    Loop %count%
    {
        VA_IPartsList_GetPart(parts, A_Index-1, subpart)        
        r := VA_EnumSubunitsEx(subpart, data_flow, callback, target_name, target_iid, callback_param)
        ObjRelease(subpart)
        if r
            break ; early termination
    }
    ObjRelease(parts)
    return r ; continue/finished enumeration
}

; device_desc = device_id
;               | ( friendly_name | &#039;playback&#039; | &#039;capture&#039; ) [ &#039;:&#039; index ]
VA_GetDevice(device_desc=&quot;playback&quot;)
{
    static CLSID_MMDeviceEnumerator := &quot;{BCDE0395-E52F-467C-8E3D-C4579291692E}&quot;
        , IID_IMMDeviceEnumerator := &quot;{A95664D2-9614-4F35-A746-DE8DB63617E6}&quot;
    if !(deviceEnumerator := ComObjCreate(CLSID_MMDeviceEnumerator, IID_IMMDeviceEnumerator))
        return 0
    
    device := 0
    
    if VA_IMMDeviceEnumerator_GetDevice(deviceEnumerator, device_desc, device) = 0
        goto VA_GetDevice_Return
    
    if device_desc is integer
    {
        m2 := device_desc
        if m2 &gt;= 4096 ; Probably a device pointer, passed here indirectly via VA_GetAudioMeter or such.
        {
            ObjAddRef(device := m2)
            goto VA_GetDevice_Return
        }
    }
    else
        RegExMatch(device_desc, &quot;(.*?)\s*(?::(\d+))?$&quot;, m)
    
    if m1 in playback,p
        m1 := &quot;&quot;, flow := 0 ; eRender
    else if m1 in capture,c
        m1 := &quot;&quot;, flow := 1 ; eCapture
    else if (m1 . m2) = &quot;&quot;  ; no name or number specified
        m1 := &quot;&quot;, flow := 0 ; eRender (default)
    else
        flow := 2 ; eAll
    
    if (m1 . m2) = &quot;&quot;   ; no name or number (maybe &quot;playback&quot; or &quot;capture&quot;)
    {
        VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(deviceEnumerator, flow, 0, device)
        goto VA_GetDevice_Return
    }

    VA_IMMDeviceEnumerator_EnumAudioEndpoints(deviceEnumerator, flow, 1, devices)
    
    if m1 =
    {
        VA_IMMDeviceCollection_Item(devices, m2-1, device)
        goto VA_GetDevice_Return
    }
    
    VA_IMMDeviceCollection_GetCount(devices, count)
    index := 0
    Loop % count
        if VA_IMMDeviceCollection_Item(devices, A_Index-1, device) = 0
            if InStr(VA_GetDeviceName(device), m1) &amp;&amp; (m2 = &quot;&quot; || ++index = m2)
                goto VA_GetDevice_Return
            else
                ObjRelease(device), device:=0

VA_GetDevice_Return:
    ObjRelease(deviceEnumerator)
    if devices
        ObjRelease(devices)
    
    return device ; may be 0
}

VA_GetDeviceName(device)
{
    static PKEY_Device_FriendlyName
    if !VarSetCapacity(PKEY_Device_FriendlyName)
        VarSetCapacity(PKEY_Device_FriendlyName, 20)
        ,VA_GUID(PKEY_Device_FriendlyName :=&quot;{A45C254E-DF1C-4EFD-8020-67D146A850E0}&quot;)
        ,NumPut(14, PKEY_Device_FriendlyName, 16)
    VarSetCapacity(prop, 16)
    VA_IMMDevice_OpenPropertyStore(device, 0, store)
    ; store-&gt;GetValue(.., [out] prop)
    DllCall(NumGet(NumGet(store+0)+5*A_PtrSize), &quot;ptr&quot;, store, &quot;ptr&quot;, &amp;PKEY_Device_FriendlyName, &quot;ptr&quot;, &amp;prop)
    ObjRelease(store)
    VA_WStrOut(deviceName := NumGet(prop,8))
    return deviceName
}

VA_SetDefaultEndpoint(device_desc, role)
{
    /* Roles:
         eConsole        = 0  ; Default Device
         eMultimedia     = 1
         eCommunications = 2  ; Default Communications Device
    */
    if ! device := VA_GetDevice(device_desc)
        return 0
    if VA_IMMDevice_GetId(device, id) = 0
    {
        cfg := ComObjCreate(&quot;{294935CE-F637-4E7C-A41B-AB255460B862}&quot;
                          , &quot;{568b9108-44bf-40b4-9006-86afe5b5a620}&quot;)
        hr := VA_xIPolicyConfigVista_SetDefaultEndpoint(cfg, id, role)
        ObjRelease(cfg)
    }
    ObjRelease(device)
    return hr = 0
}


;
; HELPERS
;

; Convert string to binary GUID structure.
VA_GUID(ByRef guid_out, guid_in=&quot;%guid_out%&quot;) {
    if (guid_in == &quot;%guid_out%&quot;)
        guid_in :=   guid_out
    if  guid_in is integer
        return guid_in
    VarSetCapacity(guid_out, 16, 0)
	DllCall(&quot;ole32\CLSIDFromString&quot;, &quot;wstr&quot;, guid_in, &quot;ptr&quot;, &amp;guid_out)
	return &amp;guid_out
}

; Convert binary GUID structure to string.
VA_GUIDOut(ByRef guid) {
    VarSetCapacity(buf, 78)
    DllCall(&quot;ole32\StringFromGUID2&quot;, &quot;ptr&quot;, &amp;guid, &quot;ptr&quot;, &amp;buf, &quot;int&quot;, 39)
    guid := StrGet(&amp;buf, &quot;UTF-16&quot;)
}

; Convert COM-allocated wide char string pointer to usable string.
VA_WStrOut(ByRef str) {
    str := StrGet(ptr := str, &quot;UTF-16&quot;)
    DllCall(&quot;ole32\CoTaskMemFree&quot;, &quot;ptr&quot;, ptr)  ; FREES THE STRING.
}

VA_dB2Scalar(dB, min_dB, max_dB) {
    min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
    return ((10**(dB/20))-min_s)/(max_s-min_s)*100
}

VA_Scalar2dB(s, min_dB, max_dB) {
    min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
    return log((max_s-min_s)*s+min_s)*20
}


;
; INTERFACE WRAPPERS
;   Reference: Core Audio APIs in Windows Vista -- Programming Reference
;       http://msdn2.microsoft.com/en-us/library/ms679156(VS.85).aspx
;

;
; IMMDevice : {D666063F-1587-4E43-81F1-B948E807363F}
;
VA_IMMDevice_Activate(this, iid, ClsCtx, ActivationParams, ByRef Interface) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, VA_GUID(iid), &quot;uint&quot;, ClsCtx, &quot;uint&quot;, ActivationParams, &quot;ptr*&quot;, Interface)
}
VA_IMMDevice_OpenPropertyStore(this, Access, ByRef Properties) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Access, &quot;ptr*&quot;, Properties)
}
VA_IMMDevice_GetId(this, ByRef Id) {
    hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Id)
    VA_WStrOut(Id)
    return hr
}
VA_IMMDevice_GetState(this, ByRef State) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, State)
}

;
; IDeviceTopology : {2A07407E-6497-4A18-9787-32F79BD0D98F}
;
VA_IDeviceTopology_GetConnectorCount(this, ByRef Count) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Count)
}
VA_IDeviceTopology_GetConnector(this, Index, ByRef Connector) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Index, &quot;ptr*&quot;, Connector)
}
VA_IDeviceTopology_GetSubunitCount(this, ByRef Count) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Count)
}
VA_IDeviceTopology_GetSubunit(this, Index, ByRef Subunit) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Index, &quot;ptr*&quot;, Subunit)
}
VA_IDeviceTopology_GetPartById(this, Id, ByRef Part) {
    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Id, &quot;ptr*&quot;, Part)
}
VA_IDeviceTopology_GetDeviceId(this, ByRef DeviceId) {
    hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, DeviceId)
    VA_WStrOut(DeviceId)
    return hr
}
VA_IDeviceTopology_GetSignalPath(this, PartFrom, PartTo, RejectMixedPaths, ByRef Parts) {
    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, PartFrom, &quot;ptr&quot;, PartTo, &quot;int&quot;, RejectMixedPaths, &quot;ptr*&quot;, Parts)
}

;
; IConnector : {9c2c4058-23f5-41de-877a-df3af236a09e}
;
VA_IConnector_GetType(this, ByRef Type) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, Type)
}
VA_IConnector_GetDataFlow(this, ByRef Flow) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, Flow)
}
VA_IConnector_ConnectTo(this, ConnectTo) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, ConnectTo)
}
VA_IConnector_Disconnect(this) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this)
}
VA_IConnector_IsConnected(this, ByRef Connected) {
    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, Connected)
}
VA_IConnector_GetConnectedTo(this, ByRef ConTo) {
    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, ConTo)
}
VA_IConnector_GetConnectorIdConnectedTo(this, ByRef ConnectorId) {
    hr := DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, ConnectorId)
    VA_WStrOut(ConnectorId)
    return hr
}
VA_IConnector_GetDeviceIdConnectedTo(this, ByRef DeviceId) {
    hr := DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, DeviceId)
    VA_WStrOut(DeviceId)
    return hr
}

;
; IPart : {AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}
;
VA_IPart_GetName(this, ByRef Name) {
    hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, Name)
    VA_WStrOut(Name)
    return hr
}
VA_IPart_GetLocalId(this, ByRef Id) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Id)
}
VA_IPart_GetGlobalId(this, ByRef GlobalId) {
    hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, GlobalId)
    VA_WStrOut(GlobalId)
    return hr
}
VA_IPart_GetPartType(this, ByRef PartType) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, PartType)
}
VA_IPart_GetSubType(this, ByRef SubType) {
    VarSetCapacity(SubType,16,0)
    hr := DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, &amp;SubType)
    VA_GUIDOut(SubType)
    return hr
}
VA_IPart_GetControlInterfaceCount(this, ByRef Count) {
    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Count)
}
VA_IPart_GetControlInterface(this, Index, ByRef InterfaceDesc) {
    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Index, &quot;ptr*&quot;, InterfaceDesc)
}
VA_IPart_EnumPartsIncoming(this, ByRef Parts) {
    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, Parts)
}
VA_IPart_EnumPartsOutgoing(this, ByRef Parts) {
    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, Parts)
}
VA_IPart_GetTopologyObject(this, ByRef Topology) {
    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, Topology)
}
VA_IPart_Activate(this, ClsContext, iid, ByRef Object) {
    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, ClsContext, &quot;ptr&quot;, VA_GUID(iid), &quot;ptr*&quot;, Object)
}
VA_IPart_RegisterControlChangeCallback(this, iid, Notify) {
    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, VA_GUID(iid), &quot;ptr&quot;, Notify)
}
VA_IPart_UnregisterControlChangeCallback(this, Notify) {
    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, Notify)
}

;
; IPartsList : {6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB}
;
VA_IPartsList_GetCount(this, ByRef Count) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Count)
}
VA_IPartsList_GetPart(this, INdex, ByRef Part) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Index, &quot;ptr*&quot;, Part)
}

;
; IAudioEndpointVolume : {5CDF2C82-841E-4546-9722-0CF74078229A}
;
VA_IAudioEndpointVolume_RegisterControlChangeNotify(this, Notify) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, Notify)
}
VA_IAudioEndpointVolume_UnregisterControlChangeNotify(this, Notify) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, Notify)
}
VA_IAudioEndpointVolume_GetChannelCount(this, ByRef ChannelCount) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, ChannelCount)
}
VA_IAudioEndpointVolume_SetMasterVolumeLevel(this, LevelDB, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;float&quot;, LevelDB, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(this, Level, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;float&quot;, Level, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_GetMasterVolumeLevel(this, ByRef LevelDB) {
    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), &quot;ptr&quot;, this, &quot;float*&quot;, LevelDB)
}
VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(this, ByRef Level) {
    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), &quot;ptr&quot;, this, &quot;float*&quot;, Level)
}
VA_IAudioEndpointVolume_SetChannelVolumeLevel(this, Channel, LevelDB, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Channel, &quot;float&quot;, LevelDB, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(this, Channel, Level, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Channel, &quot;float&quot;, Level, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_GetChannelVolumeLevel(this, Channel, ByRef LevelDB) {
    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Channel, &quot;float*&quot;, LevelDB)
}
VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(this, Channel, ByRef Level) {
    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Channel, &quot;float*&quot;, Level)
}
VA_IAudioEndpointVolume_SetMute(this, Mute, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, Mute, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_GetMute(this, ByRef Mute) {
    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, Mute)
}
VA_IAudioEndpointVolume_GetVolumeStepInfo(this, ByRef Step, ByRef StepCount) {
    return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Step, &quot;uint*&quot;, StepCount)
}
VA_IAudioEndpointVolume_VolumeStepUp(this, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+17*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_VolumeStepDown(this, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+18*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
    return DllCall(NumGet(NumGet(this+0)+19*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, HardwareSupportMask)
}
VA_IAudioEndpointVolume_GetVolumeRange(this, ByRef MinDB, ByRef MaxDB, ByRef IncrementDB) {
    return DllCall(NumGet(NumGet(this+0)+20*A_PtrSize), &quot;ptr&quot;, this, &quot;float*&quot;, MinDB, &quot;float*&quot;, MaxDB, &quot;float*&quot;, IncrementDB)
}

;
; IPerChannelDbLevel  : {C2F8E001-F205-4BC9-99BC-C13B1E048CCB}
;   IAudioVolumeLevel : {7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}
;   IAudioBass        : {A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5}
;   IAudioMidrange    : {5E54B6D7-B44B-40D9-9A9E-E691D9CE6EDF}
;   IAudioTreble      : {0A717812-694E-4907-B74B-BAFA5CFDCA7B}
;
VA_IPerChannelDbLevel_GetChannelCount(this, ByRef Channels) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Channels)
}
VA_IPerChannelDbLevel_GetLevelRange(this, Channel, ByRef MinLevelDB, ByRef MaxLevelDB, ByRef Stepping) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Channel, &quot;float*&quot;, MinLevelDB, &quot;float*&quot;, MaxLevelDB, &quot;float*&quot;, Stepping)
}
VA_IPerChannelDbLevel_GetLevel(this, Channel, ByRef LevelDB) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Channel, &quot;float*&quot;, LevelDB)
}
VA_IPerChannelDbLevel_SetLevel(this, Channel, LevelDB, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Channel, &quot;float&quot;, LevelDB, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IPerChannelDbLevel_SetLevelUniform(this, LevelDB, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;float&quot;, LevelDB, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IPerChannelDbLevel_SetLevelAllChannels(this, LevelsDB, ChannelCount, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, LevelsDB, &quot;uint&quot;, ChannelCount, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}

;
; IAudioMute : {DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}
;
VA_IAudioMute_SetMute(this, Muted, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, Muted, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}
VA_IAudioMute_GetMute(this, ByRef Muted) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, Muted)
}

;
; IAudioAutoGainControl : {85401FD4-6DE4-4b9d-9869-2D6753A82F3C}
;
VA_IAudioAutoGainControl_GetEnabled(this, ByRef Enabled) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, Enabled)
}
VA_IAudioAutoGainControl_SetEnabled(this, Enable, GuidEventContext=&quot;&quot;) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, Enable, &quot;ptr&quot;, VA_GUID(GuidEventContext))
}

;
; IAudioMeterInformation : {C02216F6-8C67-4B5B-9D00-D008E73E0064}
;
VA_IAudioMeterInformation_GetPeakValue(this, ByRef Peak) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;float*&quot;, Peak)
}
VA_IAudioMeterInformation_GetMeteringChannelCount(this, ByRef ChannelCount) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, ChannelCount)
}
VA_IAudioMeterInformation_GetChannelsPeakValues(this, ChannelCount, PeakValues) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, ChannelCount, &quot;ptr&quot;, PeakValues)
}
VA_IAudioMeterInformation_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, HardwareSupportMask)
}

;
; IAudioClient : {1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}
;
VA_IAudioClient_Initialize(this, ShareMode, StreamFlags, BufferDuration, Periodicity, Format, AudioSessionGuid) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, ShareMode, &quot;uint&quot;, StreamFlags, &quot;int64&quot;, BufferDuration, &quot;int64&quot;, Periodicity, &quot;ptr&quot;, Format, &quot;ptr&quot;, VA_GUID(AudioSessionGuid))
}
VA_IAudioClient_GetBufferSize(this, ByRef NumBufferFrames) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, NumBufferFrames)
}
VA_IAudioClient_GetStreamLatency(this, ByRef Latency) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;int64*&quot;, Latency)
}
VA_IAudioClient_GetCurrentPadding(this, ByRef NumPaddingFrames) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, NumPaddingFrames)
}
VA_IAudioClient_IsFormatSupported(this, ShareMode, Format, ByRef ClosestMatch) {
    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, ShareMode, &quot;ptr&quot;, Format, &quot;ptr*&quot;, ClosestMatch)
}
VA_IAudioClient_GetMixFormat(this, ByRef Format) {
    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Format)
}
VA_IAudioClient_GetDevicePeriod(this, ByRef DefaultDevicePeriod, ByRef MinimumDevicePeriod) {
    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), &quot;ptr&quot;, this, &quot;int64*&quot;, DefaultDevicePeriod, &quot;int64*&quot;, MinimumDevicePeriod)
}
VA_IAudioClient_Start(this) {
    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), &quot;ptr&quot;, this)
}
VA_IAudioClient_Stop(this) {
    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), &quot;ptr&quot;, this)
}
VA_IAudioClient_Reset(this) {
    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), &quot;ptr&quot;, this)
}
VA_IAudioClient_SetEventHandle(this, eventHandle) {
    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, eventHandle)
}
VA_IAudioClient_GetService(this, iid, ByRef Service) {
    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, VA_GUID(iid), &quot;ptr*&quot;, Service)
}

;
; IAudioSessionControl : {F4B1A599-7266-4319-A8CA-E70ACB11E8CD}
;
/*
AudioSessionStateInactive = 0
AudioSessionStateActive = 1
AudioSessionStateExpired = 2
*/
VA_IAudioSessionControl_GetState(this, ByRef State) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, State)
}
VA_IAudioSessionControl_GetDisplayName(this, ByRef DisplayName) {
    hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, DisplayName)
    VA_WStrOut(DisplayName)
    return hr
}
VA_IAudioSessionControl_SetDisplayName(this, DisplayName, EventContext) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;wstr&quot;, DisplayName, &quot;ptr&quot;, VA_GUID(EventContext))
}
VA_IAudioSessionControl_GetIconPath(this, ByRef IconPath) {
    hr := DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, IconPath)
    VA_WStrOut(IconPath)
    return hr
}
VA_IAudioSessionControl_SetIconPath(this, IconPath) {
    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;wstr&quot;, IconPath)
}
VA_IAudioSessionControl_GetGroupingParam(this, ByRef Param) {
    VarSetCapacity(Param,16,0)
    hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, &amp;Param)
    VA_GUIDOut(Param)
    return hr
}
VA_IAudioSessionControl_SetGroupingParam(this, Param, EventContext) {
    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, VA_GUID(Param), &quot;ptr&quot;, VA_GUID(EventContext))
}
VA_IAudioSessionControl_RegisterAudioSessionNotification(this, NewNotifications) {
    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, NewNotifications)
}
VA_IAudioSessionControl_UnregisterAudioSessionNotification(this, NewNotifications) {
    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, NewNotifications)
}

;
; IAudioSessionManager : {BFA971F1-4D5E-40BB-935E-967039BFBEE4}
;
VA_IAudioSessionManager_GetAudioSessionControl(this, AudioSessionGuid) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, VA_GUID(AudioSessionGuid))
}
VA_IAudioSessionManager_GetSimpleAudioVolume(this, AudioSessionGuid, StreamFlags, ByRef AudioVolume) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, VA_GUID(AudioSessionGuid), &quot;uint&quot;, StreamFlags, &quot;uint*&quot;, AudioVolume)
}

;
; IMMDeviceEnumerator
;
VA_IMMDeviceEnumerator_EnumAudioEndpoints(this, DataFlow, StateMask, ByRef Devices) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, DataFlow, &quot;uint&quot;, StateMask, &quot;ptr*&quot;, Devices)
}
VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(this, DataFlow, Role, ByRef Endpoint) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, DataFlow, &quot;int&quot;, Role, &quot;ptr*&quot;, Endpoint)
}
VA_IMMDeviceEnumerator_GetDevice(this, id, ByRef Device) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;wstr&quot;, id, &quot;ptr*&quot;, Device)
}
VA_IMMDeviceEnumerator_RegisterEndpointNotificationCallback(this, Client) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, Client)
}
VA_IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(this, Client) {
    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, Client)
}

;
; IMMDeviceCollection
;
VA_IMMDeviceCollection_GetCount(this, ByRef Count) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, Count)
}
VA_IMMDeviceCollection_Item(this, Index, ByRef Device) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;uint&quot;, Index, &quot;ptr*&quot;, Device)
}

;
; IControlInterface
;
VA_IControlInterface_GetName(this, ByRef Name) {
    hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, Name)
    VA_WStrOut(Name)
    return hr
}
VA_IControlInterface_GetIID(this, ByRef IID) {
    VarSetCapacity(IID,16,0)
    hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, &amp;IID)
    VA_GUIDOut(IID)
    return hr
}


/*
    INTERFACES REQUIRING WINDOWS 7 / SERVER 2008 R2
*/

;
; IAudioSessionControl2 : {bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}
;   extends IAudioSessionControl
;
VA_IAudioSessionControl2_GetSessionIdentifier(this, ByRef id) {
    hr := DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, id)
    VA_WStrOut(id)
    return hr
}
VA_IAudioSessionControl2_GetSessionInstanceIdentifier(this, ByRef id) {
    hr := DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, id)
    VA_WStrOut(id)
    return hr
}
VA_IAudioSessionControl2_GetProcessId(this, ByRef pid) {
    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), &quot;ptr&quot;, this, &quot;uint*&quot;, pid)
}
VA_IAudioSessionControl2_IsSystemSoundsSession(this) {
    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), &quot;ptr&quot;, this)
}
VA_IAudioSessionControl2_SetDuckingPreference(this, OptOut) {
    return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, OptOut)
}

;
; IAudioSessionManager2 : {77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F}
;   extends IAudioSessionManager
;
VA_IAudioSessionManager2_GetSessionEnumerator(this, ByRef SessionEnum) {
    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr*&quot;, SessionEnum)
}
VA_IAudioSessionManager2_RegisterSessionNotification(this, SessionNotification) {
    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, SessionNotification)
}
VA_IAudioSessionManager2_UnregisterSessionNotification(this, SessionNotification) {
    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, SessionNotification)
}
VA_IAudioSessionManager2_RegisterDuckNotification(this, SessionNotification) {
    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, SessionNotification)
}
VA_IAudioSessionManager2_UnregisterDuckNotification(this, SessionNotification) {
    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), &quot;ptr&quot;, this, &quot;ptr&quot;, SessionNotification)
}

;
; IAudioSessionEnumerator : {E2F5BB11-0570-40CA-ACDD-3AA01277DEE8}
;
VA_IAudioSessionEnumerator_GetCount(this, ByRef SessionCount) {
    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), &quot;ptr&quot;, this, &quot;int*&quot;, SessionCount)
}
VA_IAudioSessionEnumerator_GetSession(this, SessionCount, ByRef Session) {
    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), &quot;ptr&quot;, this, &quot;int&quot;, SessionCount, &quot;ptr*&quot;, Session)
}


/*
    UNDOCUMENTED INTERFACES
*/

; Thanks to Dave Amenta for publishing this interface - http://goo.gl/6L93L
; IID := &quot;{568b9108-44bf-40b4-9006-86afe5b5a620}&quot;
; CLSID := &quot;{294935CE-F637-4E7C-A41B-AB255460B862}&quot;
VA_xIPolicyConfigVista_SetDefaultEndpoint(this, DeviceId, Role) {
    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), &quot;ptr&quot;, this, &quot;wstr&quot;, DeviceId, &quot;int&quot;, Role)
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 24 Apr 2017 18:56:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115272#p115272</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Определение подключения/отключения наушников]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115271#p115271</link>
			<description><![CDATA[<p>На офф. сайте нашел только отсылки к msdn:<br /><a href="https://msdn.microsoft.com/en-us/library/dd371400">https://msdn.microsoft.com/en-us/library/dd371400</a><br /><a href="https://msdn.microsoft.com/en-us/library/dd370793.aspx">https://msdn.microsoft.com/en-us/library/dd370793.aspx</a><br />Еще есть костыль для тех, у кого стоит фирменная утилита от Realtek, которая показывает тултипы при поключении/отключении гарнитуры.</p><p>Пока воспользовался тем, что при переключении уровень громкости меняется (профили громкости отдельны для динамиков и наушников).<br />Код ниже выключает звук, если громкость становится равна заданному значению,<br />и включает, если громкость меняется на другое значение.<br /></p><div class="codebox"><pre><code>volumeLevel_Mute := 12 ; Set from 0 to 100
Loop {
	SoundGet, volumeLevel
	If (volumeLevel &lt;&gt; volumeLevelOld) {
		SoundGet, master_mute,, mute
		; ToolTip % Round(volumeLevel) &quot; &quot; master_mute
		If (Round(volumeLevel) = volumeLevel_Mute) &amp;&amp; (master_mute = &quot;Off&quot;) {
				SoundSet, +1, , mute ; Как выключить, а не переключить - не разобрался
		} else if ((Round(volumeLevel) &lt;&gt; volumeLevel_Mute) &amp;&amp; (master_mute = &quot;On&quot;)) {
				SoundSet MUTE,, MUTE
		}
	}
	volumeLevelOld:=volumeLevel
	Sleep 100
}
Esc::ExitApp</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Mon, 24 Apr 2017 17:13:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115271#p115271</guid>
		</item>
	</channel>
</rss>
