]> Tony Duckles's Git Repositories (git.nynim.org) - autohotkey-scripts.git/blob - Lib/VA.ahk
Init AutoHotKey
[autohotkey-scripts.git] / Lib / VA.ahk
1 ;
2 ; MASTER CONTROLS
3 ;
4
5 VA_GetMasterVolume(channel="", device_desc="playback")
6 {
7 aev := VA_GetAudioEndpointVolume(device_desc)
8 if channel =
9 VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(aev, vol)
10 else
11 VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(aev, channel-1, vol)
12 COM_Release(aev)
13 return vol*100
14 }
15
16 VA_SetMasterVolume(vol, channel="", device_desc="playback")
17 {
18 vol := vol>100 ? 100 : vol<0 ? 0 : vol
19 aev := VA_GetAudioEndpointVolume(device_desc)
20 if channel =
21 VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(aev, vol/100)
22 else
23 VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(aev, channel-1, vol/100)
24 COM_Release(aev)
25 }
26
27 VA_GetMasterChannelCount(device_desc="playback")
28 {
29 aev := VA_GetAudioEndpointVolume(device_desc)
30 VA_IAudioEndpointVolume_GetChannelCount(aev, count)
31 COM_Release(aev)
32 return count
33 }
34
35 VA_SetMasterMute(mute, device_desc="playback")
36 {
37 aev := VA_GetAudioEndpointVolume(device_desc)
38 VA_IAudioEndpointVolume_SetMute(aev, mute)
39 COM_Release(aev)
40 }
41
42 VA_GetMasterMute(device_desc="playback")
43 {
44 aev := VA_GetAudioEndpointVolume(device_desc)
45 VA_IAudioEndpointVolume_GetMute(aev, mute)
46 COM_Release(aev)
47 return mute
48 }
49
50 ;
51 ; SUBUNIT CONTROLS
52 ;
53
54 VA_GetVolume(subunit_desc="1", channel="", device_desc="playback")
55 {
56 avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
57 if !avl
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 COM_Release(avl)
83 return vol
84 }
85
86 VA_SetVolume(vol, subunit_desc="1", channel="", device_desc="playback")
87 {
88 avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
89 if !avl
90 return
91
92 vol := vol<0 ? 0 : vol>100 ? 100 : vol
93
94 VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
95
96 if channel =
97 {
98 ; Simple method -- resets balance to "center":
99 ;VA_IPerChannelDbLevel_SetLevelUniform(avl, vol)
100
101 vol_max = 0
102
103 Loop, %channel_count%
104 {
105 VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
106 VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
107 this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
108
109 channel%A_Index%vol := this_vol
110 channel%A_Index%min := min_dB
111 channel%A_Index%max := max_dB
112
113 ; Scale all channels relative to the loudest channel.
114 ; (This is how Vista's "Speakers Properties" dialog seems to work.)
115 if (this_vol > vol_max)
116 vol_max := this_vol
117 }
118
119 Loop, %channel_count%
120 {
121 this_vol := channel%A_Index%vol / vol_max * vol
122 this_vol := VA_Scalar2dB(this_vol/100, channel%A_Index%min, channel%A_Index%max)
123 VA_IPerChannelDbLevel_SetLevel(avl, A_Index-1, this_vol)
124 }
125 }
126 else if channel between 1 and %channel_count%
127 {
128 channel -= 1
129 VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
130 VA_IPerChannelDbLevel_SetLevel(avl, channel, VA_Scalar2dB(vol/100, min_dB, max_dB))
131 }
132 COM_Release(avl)
133 }
134
135 VA_GetChannelCount(subunit_desc="1", device_desc="playback")
136 {
137 avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
138 if !avl
139 return
140 VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
141 COM_Release(avl)
142 return channel_count
143 }
144
145 VA_SetMute(mute, subunit_desc="1", device_desc="playback")
146 {
147 amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
148 if !amute
149 return
150 VA_IAudioMute_SetMute(amute, mute)
151 COM_Release(amute)
152 }
153
154 VA_GetMute(subunit_desc="1", device_desc="playback")
155 {
156 amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
157 if !amute
158 return
159 VA_IAudioMute_GetMute(amute, muted)
160 COM_Release(amute)
161 return muted
162 }
163
164 ;
165 ; AUDIO METERING
166 ;
167
168 VA_GetAudioMeter(device_desc="playback")
169 {
170 if ! device := VA_GetDevice(device_desc)
171 return 0
172 VA_IMMDevice_Activate(device, "{C02216F6-8C67-4B5B-9D00-D008E73E0064}", 7, 0, audioMeter)
173 return audioMeter
174 }
175
176 VA_GetDevicePeriod(device_desc, ByRef default_period, ByRef minimum_period="")
177 {
178 defaultPeriod := minimumPeriod := 0
179 if ! device := VA_GetDevice(device_desc)
180 return false
181 VA_IMMDevice_Activate(device, "{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}", 7, 0, audioClient)
182 COM_Release(device)
183 ; IAudioClient::GetDevicePeriod
184 DllCall(NumGet(NumGet(audioClient+0)+36), "uint",audioClient, "int64*",default_period, "int64*",minimum_period)
185 ; Convert 100-nanosecond units to milliseconds.
186 default_period /= 10000
187 minimum_period /= 10000
188 COM_Release(audioClient)
189 return true
190 }
191
192
193 /* IID
194 COM_GUID4String(IID_IAudioEndpointVolume,"{5CDF2C82-841E-4546-9722-0CF74078229A}")
195 COM_GUID4String(IID_IAudioVolumeLevel,"{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
196 COM_GUID4String(IID_IAudioMute,"{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
197 COM_GUID4String(IID_IAudioAutoGainControl,"{85401FD4-6DE4-4b9d-9869-2D6753A82F3C}")
198 */
199
200 VA_GetAudioEndpointVolume(device_desc="playback")
201 {
202 if ! device := VA_GetDevice(device_desc)
203 return 0
204 VA_IMMDevice_Activate(device, "{5CDF2C82-841E-4546-9722-0CF74078229A}", 7, 0, endpointVolume)
205 COM_Release(device)
206 return endpointVolume
207 }
208
209 VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid)
210 {
211 device := VA_GetDevice(device_desc)
212 if !device
213 return 0
214 subunit := VA_FindSubunit(device, subunit_desc, subunit_iid)
215 COM_Release(device)
216 return subunit
217 }
218
219 VA_FindSubunit(device, target_desc, target_iid)
220 {
221 if target_desc is integer
222 target_index := target_desc
223 else
224 RegExMatch(target_desc, "(?<_name>.*?)(?::(?<_index>\d+))?$", target)
225 ; v2.01: Since target_name is now a regular expression, default to case-insensitive mode if no options are specified.
226 if !RegExMatch(target_name,"[imsxADJUXPS`n`r`a ]+\)")
227 target_name := "i)" target_name
228 ; cbinfo:
229 ; @0 target_index
230 ; @4 current_index
231 VarSetCapacity(cbinfo, 8, 0)
232 NumPut(target_index ? target_index : 1, cbinfo, 0)
233 r := VA_EnumSubunits(device, "VA_FindSubunitCallback", target_name, target_iid, &cbinfo)
234 DllCall("GlobalFree", "uint", callback)
235 return r
236 }
237
238 VA_FindSubunitCallback(part, interface, prm)
239 {
240 NumPut(index := 1 + NumGet(prm+4), prm+4)
241 if NumGet(prm+0) = index
242 {
243 COM_AddRef(interface)
244 return interface
245 }
246 }
247
248 VA_EnumSubunits(device, callback, target_name="", target_iid="", callback_param="")
249 {
250 VA_IMMDevice_Activate(device, "{2A07407E-6497-4A18-9787-32F79BD0D98F}", 7, 0, deviceTopology)
251 VA_IDeviceTopology_GetConnector(deviceTopology, 0, conn)
252 COM_Release(deviceTopology)
253 VA_IConnector_GetConnectedTo(conn, conn_to)
254 VA_IConnector_GetDataFlow(conn, data_flow)
255 COM_Release(conn)
256 if !conn_to
257 return ; blank to indicate error
258 part := COM_QueryInterface(conn_to, "{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}")
259 COM_Release(conn_to)
260 r := VA_EnumSubunitsEx(part, data_flow, callback, target_name, target_iid, callback_param)
261 COM_Release(part)
262 return r ; value returned by callback, or zero.
263 }
264
265 VA_EnumSubunitsEx(part, data_flow, callback, target_name="", target_iid="", callback_param="")
266 {
267 r := 0
268
269 VA_IPart_GetPartType(part, type)
270
271 if type = 1 ; Subunit
272 {
273 VA_IPart_GetName(part, name)
274
275 ; v2.01: target_name is now a regular expression.
276 if RegExMatch(name, target_name)
277 {
278 if target_iid =
279 r := %callback%(part, 0, callback_param)
280 else
281 if VA_IPart_Activate(part, 7, target_iid, interface) = 0
282 {
283 r := %callback%(part, interface, callback_param)
284 ; The callback is responsible for calling COM_AddRef()
285 ; if it intends to keep the interface pointer.
286 COM_Release(interface)
287 }
288
289 if r
290 return r ; early termination
291 }
292 }
293
294 if data_flow = 0
295 VA_IPart_EnumPartsIncoming(part, parts)
296 else
297 VA_IPart_EnumPartsOutgoing(part, parts)
298
299 VA_IPartsList_GetCount(parts, count)
300 Loop %count%
301 {
302 VA_IPartsList_GetPart(parts, A_Index-1, subpart)
303 r := VA_EnumSubunitsEx(subpart, data_flow, callback, target_name, target_iid, callback_param)
304 COM_Release(subpart)
305 if r
306 break ; early termination
307 }
308 COM_Release(parts)
309 return r ; continue/finished enumeration
310 }
311
312 ; device_desc = device_id
313 ; | ( friendly_name | 'playback' | 'capture' ) [ ':' index ]
314 VA_GetDevice(device_desc="playback")
315 {
316 if ! deviceEnumerator := COM_CreateObject("{BCDE0395-E52F-467C-8E3D-C4579291692E}","{A95664D2-9614-4F35-A746-DE8DB63617E6}")
317 return 0
318
319 device := 0
320
321 ; deviceEnumerator->GetDevice(device_id, [out] device)
322 if DllCall(NumGet(NumGet(deviceEnumerator+0)+20), "uint",deviceEnumerator, "uint",COM_Unicode4Ansi(wstr, device_desc), "uint*",device) = 0
323 goto VA_GetDevice_Return
324
325 if device_desc is integer
326 m2 := device_desc
327 else
328 RegExMatch(device_desc, "(.*?)\s*(?::(\d+))?$", m)
329
330 if m1 in playback,p
331 m1 := "", flow := 0 ; eRender
332 else if m1 in capture,c
333 m1 := "", flow := 1 ; eCapture
334 else if (m1 . m2) = "" ; no name or number specified
335 m1 := "", flow := 0 ; eRender (default)
336 else
337 flow := 2 ; eAll
338
339 if (m1 . m2) = "" ; no name or number (maybe "playback" or "capture")
340 { ; deviceEnumerator->GetDefaultAudioEndpoint(dataFlow, role, [out] device)
341 DllCall(NumGet(NumGet(deviceEnumerator+0)+16), "uint",deviceEnumerator, "uint",flow, "uint",0, "uint*",device)
342 goto VA_GetDevice_Return
343 }
344
345 ; deviceEnumerator->EnumAudioEndpoints(dataFlow, stateMask, [out] devices)
346 DllCall(NumGet(NumGet(deviceEnumerator+0)+12), "uint",deviceEnumerator, "uint",flow, "uint",1, "uint*",devices)
347
348 ; devices->GetCount([out] count)
349 DllCall(NumGet(NumGet(devices+0)+12), "uint",devices, "uint*",count)
350
351 if m1 =
352 { ; devices->Item(m2-1, [out] device)
353 DllCall(NumGet(NumGet(devices+0)+16), "uint",devices, "uint",m2-1, "uint*",device)
354 goto VA_GetDevice_Return
355 }
356
357 index := 0
358 Loop % count
359 ; devices->Item(A_Index-1, [out] device)
360 if DllCall(NumGet(NumGet(devices+0)+16), "uint",devices, "uint",A_Index-1, "uint*",device) = 0
361 if InStr(VA_GetDeviceName(device), m1) && (m2 = "" || ++index = m2)
362 goto VA_GetDevice_Return
363 else
364 COM_Release(device), device:=0
365
366 VA_GetDevice_Return:
367 COM_Release(deviceEnumerator)
368 if devices
369 COM_Release(devices)
370
371 return device ; may be 0
372 }
373
374 VA_GetDeviceName(device)
375 {
376 static PKEY_Device_FriendlyName
377 if !VarSetCapacity(PKEY_Device_FriendlyName)
378 VarSetCapacity(PKEY_Device_FriendlyName, 20)
379 ,COM_GUID4String(PKEY_Device_FriendlyName, "{A45C254E-DF1C-4EFD-8020-67D146A850E0}")
380 ,NumPut(14, PKEY_Device_FriendlyName, 16)
381 VarSetCapacity(prop, 16)
382 VA_IMMDevice_OpenPropertyStore(device, 0, store)
383 ; store->GetValue(.., [out] prop)
384 DllCall(NumGet(NumGet(store+0)+20), "uint",store, "uint",&PKEY_Device_FriendlyName, "uint",&prop)
385 COM_Release(store)
386 return COM_Ansi4Unicode(NumGet(prop,8)), COM_CoTaskMemFree(NumGet(prop,8))
387 }
388
389
390 VA_dB2Scalar(dB, min_dB, max_dB) {
391 min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
392 return ((10**(dB/20))-min_s)/(max_s-min_s)*100
393 }
394
395 VA_Scalar2dB(s, min_dB, max_dB) {
396 min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
397 return log((max_s-min_s)*s+min_s)*20
398 }
399
400
401 ;
402 ; INTERFACE WRAPPERS
403 ; Reference: Core Audio APIs in Windows Vista -- Programming Reference
404 ; http://msdn2.microsoft.com/en-us/library/ms679156(VS.85).aspx
405 ;
406
407 ;
408 ; IMMDevice
409 ;
410 VA_IMMDevice_Activate(this, iid, ClsCtx, ActivationParams, ByRef Interface) {
411 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "uint", COM_GUID4String(iid,iid), "uint", ClsCtx, "uint", ActivationParams, "uint*", Interface)
412 }
413 VA_IMMDevice_OpenPropertyStore(this, Access, ByRef Properties) {
414 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "uint", Access, "uint*", Properties)
415 }
416 VA_IMMDevice_GetId(this, ByRef Id) {
417 hr := DllCall(NumGet(NumGet(this+0)+20), "uint", this, "uint*", Id)
418 Id := (COM_Ansi4Unicode(Id),COM_CoTaskMemFree(Id))
419 return hr
420 }
421 VA_IMMDevice_GetState(this, ByRef State) {
422 return DllCall(NumGet(NumGet(this+0)+24), "uint", this, "uint*", State)
423 }
424
425 ;
426 ; IDeviceTopology
427 ;
428 VA_IDeviceTopology_GetConnectorCount(this, ByRef Count) {
429 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "uint*", Count)
430 }
431 VA_IDeviceTopology_GetConnector(this, Index, ByRef Connector) {
432 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "uint", Index, "uint*", Connector)
433 }
434 VA_IDeviceTopology_GetSubunitCount(this, ByRef Count) {
435 return DllCall(NumGet(NumGet(this+0)+20), "uint", this, "uint*", Count)
436 }
437 VA_IDeviceTopology_GetSubunit(this, Index, ByRef Subunit) {
438 return DllCall(NumGet(NumGet(this+0)+24), "uint", this, "uint", Index, "uint*", Subunit)
439 }
440 VA_IDeviceTopology_GetPartById(this, Id, ByRef Part) {
441 return DllCall(NumGet(NumGet(this+0)+28), "uint", this, "uint", Id, "uint*", Part)
442 }
443 VA_IDeviceTopology_GetDeviceId(this, ByRef DeviceId) {
444 hr := DllCall(NumGet(NumGet(this+0)+32), "uint", this, "uint*", DeviceId)
445 DeviceId := (COM_Ansi4Unicode(DeviceId),COM_CoTaskMemFree(DeviceId))
446 return hr
447 }
448 VA_IDeviceTopology_GetSignalPath(this, PartFrom, PartTo, RejectMixedPaths, ByRef Parts) {
449 return DllCall(NumGet(NumGet(this+0)+36), "uint", this, "uint", PartFrom, "uint", PartTo, "int", RejectMixedPaths, "uint*", Parts)
450 }
451
452 ;
453 ; IConnector
454 ;
455 VA_IConnector_GetType(this, ByRef Type) {
456 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "int*", Type)
457 }
458 VA_IConnector_GetDataFlow(this, ByRef Flow) {
459 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "int*", Flow)
460 }
461 VA_IConnector_ConnectTo(this, ConnectTo) {
462 return DllCall(NumGet(NumGet(this+0)+20), "uint", this, "uint", ConnectTo)
463 }
464 VA_IConnector_Disconnect(this) {
465 return DllCall(NumGet(NumGet(this+0)+24), "uint", this)
466 }
467 VA_IConnector_IsConnected(this, ByRef Connected) {
468 return DllCall(NumGet(NumGet(this+0)+28), "uint", this, "int*", Connected)
469 }
470 VA_IConnector_GetConnectedTo(this, ByRef ConTo) {
471 return DllCall(NumGet(NumGet(this+0)+32), "uint", this, "uint*", ConTo)
472 }
473 VA_IConnector_GetConnectorIdConnectedTo(this, ByRef ConnectorId) {
474 hr := DllCall(NumGet(NumGet(this+0)+36), "uint", this, "uint*", ConnectorId)
475 ConnectorId := (COM_Ansi4Unicode(ConnectorId),COM_CoTaskMemFree(ConnectorId))
476 return hr
477 }
478 VA_IConnector_GetDeviceIdConnectedTo(this, ByRef DeviceId) {
479 hr := DllCall(NumGet(NumGet(this+0)+40), "uint", this, "uint*", DeviceId)
480 DeviceId := (COM_Ansi4Unicode(DeviceId),COM_CoTaskMemFree(DeviceId))
481 return hr
482 }
483
484 ;
485 ; IPart
486 ;
487 VA_IPart_GetName(this, ByRef Name) {
488 hr := DllCall(NumGet(NumGet(this+0)+12), "uint", this, "uint*", Name)
489 Name := (COM_Ansi4Unicode(Name),COM_CoTaskMemFree(Name))
490 return hr
491 }
492 VA_IPart_GetLocalId(this, ByRef Id) {
493 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "uint*", Id)
494 }
495 VA_IPart_GetGlobalId(this, ByRef GlobalId) {
496 hr := DllCall(NumGet(NumGet(this+0)+20), "uint", this, "uint*", GlobalId)
497 GlobalId := (COM_Ansi4Unicode(GlobalId),COM_CoTaskMemFree(GlobalId))
498 return hr
499 }
500 VA_IPart_GetPartType(this, ByRef PartType) {
501 return DllCall(NumGet(NumGet(this+0)+24), "uint", this, "int*", PartType)
502 }
503 VA_IPart_GetSubType(this, ByRef SubType) {
504 VarSetCapacity(SubType,16,0)
505 hr := DllCall(NumGet(NumGet(this+0)+28), "uint", this, "uint", &SubType)
506 SubType := COM_String4GUID(&SubType)
507 return hr
508 }
509 VA_IPart_GetControlInterfaceCount(this, ByRef Count) {
510 return DllCall(NumGet(NumGet(this+0)+32), "uint", this, "uint*", Count)
511 }
512 VA_IPart_GetControlInterface(this, Index, ByRef InterfaceDesc) {
513 return DllCall(NumGet(NumGet(this+0)+36), "uint", this, "uint", Index, "uint*", InterfaceDesc)
514 }
515 VA_IPart_EnumPartsIncoming(this, ByRef Parts) {
516 return DllCall(NumGet(NumGet(this+0)+40), "uint", this, "uint*", Parts)
517 }
518 VA_IPart_EnumPartsOutgoing(this, ByRef Parts) {
519 return DllCall(NumGet(NumGet(this+0)+44), "uint", this, "uint*", Parts)
520 }
521 VA_IPart_GetTopologyObject(this, ByRef Topology) {
522 return DllCall(NumGet(NumGet(this+0)+48), "uint", this, "uint*", Topology)
523 }
524 VA_IPart_Activate(this, ClsContext, iid, ByRef Object) {
525 return DllCall(NumGet(NumGet(this+0)+52), "uint", this, "uint", ClsContext, "uint", COM_GUID4String(iid,iid), "uint*", Object)
526 }
527 VA_IPart_RegisterControlChangeCallback(this, iid, Notify) {
528 return DllCall(NumGet(NumGet(this+0)+56), "uint", this, "uint", COM_GUID4String(iid,iid), "uint", Notify)
529 }
530 VA_IPart_UnregisterControlChangeCallback(this, Notify) {
531 return DllCall(NumGet(NumGet(this+0)+60), "uint", this, "uint", Notify)
532 }
533
534 ;
535 ; IPartsList
536 ;
537 VA_IPartsList_GetCount(this, ByRef Count) {
538 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "uint*", Count)
539 }
540 VA_IPartsList_GetPart(this, INdex, ByRef Part) {
541 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "uint", INdex, "uint*", Part)
542 }
543
544 ;
545 ; IAudioEndpointVolume
546 ;
547 VA_IAudioEndpointVolume_RegisterControlChangeNotify(this, Notify) {
548 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "uint", Notify)
549 }
550 VA_IAudioEndpointVolume_UnregisterControlChangeNotify(this, Notify) {
551 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "uint", Notify)
552 }
553 VA_IAudioEndpointVolume_GetChannelCount(this, ByRef ChannelCount) {
554 return DllCall(NumGet(NumGet(this+0)+20), "uint", this, "uint*", ChannelCount)
555 }
556 VA_IAudioEndpointVolume_SetMasterVolumeLevel(this, LevelDB, GuidEventContext="") {
557 return DllCall(NumGet(NumGet(this+0)+24), "uint", this, "float", LevelDB, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
558 }
559 VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(this, Level, GuidEventContext="") {
560 return DllCall(NumGet(NumGet(this+0)+28), "uint", this, "float", Level, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
561 }
562 VA_IAudioEndpointVolume_GetMasterVolumeLevel(this, ByRef LevelDB) {
563 return DllCall(NumGet(NumGet(this+0)+32), "uint", this, "float*", LevelDB)
564 }
565 VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(this, ByRef Level) {
566 return DllCall(NumGet(NumGet(this+0)+36), "uint", this, "float*", Level)
567 }
568 VA_IAudioEndpointVolume_SetChannelVolumeLevel(this, Channel, LevelDB, GuidEventContext="") {
569 return DllCall(NumGet(NumGet(this+0)+40), "uint", this, "uint", Channel, "float", LevelDB, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
570 }
571 VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(this, Channel, Level, GuidEventContext="") {
572 return DllCall(NumGet(NumGet(this+0)+44), "uint", this, "uint", Channel, "float", Level, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
573 }
574 VA_IAudioEndpointVolume_GetChannelVolumeLevel(this, Channel, ByRef LevelDB) {
575 return DllCall(NumGet(NumGet(this+0)+48), "uint", this, "uint", Channel, "float*", LevelDB)
576 }
577 VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(this, Channel, ByRef Level) {
578 return DllCall(NumGet(NumGet(this+0)+52), "uint", this, "uint", Channel, "float*", Level)
579 }
580 VA_IAudioEndpointVolume_SetMute(this, Mute, GuidEventContext="") {
581 return DllCall(NumGet(NumGet(this+0)+56), "uint", this, "int", Mute, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
582 }
583 VA_IAudioEndpointVolume_GetMute(this, ByRef Mute) {
584 return DllCall(NumGet(NumGet(this+0)+60), "uint", this, "int*", Mute)
585 }
586 VA_IAudioEndpointVolume_GetVolumeStepInfo(this, ByRef Step, ByRef StepCount) {
587 return DllCall(NumGet(NumGet(this+0)+64), "uint", this, "uint*", Step, "uint*", StepCount)
588 }
589 VA_IAudioEndpointVolume_VolumeStepUp(this, GuidEventContext="") {
590 return DllCall(NumGet(NumGet(this+0)+68), "uint", this, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
591 }
592 VA_IAudioEndpointVolume_VolumeStepDown(this, GuidEventContext="") {
593 return DllCall(NumGet(NumGet(this+0)+72), "uint", this, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
594 }
595 VA_IAudioEndpointVolume_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
596 return DllCall(NumGet(NumGet(this+0)+76), "uint", this, "uint*", HardwareSupportMask)
597 }
598 VA_IAudioEndpointVolume_GetVolumeRange(this, ByRef MinDB, ByRef MaxDB, ByRef IncrementDB) {
599 return DllCall(NumGet(NumGet(this+0)+80), "uint", this, "float*", MinDB, "float*", MaxDB, "float*", IncrementDB)
600 }
601
602 ;
603 ; IPerChannelDbLevel
604 ; Applies to IAudioVolumeLevel, IAudioBass, IAudioMidrange and IAudioTreble.
605 ;
606 VA_IPerChannelDbLevel_GetChannelCount(this, ByRef Channels) {
607 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "uint*", Channels)
608 }
609 VA_IPerChannelDbLevel_GetLevelRange(this, Channel, ByRef MinLevelDB, ByRef MaxLevelDB, ByRef Stepping) {
610 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "uint", Channel, "float*", MinLevelDB, "float*", MaxLevelDB, "float*", Stepping)
611 }
612 VA_IPerChannelDbLevel_GetLevel(this, Channel, ByRef LevelDB) {
613 return DllCall(NumGet(NumGet(this+0)+20), "uint", this, "uint", Channel, "float*", LevelDB)
614 }
615 VA_IPerChannelDbLevel_SetLevel(this, Channel, LevelDB, GuidEventContext="") {
616 return DllCall(NumGet(NumGet(this+0)+24), "uint", this, "uint", Channel, "float", LevelDB, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
617 }
618 VA_IPerChannelDbLevel_SetLevelUniform(this, LevelDB, GuidEventContext="") {
619 return DllCall(NumGet(NumGet(this+0)+28), "uint", this, "float", LevelDB, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
620 }
621 VA_IPerChannelDbLevel_SetLevelAllChannels(this, LevelsDB, ChannelCount, GuidEventContext="") {
622 return DllCall(NumGet(NumGet(this+0)+32), "uint", this, "uint", LevelsDB, "uint", ChannelCount, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
623 }
624
625 ;
626 ; IAudioMute
627 ;
628 VA_IAudioMute_SetMute(this, Muted, GuidEventContext="") {
629 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "int", Muted, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
630 }
631 VA_IAudioMute_GetMute(this, ByRef Muted) {
632 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "int*", Muted)
633 }
634
635 ;
636 ; IAudioAutoGainControl
637 ;
638 VA_IAudioAutoGainControl_GetEnabled(this, ByRef Enabled) {
639 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "int*", Enabled)
640 }
641 VA_IAudioAutoGainControl_SetEnabled(this, Enable, GuidEventContext="") {
642 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "int", Enable, "uint", GuidEventContext ? COM_GUID4String(GuidEventContext,GuidEventContext) : 0)
643 }
644
645 ;
646 ; IAudioMeterInformation
647 ;
648 VA_IAudioMeterInformation_GetPeakValue(this, ByRef Peak) {
649 return DllCall(NumGet(NumGet(this+0)+12), "uint", this, "float*", Peak)
650 }
651 VA_IAudioMeterInformation_GetMeteringChannelCount(this, ByRef ChannelCount) {
652 return DllCall(NumGet(NumGet(this+0)+16), "uint", this, "uint*", ChannelCount)
653 }
654 VA_IAudioMeterInformation_GetChannelsPeakValues(this, ChannelCount, PeakValues) {
655 return DllCall(NumGet(NumGet(this+0)+20), "uint", this, "uint", ChannelCount, "uint", PeakValues)
656 }
657 VA_IAudioMeterInformation_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
658 return DllCall(NumGet(NumGet(this+0)+24), "uint", this, "uint*", HardwareSupportMask)
659 }