VA.ahk 34 KB

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