#include <assert.h>
#include <audiopolicy.h>
#include <mmdeviceapi.h>
+#include <endpointvolume.h>
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd,
0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
IAudioSessionManager *manager;
IAudioSessionControl *control;
ISimpleAudioVolume *volume;
+ IAudioEndpointVolume *endpoint;
void *pv;
HRESULT hr;
volume = NULL;
}
+ hr = IMMDevice_Activate(sys->dev, &IID_IAudioEndpointVolume,
+ CLSCTX_ALL, NULL, &pv);
+ endpoint = pv;
+ if (SUCCEEDED(hr))
+ {
+ float min, max, inc;
+
+ hr = IAudioEndpointVolume_GetVolumeRange(endpoint, &min, &max, &inc);
+ if (SUCCEEDED(hr))
+ msg_Dbg(aout, "volume from %+f dB to %+f dB with %f dB increments",
+ min, max, inc);
+ else
+ msg_Err(aout, "cannot get volume range (error 0x%lx)", hr);
+ }
+ else
+ msg_Err(aout, "cannot activate endpoint volume (error %lx)", hr);
+
/* Main loop (adjust volume as long as device is unchanged) */
while (sys->device == NULL)
{
}
LeaveCriticalSection(&sys->lock);
+ if (endpoint != NULL)
+ IAudioEndpointVolume_Release(endpoint);
+
if (manager != NULL)
{ /* Deregister callbacks *without* the lock */
if (volume != NULL)