Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting information form audio devices
#1
Gintaras, i want to extend the setaudiovolume function of QM.

I want to get all available devices, but i can't do the last step (get the name).

If you could help, thanks

Macro Macro1
Code:
Copy      Help
#opt nowarnings 1
IMMDeviceCollection ppDevices
int dwStateMask
def DEVICE_STATE_ACTIVE      0x00000001
def DEVICE_STATE_DISABLED    0x00000002
def DEVICE_STATE_NOTPRESENT  0x00000004
def DEVICE_STATE_UNPLUGGED   0x00000008
def DEVICE_STATEMASK_ALL     0x0000000F
int stgmAccess
PROPERTYKEY pk
pk.pid=6
GUID t=pk.fmtid
IMMDeviceEnumerator en
IPropertyStore pProps
word w
VARIANT v

PROPVARIANT pActivationParams
IMMDevice de
IAudioEndpointVolume av
en._create(CLSID_MMDeviceEnumerator)
en.GetDefaultAudioEndpoint(eRender eMultimedia &de)
en.EnumAudioEndpoints(eRender DEVICE_STATEMASK_ALL &ppDevices)
ppDevices.GetCount(_i)
for int'u 0 _i
,ppDevices.Item(u &de)
,de.OpenPropertyStore(stgmAccess &pProps)
,pProps.GetAt(u &pk)
,pProps.GetValue(&pk +&v)
,pProps.Commit
,_s.FromGUID(pk.fmtid)
,;out _s
,;out pk.pid
,out pActivationParams.pbstrVal


i don't get the device name as expected, and get this in QM outpu:


why?

PS: trying to adapt from this
https://msdn.microsoft.com/en-us/librar ... 12(v=vs.85).aspx


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)