Advertisement
Guest User

Autohotkey VA library

a guest
Mar 16th, 2021
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; VA v2.3
  2.  
  3. ;
  4. ; MASTER CONTROLS
  5. ;
  6.  
  7. VA_GetMasterVolume(channel="", device_desc="playback") {
  8.     if ! aev := VA_GetAudioEndpointVolume(device_desc)
  9.         return
  10.     if channel =
  11.         VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(aev, vol)
  12.     else
  13.         VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(aev, channel-1, vol)
  14.     ObjRelease(aev)
  15.     return Round(vol*100,3)
  16. }
  17.  
  18. VA_SetMasterVolume(vol, channel="", device_desc="playback") {
  19.     vol := vol>100 ? 100 : vol<0 ? 0 : vol
  20.     if ! aev := VA_GetAudioEndpointVolume(device_desc)
  21.         return
  22.     if channel =
  23.         VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(aev, vol/100)
  24.     else
  25.         VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(aev, channel-1, vol/100)
  26.     ObjRelease(aev)
  27. }
  28.  
  29. VA_GetMasterChannelCount(device_desc="playback") {
  30.     if ! aev := VA_GetAudioEndpointVolume(device_desc)
  31.         return
  32.     VA_IAudioEndpointVolume_GetChannelCount(aev, count)
  33.     ObjRelease(aev)
  34.     return count
  35. }
  36.  
  37. VA_SetMasterMute(mute, device_desc="playback") {
  38.     if ! aev := VA_GetAudioEndpointVolume(device_desc)
  39.         return
  40.     VA_IAudioEndpointVolume_SetMute(aev, mute)
  41.     ObjRelease(aev)
  42. }
  43.  
  44. VA_GetMasterMute(device_desc="playback") {
  45.     if ! aev := VA_GetAudioEndpointVolume(device_desc)
  46.         return
  47.     VA_IAudioEndpointVolume_GetMute(aev, mute)
  48.     ObjRelease(aev)
  49.     return mute
  50. }
  51.  
  52. ;
  53. ; SUBUNIT CONTROLS
  54. ;
  55.  
  56. VA_GetVolume(subunit_desc="1", channel="", device_desc="playback") {
  57.     if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
  58.         return
  59.     VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
  60.     if channel =
  61.     {
  62.         vol = 0
  63.        
  64.         Loop, %channel_count%
  65.         {
  66.             VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
  67.             VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
  68.             this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
  69.            
  70.             ; "Speakers Properties" reports the highest channel as the volume.
  71.             if (this_vol > vol)
  72.                 vol := this_vol
  73.         }
  74.     }
  75.     else if channel between 1 and channel_count
  76.     {
  77.         channel -= 1
  78.         VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
  79.         VA_IPerChannelDbLevel_GetLevel(avl, channel, vol)
  80.         vol := VA_dB2Scalar(vol, min_dB, max_dB)
  81.     }
  82.     ObjRelease(avl)
  83.     return vol
  84. }
  85.  
  86. VA_SetVolume(vol, subunit_desc="1", channel="", device_desc="playback") {
  87.     if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
  88.         return
  89.    
  90.     vol := vol<0 ? 0 : vol>100 ? 100 : vol
  91.    
  92.     VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
  93.    
  94.     if channel =
  95.     {
  96.         ; Simple method -- resets balance to "center":
  97.         ;VA_IPerChannelDbLevel_SetLevelUniform(avl, vol)
  98.        
  99.         vol_max = 0
  100.        
  101.         Loop, %channel_count%
  102.         {
  103.             VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
  104.             VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
  105.             this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
  106.            
  107.             channel%A_Index%vol := this_vol
  108.             channel%A_Index%min := min_dB
  109.             channel%A_Index%max := max_dB
  110.            
  111.             ; Scale all channels relative to the loudest channel.
  112.             ; (This is how Vista's "Speakers Properties" dialog seems to work.)
  113.             if (this_vol > vol_max)
  114.                 vol_max := this_vol
  115.         }
  116.        
  117.         Loop, %channel_count%
  118.         {
  119.             this_vol := vol_max ? channel%A_Index%vol / vol_max * vol : vol
  120.             this_vol := VA_Scalar2dB(this_vol/100, channel%A_Index%min, channel%A_Index%max)            
  121.             VA_IPerChannelDbLevel_SetLevel(avl, A_Index-1, this_vol)
  122.         }
  123.     }
  124.     else if channel between 1 and %channel_count%
  125.     {
  126.         channel -= 1
  127.         VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
  128.         VA_IPerChannelDbLevel_SetLevel(avl, channel, VA_Scalar2dB(vol/100, min_dB, max_dB))
  129.     }
  130.     ObjRelease(avl)
  131. }
  132.  
  133. VA_GetChannelCount(subunit_desc="1", device_desc="playback") {
  134.     if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
  135.         return
  136.     VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
  137.     ObjRelease(avl)
  138.     return channel_count
  139. }
  140.  
  141. VA_SetMute(mute, subunit_desc="1", device_desc="playback") {
  142.     if ! amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
  143.         return
  144.     VA_IAudioMute_SetMute(amute, mute)
  145.     ObjRelease(amute)
  146. }
  147.  
  148. VA_GetMute(subunit_desc="1", device_desc="playback") {
  149.     if ! amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
  150.         return
  151.     VA_IAudioMute_GetMute(amute, muted)
  152.     ObjRelease(amute)
  153.     return muted
  154. }
  155.  
  156. ;
  157. ; AUDIO METERING
  158. ;
  159.  
  160. VA_GetAudioMeter(device_desc="playback") {
  161.     if ! device := VA_GetDevice(device_desc)
  162.         return 0
  163.     VA_IMMDevice_Activate(device, "{C02216F6-8C67-4B5B-9D00-D008E73E0064}", 7, 0, audioMeter)
  164.     ObjRelease(device)
  165.     return audioMeter
  166. }
  167.  
  168. VA_GetDevicePeriod(device_desc, ByRef default_period, ByRef minimum_period="") {
  169.     defaultPeriod := minimumPeriod := 0
  170.     if ! device := VA_GetDevice(device_desc)
  171.         return false
  172.     VA_IMMDevice_Activate(device, "{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}", 7, 0, audioClient)
  173.     ObjRelease(device)
  174.     ; IAudioClient::GetDevicePeriod
  175.     DllCall(NumGet(NumGet(audioClient+0)+9*A_PtrSize), "ptr",audioClient, "int64*",default_period, "int64*",minimum_period)
  176.     ; Convert 100-nanosecond units to milliseconds.
  177.     default_period /= 10000
  178.     minimum_period /= 10000    
  179.     ObjRelease(audioClient)
  180.     return true
  181. }
  182.  
  183. VA_GetAudioEndpointVolume(device_desc="playback") {
  184.     if ! device := VA_GetDevice(device_desc)
  185.         return 0
  186.     VA_IMMDevice_Activate(device, "{5CDF2C82-841E-4546-9722-0CF74078229A}", 7, 0, endpointVolume)
  187.     ObjRelease(device)
  188.     return endpointVolume
  189. }
  190.  
  191. VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid) {
  192.     if ! device := VA_GetDevice(device_desc)
  193.         return 0
  194.     subunit := VA_FindSubunit(device, subunit_desc, subunit_iid)
  195.     ObjRelease(device)
  196.     return subunit
  197. }
  198.  
  199. VA_FindSubunit(device, target_desc, target_iid) {
  200.     if target_desc is integer
  201.         target_index := target_desc
  202.     else
  203.         RegExMatch(target_desc, "(?<_name>.*?)(?::(?<_index>\d+))?$", target)
  204.     ; v2.01: Since target_name is now a regular expression, default to case-insensitive mode if no options are specified.
  205.     if !RegExMatch(target_name,"^[^\(]+\)")
  206.         target_name := "i)" target_name
  207.     r := VA_EnumSubunits(device, "VA_FindSubunitCallback", target_name, target_iid
  208.             , Object(0, target_index ? target_index : 1, 1, 0))
  209.     return r
  210. }
  211.  
  212. VA_FindSubunitCallback(part, interface, index) {
  213.     index[1] := index[1] + 1 ; current += 1
  214.     if (index[0] == index[1]) ; target == current ?
  215.     {
  216.         ObjAddRef(interface)
  217.         return interface
  218.     }
  219. }
  220.  
  221. VA_EnumSubunits(device, callback, target_name="", target_iid="", callback_param="") {
  222.     VA_IMMDevice_Activate(device, "{2A07407E-6497-4A18-9787-32F79BD0D98F}", 7, 0, deviceTopology)
  223.     VA_IDeviceTopology_GetConnector(deviceTopology, 0, conn)
  224.     ObjRelease(deviceTopology)
  225.     VA_IConnector_GetConnectedTo(conn, conn_to)
  226.     VA_IConnector_GetDataFlow(conn, data_flow)
  227.     ObjRelease(conn)
  228.     if !conn_to
  229.         return ; blank to indicate error
  230.     part := ComObjQuery(conn_to, "{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}") ; IID_IPart
  231.     ObjRelease(conn_to)
  232.     if !part
  233.         return
  234.     r := VA_EnumSubunitsEx(part, data_flow, callback, target_name, target_iid, callback_param)
  235.     ObjRelease(part)
  236.     return r ; value returned by callback, or zero.
  237. }
  238.  
  239. VA_EnumSubunitsEx(part, data_flow, callback, target_name="", target_iid="", callback_param="") {
  240.     r := 0
  241.    
  242.     VA_IPart_GetPartType(part, type)
  243.    
  244.     if type = 1 ; Subunit
  245.     {
  246.         VA_IPart_GetName(part, name)
  247.        
  248.         ; v2.01: target_name is now a regular expression.
  249.         if RegExMatch(name, target_name)
  250.         {
  251.             if target_iid =
  252.                 r := %callback%(part, 0, callback_param)
  253.             else
  254.                 if VA_IPart_Activate(part, 7, target_iid, interface) = 0
  255.                 {
  256.                     r := %callback%(part, interface, callback_param)
  257.                     ; The callback is responsible for calling ObjAddRef()
  258.                     ; if it intends to keep the interface pointer.
  259.                     ObjRelease(interface)
  260.                 }
  261.  
  262.             if r
  263.                 return r ; early termination
  264.         }
  265.     }
  266.    
  267.     if data_flow = 0
  268.         VA_IPart_EnumPartsIncoming(part, parts)
  269.     else
  270.         VA_IPart_EnumPartsOutgoing(part, parts)
  271.    
  272.     VA_IPartsList_GetCount(parts, count)
  273.     Loop %count%
  274.     {
  275.         VA_IPartsList_GetPart(parts, A_Index-1, subpart)        
  276.         r := VA_EnumSubunitsEx(subpart, data_flow, callback, target_name, target_iid, callback_param)
  277.         ObjRelease(subpart)
  278.         if r
  279.             break ; early termination
  280.     }
  281.     ObjRelease(parts)
  282.     return r ; continue/finished enumeration
  283. }
  284.  
  285. ; device_desc = device_id
  286. ;               | ( friendly_name | 'playback' | 'capture' ) [ ':' index ]
  287. VA_GetDevice(device_desc="playback") {
  288.     static CLSID_MMDeviceEnumerator := "{BCDE0395-E52F-467C-8E3D-C4579291692E}"
  289.         , IID_IMMDeviceEnumerator := "{A95664D2-9614-4F35-A746-DE8DB63617E6}"
  290.     if !(deviceEnumerator := ComObjCreate(CLSID_MMDeviceEnumerator, IID_IMMDeviceEnumerator))
  291.         return 0
  292.    
  293.     device := 0
  294.    
  295.     if VA_IMMDeviceEnumerator_GetDevice(deviceEnumerator, device_desc, device) = 0
  296.         goto VA_GetDevice_Return
  297.    
  298.     if device_desc is integer
  299.     {
  300.         m2 := device_desc
  301.         if m2 >= 4096 ; Probably a device pointer, passed here indirectly via VA_GetAudioMeter or such.
  302.         {
  303.             ObjAddRef(device := m2)
  304.             goto VA_GetDevice_Return
  305.         }
  306.     }
  307.     else
  308.         RegExMatch(device_desc, "(.*?)\s*(?::(\d+))?$", m)
  309.    
  310.     if m1 in playback,p
  311.         m1 := "", flow := 0 ; eRender
  312.     else if m1 in capture,c
  313.         m1 := "", flow := 1 ; eCapture
  314.     else if (m1 . m2) = ""  ; no name or number specified
  315.         m1 := "", flow := 0 ; eRender (default)
  316.     else
  317.         flow := 2 ; eAll
  318.    
  319.     if (m1 . m2) = ""   ; no name or number (maybe "playback" or "capture")
  320.     {
  321.         VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(deviceEnumerator, flow, 0, device)
  322.         goto VA_GetDevice_Return
  323.     }
  324.  
  325.     VA_IMMDeviceEnumerator_EnumAudioEndpoints(deviceEnumerator, flow, 1, devices)
  326.    
  327.     if m1 =
  328.     {
  329.         VA_IMMDeviceCollection_Item(devices, m2-1, device)
  330.         goto VA_GetDevice_Return
  331.     }
  332.    
  333.     VA_IMMDeviceCollection_GetCount(devices, count)
  334.     index := 0
  335.     Loop % count
  336.         if VA_IMMDeviceCollection_Item(devices, A_Index-1, device) = 0
  337.             if InStr(VA_GetDeviceName(device), m1) && (m2 = "" || ++index = m2)
  338.                 goto VA_GetDevice_Return
  339.             else
  340.                 ObjRelease(device), device:=0
  341.  
  342. VA_GetDevice_Return:
  343.    ObjRelease(deviceEnumerator)
  344.     if devices
  345.         ObjRelease(devices)
  346.    
  347.     return device ; may be 0
  348. }
  349.  
  350. VA_GetDeviceName(device) {
  351.     static PKEY_Device_FriendlyName
  352.     if !VarSetCapacity(PKEY_Device_FriendlyName)
  353.         VarSetCapacity(PKEY_Device_FriendlyName, 20)
  354.         ,VA_GUID(PKEY_Device_FriendlyName :="{A45C254E-DF1C-4EFD-8020-67D146A850E0}")
  355.         ,NumPut(14, PKEY_Device_FriendlyName, 16)
  356.     VarSetCapacity(prop, 16)
  357.     VA_IMMDevice_OpenPropertyStore(device, 0, store)
  358.     ; store->GetValue(.., [out] prop)
  359.     DllCall(NumGet(NumGet(store+0)+5*A_PtrSize), "ptr", store, "ptr", &PKEY_Device_FriendlyName, "ptr", &prop)
  360.     ObjRelease(store)
  361.     VA_WStrOut(deviceName := NumGet(prop,8))
  362.     return deviceName
  363. }
  364.  
  365. VA_SetDefaultEndpoint(device_desc, role) {
  366.     /* Roles:
  367.          eConsole        = 0  ; Default Device
  368.          eMultimedia     = 1
  369.          eCommunications = 2  ; Default Communications Device
  370.     */
  371.     if ! device := VA_GetDevice(device_desc)
  372.         return 0
  373.     if VA_IMMDevice_GetId(device, id) = 0
  374.     {
  375.         cfg := ComObjCreate("{294935CE-F637-4E7C-A41B-AB255460B862}"
  376.                           , "{568b9108-44bf-40b4-9006-86afe5b5a620}")
  377.         hr := VA_xIPolicyConfigVista_SetDefaultEndpoint(cfg, id, role)
  378.         ObjRelease(cfg)
  379.     }
  380.     ObjRelease(device)
  381.     return hr = 0
  382. }
  383.  
  384.  
  385. ;
  386. ; HELPERS
  387. ;
  388.  
  389. ; Convert string to binary GUID structure.
  390. VA_GUID(ByRef guid_out, guid_in="%guid_out%") {
  391.     if (guid_in == "%guid_out%")
  392.         guid_in :=   guid_out
  393.     if  guid_in is integer
  394.         return guid_in
  395.     VarSetCapacity(guid_out, 16, 0)
  396.     DllCall("ole32\CLSIDFromString", "wstr", guid_in, "ptr", &guid_out)
  397.     return &guid_out
  398. }
  399.  
  400. ; Convert binary GUID structure to string.
  401. VA_GUIDOut(ByRef guid) {
  402.     VarSetCapacity(buf, 78)
  403.     DllCall("ole32\StringFromGUID2", "ptr", &guid, "ptr", &buf, "int", 39)
  404.     guid := StrGet(&buf, "UTF-16")
  405. }
  406.  
  407. ; Convert COM-allocated wide char string pointer to usable string.
  408. VA_WStrOut(ByRef str) {
  409.     str := StrGet(ptr := str, "UTF-16")
  410.     DllCall("ole32\CoTaskMemFree", "ptr", ptr)  ; FREES THE STRING.
  411. }
  412.  
  413. VA_dB2Scalar(dB, min_dB, max_dB) {
  414.     min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
  415.     return ((10**(dB/20))-min_s)/(max_s-min_s)*100
  416. }
  417.  
  418. VA_Scalar2dB(s, min_dB, max_dB) {
  419.     min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
  420.     return log((max_s-min_s)*s+min_s)*20
  421. }
  422.  
  423.  
  424. ;
  425. ; INTERFACE WRAPPERS
  426. ;   Reference: Core Audio APIs in Windows Vista -- Programming Reference
  427. ;       http://msdn2.microsoft.com/en-us/library/ms679156(VS.85).aspx
  428. ;
  429.  
  430. ;
  431. ; IMMDevice : {D666063F-1587-4E43-81F1-B948E807363F}
  432. ;
  433. VA_IMMDevice_Activate(this, iid, ClsCtx, ActivationParams, ByRef Interface) {
  434.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "uint", ClsCtx, "uint", ActivationParams, "ptr*", Interface)
  435. }
  436. VA_IMMDevice_OpenPropertyStore(this, Access, ByRef Properties) {
  437.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Access, "ptr*", Properties)
  438. }
  439. VA_IMMDevice_GetId(this, ByRef Id) {
  440.     hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", Id)
  441.     VA_WStrOut(Id)
  442.     return hr
  443. }
  444. VA_IMMDevice_GetState(this, ByRef State) {
  445.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", State)
  446. }
  447.  
  448. ;
  449. ; IDeviceTopology : {2A07407E-6497-4A18-9787-32F79BD0D98F}
  450. ;
  451. VA_IDeviceTopology_GetConnectorCount(this, ByRef Count) {
  452.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
  453. }
  454. VA_IDeviceTopology_GetConnector(this, Index, ByRef Connector) {
  455.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Connector)
  456. }
  457. VA_IDeviceTopology_GetSubunitCount(this, ByRef Count) {
  458.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", Count)
  459. }
  460. VA_IDeviceTopology_GetSubunit(this, Index, ByRef Subunit) {
  461.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Subunit)
  462. }
  463. VA_IDeviceTopology_GetPartById(this, Id, ByRef Part) {
  464.     return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "uint", Id, "ptr*", Part)
  465. }
  466. VA_IDeviceTopology_GetDeviceId(this, ByRef DeviceId) {
  467.     hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", DeviceId)
  468.     VA_WStrOut(DeviceId)
  469.     return hr
  470. }
  471. VA_IDeviceTopology_GetSignalPath(this, PartFrom, PartTo, RejectMixedPaths, ByRef Parts) {
  472.     return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", PartFrom, "ptr", PartTo, "int", RejectMixedPaths, "ptr*", Parts)
  473. }
  474.  
  475. ;
  476. ; IConnector : {9c2c4058-23f5-41de-877a-df3af236a09e}
  477. ;
  478. VA_IConnector_GetType(this, ByRef Type) {
  479.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", Type)
  480. }
  481. VA_IConnector_GetDataFlow(this, ByRef Flow) {
  482.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int*", Flow)
  483. }
  484. VA_IConnector_ConnectTo(this, ConnectTo) {
  485.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr", ConnectTo)
  486. }
  487. VA_IConnector_Disconnect(this) {
  488.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this)
  489. }
  490. VA_IConnector_IsConnected(this, ByRef Connected) {
  491.     return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "int*", Connected)
  492. }
  493. VA_IConnector_GetConnectedTo(this, ByRef ConTo) {
  494.     return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr*", ConTo)
  495. }
  496. VA_IConnector_GetConnectorIdConnectedTo(this, ByRef ConnectorId) {
  497.     hr := DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr*", ConnectorId)
  498.     VA_WStrOut(ConnectorId)
  499.     return hr
  500. }
  501. VA_IConnector_GetDeviceIdConnectedTo(this, ByRef DeviceId) {
  502.     hr := DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr*", DeviceId)
  503.     VA_WStrOut(DeviceId)
  504.     return hr
  505. }
  506.  
  507. ;
  508. ; IPart : {AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}
  509. ;
  510. VA_IPart_GetName(this, ByRef Name) {
  511.     hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr*", Name)
  512.     VA_WStrOut(Name)
  513.     return hr
  514. }
  515. VA_IPart_GetLocalId(this, ByRef Id) {
  516.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", Id)
  517. }
  518. VA_IPart_GetGlobalId(this, ByRef GlobalId) {
  519.     hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr*", GlobalId)
  520.     VA_WStrOut(GlobalId)
  521.     return hr
  522. }
  523. VA_IPart_GetPartType(this, ByRef PartType) {
  524.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "int*", PartType)
  525. }
  526. VA_IPart_GetSubType(this, ByRef SubType) {
  527.     VarSetCapacity(SubType,16,0)
  528.     hr := DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", &SubType)
  529.     VA_GUIDOut(SubType)
  530.     return hr
  531. }
  532. VA_IPart_GetControlInterfaceCount(this, ByRef Count) {
  533.     return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", Count)
  534. }
  535. VA_IPart_GetControlInterface(this, Index, ByRef InterfaceDesc) {
  536.     return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "uint", Index, "ptr*", InterfaceDesc)
  537. }
  538. VA_IPart_EnumPartsIncoming(this, ByRef Parts) {
  539.     return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr*", Parts)
  540. }
  541. VA_IPart_EnumPartsOutgoing(this, ByRef Parts) {
  542.     return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "ptr*", Parts)
  543. }
  544. VA_IPart_GetTopologyObject(this, ByRef Topology) {
  545.     return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "ptr*", Topology)
  546. }
  547. VA_IPart_Activate(this, ClsContext, iid, ByRef Object) {
  548.     return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "uint", ClsContext, "ptr", VA_GUID(iid), "ptr*", Object)
  549. }
  550. VA_IPart_RegisterControlChangeCallback(this, iid, Notify) {
  551.     return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "ptr", Notify)
  552. }
  553. VA_IPart_UnregisterControlChangeCallback(this, Notify) {
  554.     return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this, "ptr", Notify)
  555. }
  556.  
  557. ;
  558. ; IPartsList : {6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB}
  559. ;
  560. VA_IPartsList_GetCount(this, ByRef Count) {
  561.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
  562. }
  563. VA_IPartsList_GetPart(this, INdex, ByRef Part) {
  564.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Part)
  565. }
  566.  
  567. ;
  568. ; IAudioEndpointVolume : {5CDF2C82-841E-4546-9722-0CF74078229A}
  569. ;
  570. VA_IAudioEndpointVolume_RegisterControlChangeNotify(this, Notify) {
  571.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", Notify)
  572. }
  573. VA_IAudioEndpointVolume_UnregisterControlChangeNotify(this, Notify) {
  574.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", Notify)
  575. }
  576. VA_IAudioEndpointVolume_GetChannelCount(this, ByRef ChannelCount) {
  577.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", ChannelCount)
  578. }
  579. VA_IAudioEndpointVolume_SetMasterVolumeLevel(this, LevelDB, GuidEventContext="") {
  580.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
  581. }
  582. VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(this, Level, GuidEventContext="") {
  583.     return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "float", Level, "ptr", VA_GUID(GuidEventContext))
  584. }
  585. VA_IAudioEndpointVolume_GetMasterVolumeLevel(this, ByRef LevelDB) {
  586.     return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "float*", LevelDB)
  587. }
  588. VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(this, ByRef Level) {
  589.     return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "float*", Level)
  590. }
  591. VA_IAudioEndpointVolume_SetChannelVolumeLevel(this, Channel, LevelDB, GuidEventContext="") {
  592.     return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "uint", Channel, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
  593. }
  594. VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(this, Channel, Level, GuidEventContext="") {
  595.     return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "uint", Channel, "float", Level, "ptr", VA_GUID(GuidEventContext))
  596. }
  597. VA_IAudioEndpointVolume_GetChannelVolumeLevel(this, Channel, ByRef LevelDB) {
  598.     return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "uint", Channel, "float*", LevelDB)
  599. }
  600. VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(this, Channel, ByRef Level) {
  601.     return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "uint", Channel, "float*", Level)
  602. }
  603. VA_IAudioEndpointVolume_SetMute(this, Mute, GuidEventContext="") {
  604.     return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "int", Mute, "ptr", VA_GUID(GuidEventContext))
  605. }
  606. VA_IAudioEndpointVolume_GetMute(this, ByRef Mute) {
  607.     return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this, "int*", Mute)
  608. }
  609. VA_IAudioEndpointVolume_GetVolumeStepInfo(this, ByRef Step, ByRef StepCount) {
  610.     return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), "ptr", this, "uint*", Step, "uint*", StepCount)
  611. }
  612. VA_IAudioEndpointVolume_VolumeStepUp(this, GuidEventContext="") {
  613.     return DllCall(NumGet(NumGet(this+0)+17*A_PtrSize), "ptr", this, "ptr", VA_GUID(GuidEventContext))
  614. }
  615. VA_IAudioEndpointVolume_VolumeStepDown(this, GuidEventContext="") {
  616.     return DllCall(NumGet(NumGet(this+0)+18*A_PtrSize), "ptr", this, "ptr", VA_GUID(GuidEventContext))
  617. }
  618. VA_IAudioEndpointVolume_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
  619.     return DllCall(NumGet(NumGet(this+0)+19*A_PtrSize), "ptr", this, "uint*", HardwareSupportMask)
  620. }
  621. VA_IAudioEndpointVolume_GetVolumeRange(this, ByRef MinDB, ByRef MaxDB, ByRef IncrementDB) {
  622.     return DllCall(NumGet(NumGet(this+0)+20*A_PtrSize), "ptr", this, "float*", MinDB, "float*", MaxDB, "float*", IncrementDB)
  623. }
  624.  
  625. ;
  626. ; IPerChannelDbLevel  : {C2F8E001-F205-4BC9-99BC-C13B1E048CCB}
  627. ;   IAudioVolumeLevel : {7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}
  628. ;   IAudioBass        : {A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5}
  629. ;   IAudioMidrange    : {5E54B6D7-B44B-40D9-9A9E-E691D9CE6EDF}
  630. ;   IAudioTreble      : {0A717812-694E-4907-B74B-BAFA5CFDCA7B}
  631. ;
  632. VA_IPerChannelDbLevel_GetChannelCount(this, ByRef Channels) {
  633.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Channels)
  634. }
  635. VA_IPerChannelDbLevel_GetLevelRange(this, Channel, ByRef MinLevelDB, ByRef MaxLevelDB, ByRef Stepping) {
  636.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Channel, "float*", MinLevelDB, "float*", MaxLevelDB, "float*", Stepping)
  637. }
  638. VA_IPerChannelDbLevel_GetLevel(this, Channel, ByRef LevelDB) {
  639.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint", Channel, "float*", LevelDB)
  640. }
  641. VA_IPerChannelDbLevel_SetLevel(this, Channel, LevelDB, GuidEventContext="") {
  642.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint", Channel, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
  643. }
  644. VA_IPerChannelDbLevel_SetLevelUniform(this, LevelDB, GuidEventContext="") {
  645.     return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
  646. }
  647. VA_IPerChannelDbLevel_SetLevelAllChannels(this, LevelsDB, ChannelCount, GuidEventContext="") {
  648.     return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint", LevelsDB, "uint", ChannelCount, "ptr", VA_GUID(GuidEventContext))
  649. }
  650.  
  651. ;
  652. ; IAudioMute : {DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}
  653. ;
  654. VA_IAudioMute_SetMute(this, Muted, GuidEventContext="") {
  655.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", Muted, "ptr", VA_GUID(GuidEventContext))
  656. }
  657. VA_IAudioMute_GetMute(this, ByRef Muted) {
  658.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int*", Muted)
  659. }
  660.  
  661. ;
  662. ; IAudioAutoGainControl : {85401FD4-6DE4-4b9d-9869-2D6753A82F3C}
  663. ;
  664. VA_IAudioAutoGainControl_GetEnabled(this, ByRef Enabled) {
  665.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", Enabled)
  666. }
  667. VA_IAudioAutoGainControl_SetEnabled(this, Enable, GuidEventContext="") {
  668.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", Enable, "ptr", VA_GUID(GuidEventContext))
  669. }
  670.  
  671. ;
  672. ; IAudioMeterInformation : {C02216F6-8C67-4B5B-9D00-D008E73E0064}
  673. ;
  674. VA_IAudioMeterInformation_GetPeakValue(this, ByRef Peak) {
  675.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "float*", Peak)
  676. }
  677. VA_IAudioMeterInformation_GetMeteringChannelCount(this, ByRef ChannelCount) {
  678.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", ChannelCount)
  679. }
  680. VA_IAudioMeterInformation_GetChannelsPeakValues(this, ChannelCount, PeakValues) {
  681.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint", ChannelCount, "ptr", PeakValues)
  682. }
  683. VA_IAudioMeterInformation_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
  684.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", HardwareSupportMask)
  685. }
  686.  
  687. ;
  688. ; IAudioClient : {1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}
  689. ;
  690. VA_IAudioClient_Initialize(this, ShareMode, StreamFlags, BufferDuration, Periodicity, Format, AudioSessionGuid) {
  691.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", ShareMode, "uint", StreamFlags, "int64", BufferDuration, "int64", Periodicity, "ptr", Format, "ptr", VA_GUID(AudioSessionGuid))
  692. }
  693. VA_IAudioClient_GetBufferSize(this, ByRef NumBufferFrames) {
  694.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", NumBufferFrames)
  695. }
  696. VA_IAudioClient_GetStreamLatency(this, ByRef Latency) {
  697.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "int64*", Latency)
  698. }
  699. VA_IAudioClient_GetCurrentPadding(this, ByRef NumPaddingFrames) {
  700.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", NumPaddingFrames)
  701. }
  702. VA_IAudioClient_IsFormatSupported(this, ShareMode, Format, ByRef ClosestMatch) {
  703.     return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "int", ShareMode, "ptr", Format, "ptr*", ClosestMatch)
  704. }
  705. VA_IAudioClient_GetMixFormat(this, ByRef Format) {
  706.     return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", Format)
  707. }
  708. VA_IAudioClient_GetDevicePeriod(this, ByRef DefaultDevicePeriod, ByRef MinimumDevicePeriod) {
  709.     return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "int64*", DefaultDevicePeriod, "int64*", MinimumDevicePeriod)
  710. }
  711. VA_IAudioClient_Start(this) {
  712.     return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this)
  713. }
  714. VA_IAudioClient_Stop(this) {
  715.     return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this)
  716. }
  717. VA_IAudioClient_Reset(this) {
  718.     return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this)
  719. }
  720. VA_IAudioClient_SetEventHandle(this, eventHandle) {
  721.     return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "ptr", eventHandle)
  722. }
  723. VA_IAudioClient_GetService(this, iid, ByRef Service) {
  724.     return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "ptr*", Service)
  725. }
  726.  
  727. ;
  728. ; IAudioSessionControl : {F4B1A599-7266-4319-A8CA-E70ACB11E8CD}
  729. ;
  730. /*
  731. AudioSessionStateInactive = 0
  732. AudioSessionStateActive = 1
  733. AudioSessionStateExpired = 2
  734. */
  735. VA_IAudioSessionControl_GetState(this, ByRef State) {
  736.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", State)
  737. }
  738. VA_IAudioSessionControl_GetDisplayName(this, ByRef DisplayName) {
  739.     hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr*", DisplayName)
  740.     VA_WStrOut(DisplayName)
  741.     return hr
  742. }
  743. VA_IAudioSessionControl_SetDisplayName(this, DisplayName, EventContext) {
  744.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "wstr", DisplayName, "ptr", VA_GUID(EventContext))
  745. }
  746. VA_IAudioSessionControl_GetIconPath(this, ByRef IconPath) {
  747.     hr := DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr*", IconPath)
  748.     VA_WStrOut(IconPath)
  749.     return hr
  750. }
  751. VA_IAudioSessionControl_SetIconPath(this, IconPath) {
  752.     return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "wstr", IconPath)
  753. }
  754. VA_IAudioSessionControl_GetGroupingParam(this, ByRef Param) {
  755.     VarSetCapacity(Param,16,0)
  756.     hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr", &Param)
  757.     VA_GUIDOut(Param)
  758.     return hr
  759. }
  760. VA_IAudioSessionControl_SetGroupingParam(this, Param, EventContext) {
  761.     return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", VA_GUID(Param), "ptr", VA_GUID(EventContext))
  762. }
  763. VA_IAudioSessionControl_RegisterAudioSessionNotification(this, NewNotifications) {
  764.     return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr", NewNotifications)
  765. }
  766. VA_IAudioSessionControl_UnregisterAudioSessionNotification(this, NewNotifications) {
  767.     return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "ptr", NewNotifications)
  768. }
  769.  
  770. ;
  771. ; IAudioSessionManager : {BFA971F1-4D5E-40BB-935E-967039BFBEE4}
  772. ;
  773. VA_IAudioSessionManager_GetAudioSessionControl(this, AudioSessionGuid) {
  774.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", VA_GUID(AudioSessionGuid))
  775. }
  776. VA_IAudioSessionManager_GetSimpleAudioVolume(this, AudioSessionGuid, StreamFlags, ByRef AudioVolume) {
  777.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", VA_GUID(AudioSessionGuid), "uint", StreamFlags, "uint*", AudioVolume)
  778. }
  779.  
  780. ;
  781. ; IMMDeviceEnumerator
  782. ;
  783. VA_IMMDeviceEnumerator_EnumAudioEndpoints(this, DataFlow, StateMask, ByRef Devices) {
  784.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", DataFlow, "uint", StateMask, "ptr*", Devices)
  785. }
  786. VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(this, DataFlow, Role, ByRef Endpoint) {
  787.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", DataFlow, "int", Role, "ptr*", Endpoint)
  788. }
  789. VA_IMMDeviceEnumerator_GetDevice(this, id, ByRef Device) {
  790.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "wstr", id, "ptr*", Device)
  791. }
  792. VA_IMMDeviceEnumerator_RegisterEndpointNotificationCallback(this, Client) {
  793.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr", Client)
  794. }
  795. VA_IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(this, Client) {
  796.     return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", Client)
  797. }
  798.  
  799. ;
  800. ; IMMDeviceCollection
  801. ;
  802. VA_IMMDeviceCollection_GetCount(this, ByRef Count) {
  803.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
  804. }
  805. VA_IMMDeviceCollection_Item(this, Index, ByRef Device) {
  806.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Device)
  807. }
  808.  
  809. ;
  810. ; IControlInterface
  811. ;
  812. VA_IControlInterface_GetName(this, ByRef Name) {
  813.     hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr*", Name)
  814.     VA_WStrOut(Name)
  815.     return hr
  816. }
  817. VA_IControlInterface_GetIID(this, ByRef IID) {
  818.     VarSetCapacity(IID,16,0)
  819.     hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", &IID)
  820.     VA_GUIDOut(IID)
  821.     return hr
  822. }
  823.  
  824.  
  825. /*
  826.     INTERFACES REQUIRING WINDOWS 7 / SERVER 2008 R2
  827. */
  828.  
  829. ;
  830. ; IAudioSessionControl2 : {bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}
  831. ;   extends IAudioSessionControl
  832. ;
  833. VA_IAudioSessionControl2_GetSessionIdentifier(this, ByRef id) {
  834.     hr := DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "ptr*", id)
  835.     VA_WStrOut(id)
  836.     return hr
  837. }
  838. VA_IAudioSessionControl2_GetSessionInstanceIdentifier(this, ByRef id) {
  839.     hr := DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "ptr*", id)
  840.     VA_WStrOut(id)
  841.     return hr
  842. }
  843. VA_IAudioSessionControl2_GetProcessId(this, ByRef pid) {
  844.     return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "uint*", pid)
  845. }
  846. VA_IAudioSessionControl2_IsSystemSoundsSession(this) {
  847.     return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this)
  848. }
  849. VA_IAudioSessionControl2_SetDuckingPreference(this, OptOut) {
  850.     return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), "ptr", this, "int", OptOut)
  851. }
  852.  
  853. ;
  854. ; IAudioSessionManager2 : {77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F}
  855. ;   extends IAudioSessionManager
  856. ;
  857. VA_IAudioSessionManager2_GetSessionEnumerator(this, ByRef SessionEnum) {
  858.     return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr*", SessionEnum)
  859. }
  860. VA_IAudioSessionManager2_RegisterSessionNotification(this, SessionNotification) {
  861.     return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr", SessionNotification)
  862. }
  863. VA_IAudioSessionManager2_UnregisterSessionNotification(this, SessionNotification) {
  864.     return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", SessionNotification)
  865. }
  866. VA_IAudioSessionManager2_RegisterDuckNotification(this, SessionNotification) {
  867.     return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr", SessionNotification)
  868. }
  869. VA_IAudioSessionManager2_UnregisterDuckNotification(this, SessionNotification) {
  870.     return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", SessionNotification)
  871. }
  872.  
  873. ;
  874. ; IAudioSessionEnumerator : {E2F5BB11-0570-40CA-ACDD-3AA01277DEE8}
  875. ;
  876. VA_IAudioSessionEnumerator_GetCount(this, ByRef SessionCount) {
  877.     return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", SessionCount)
  878. }
  879. VA_IAudioSessionEnumerator_GetSession(this, SessionCount, ByRef Session) {
  880.     return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", SessionCount, "ptr*", Session)
  881. }
  882.  
  883.  
  884. /*
  885.     UNDOCUMENTED INTERFACES
  886. */
  887.  
  888. ; Thanks to Dave Amenta for publishing this interface - http://goo.gl/6L93L
  889. ; IID := "{568b9108-44bf-40b4-9006-86afe5b5a620}"
  890. ; CLSID := "{294935CE-F637-4E7C-A41B-AB255460B862}"
  891. VA_xIPolicyConfigVista_SetDefaultEndpoint(this, DeviceId, Role) {
  892.     return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "wstr", DeviceId, "int", Role)
  893. }
  894.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement