VA.ahk.bak 34 KB

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