diff options
author | Alex Marsev <alex.marsev@gmail.com> | 2015-09-18 16:41:21 +0300 |
---|---|---|
committer | Alex Marsev <alex.marsev@gmail.com> | 2015-09-18 16:41:21 +0300 |
commit | cc453ddef1b864d0cf977db7c088ae13d28cdae2 (patch) | |
tree | c724eb00636f907589f1d2abebbf9e62300a0643 | |
parent | 86dc4f4389c84e12459be33413268b58b9367a70 (diff) |
Add FormFactor field to AudioDeviceBackend
-rw-r--r-- | src/AudioDevice.h | 1 | ||||
-rw-r--r-- | src/AudioDeviceManager.cpp | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/AudioDevice.h b/src/AudioDevice.h index b2990bf..51e79a0 100644 --- a/src/AudioDevice.h +++ b/src/AudioDevice.h @@ -10,6 +10,7 @@ namespace SaneAudioRenderer SharedString id;
SharedString adapterName;
SharedString endpointName;
+ UINT32 endpointFormFactor;
IAudioClientPtr audioClient;
IAudioRenderClientPtr audioRenderClient;
diff --git a/src/AudioDeviceManager.cpp b/src/AudioDeviceManager.cpp index 727b8d1..1e7320e 100644 --- a/src/AudioDeviceManager.cpp +++ b/src/AudioDeviceManager.cpp @@ -35,6 +35,20 @@ namespace SaneAudioRenderer return ret;
}
+ UINT32 GetDevicePropertyUint(IPropertyStore* pStore, REFPROPERTYKEY key)
+ {
+ assert(pStore);
+
+ PROPVARIANT prop;
+ PropVariantInit(&prop);
+ ThrowIfFailed(pStore->GetValue(key, &prop));
+ assert(prop.vt == VT_UI4);
+ UINT32 ret = prop.uintVal;
+ PropVariantClear(&prop);
+
+ return ret;
+ }
+
SharedString GetDevicePropertyString(IPropertyStore* pStore, REFPROPERTYKEY key)
{
assert(pStore);
@@ -96,6 +110,11 @@ namespace SaneAudioRenderer backend.adapterName = GetDevicePropertyString(devicePropertyStore, PKEY_DeviceInterface_FriendlyName);
backend.endpointName = GetDevicePropertyString(devicePropertyStore, PKEY_Device_DeviceDesc);
+ static const PROPERTYKEY formFactorKey = { // PKEY_AudioEndpoint_FormFactor
+ {0x1da5d803, 0xd492, 0x4edd, {0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e}}, 0
+ };
+ backend.endpointFormFactor = GetDevicePropertyUint(devicePropertyStore, formFactorKey);
+
ThrowIfFailed(device->Activate(__uuidof(IAudioClient),
CLSCTX_INPROC_SERVER, nullptr, (void**)&backend.audioClient));
}
|